branch: elpa/raku-mode commit 04f458529eca41927fed378ad32642ed2a49b3b1 Author: Matias Linares <matiasl...@gmail.com> Commit: Matias Linares <matiasl...@gmail.com>
Rename perl6 -> raku in test files --- test/perl6-mode-test.el | 122 ------------------------------------------------ test/raku-mode-test.el | 122 ++++++++++++++++++++++++++++++++++++++++++++++++ test/test-helper.el | 4 +- test/test-imenu.nqp | 4 +- test/test-imenu.p6 | 4 +- test/test-smie.p6 | 2 +- 6 files changed, 129 insertions(+), 129 deletions(-) diff --git a/test/perl6-mode-test.el b/test/perl6-mode-test.el deleted file mode 100644 index c3b624bc83..0000000000 --- a/test/perl6-mode-test.el +++ /dev/null @@ -1,122 +0,0 @@ -;;; perl6-mode-test.el --- Perl 6 Mode: Unit test suite -*- lexical-binding: t; -*- - -;;; Commentary: - -;; The unit test suite of Perl 6 Mode. - -;;; Code: - -(require 'perl6-mode) -(require 'ert) - - -;;;; Utilities - -(defmacro perl6-test-with-temp-buffer (content &rest body) - "In the temporary buffer CONTENT, evaluate BODY." - (declare (debug t) - (indent 1)) - `(with-temp-buffer - (insert ,content) - (perl6-mode) - (font-lock-fontify-buffer) - (goto-char (point-min)) - ,@body)) - -(defun perl6-test-face-at (pos &optional content) - "Get the face at POS in CONTENT. - -If CONTENT is not given, return the face at POS in the current -buffer." - (if content - (perl6-test-with-temp-buffer content - (get-text-property pos 'face)) - (get-text-property pos 'face))) - -(defconst perl6-test-syntax-classes - [whitespace punctuation word symbol open-paren close-paren expression-prefix - string-quote paired-delim escape character-quote comment-start - comment-end inherit generic-comment generic-string] - "Readable symbols for syntax classes. - -Each symbol in this vector corresponding to the syntax code of -its index.") - -(defun perl6-test-syntax-at (pos) - "Get the syntax at POS. - -Get the syntax class symbol at POS, or nil if there is no syntax a -POS." - (let ((code (syntax-class (syntax-after pos)))) - (aref perl6-test-syntax-classes code))) - - -;;;; Font locking -(ert-deftest perl6-syntax-propertize/colons-identifier () - :tags '(syntax-table syntax-properties) - (perl6-test-with-temp-buffer "class Foo::Bar" - (should (eq (perl6-test-syntax-at 10) 'symbol)) - (should (eq (perl6-test-syntax-at 11) 'symbol)))) - -(ert-deftest perl6-syntax-propertize/angles () - :tags '(syntax-table syntax-properties) - (perl6-test-with-temp-buffer "my @foo = <bar>; for @foo <-> $bar {}" - (should (eq (perl6-test-syntax-at 11) 'generic-string)) - (should (eq (perl6-test-syntax-at 15) 'generic-string)) - (should (eq (perl6-test-syntax-at 27) 'punctuation)) - (should (eq (perl6-test-syntax-at 29) 'punctuation)))) - -(ert-deftest perl6-syntax-propertize/dq-words () - :tags '(syntax-table syntax-properties) - (perl6-test-with-temp-buffer "foo «bar1 bar2» bla <<baz1 baz2>> quux" - (should (eq (perl6-test-syntax-at 1) 'word)) - (should (eq (perl6-test-syntax-at 5) 'generic-string)) - (should (eq (perl6-test-syntax-at 15) 'generic-string)) - (should (eq (perl6-test-syntax-at 21) 'generic-string)) - (should (eq (perl6-test-syntax-at 22) 'punctuation)) - (should (eq (perl6-test-syntax-at 32) 'punctuation)) - (should (eq (perl6-test-syntax-at 33) 'generic-string)))) - -(ert-deftest perl6-mode-syntax-table/fontify-dq-string () - :tags '(fontification syntax-table) - (should (eq (perl6-test-face-at 9 "$foo = \"bar\"") 'perl6-string))) - -(ert-deftest perl6-mode-syntax-table/fontify-set-operator () - :tags '(fontification syntax-table) - (should (eq (perl6-test-face-at 6 "$mh (<+) $m") 'perl6-operator))) - -(ert-deftest perl6-mode-syntax-table/fontify-sq-string () - :tags '(fontification syntax-table) - (should (eq (perl6-test-face-at 9 "$foo = 'bar'") 'perl6-string))) - -(ert-deftest perl6-mode-syntax-table/fontify-line-comment () - :tags '(fontification syntax-table) - (perl6-test-with-temp-buffer "# class -bar #`<foo> baz" - (should (eq (perl6-test-face-at 3) 'perl6-comment)) - (should (eq (perl6-test-face-at 7) 'perl6-comment)) - (should (eq (perl6-test-face-at 8) 'perl6-comment)) - (should (eq (perl6-test-face-at 9) 'perl6-identifier)) - (should (eq (perl6-test-face-at 16) 'perl6-comment)))) - -(ert-deftest perl6-font-lock-keywords/phaser () - :tags '(fontification font-lock-keywords) - (perl6-test-with-temp-buffer "BEGIN {" - (should (eq (perl6-test-face-at 1) 'perl6-phaser)))) - -(ert-deftest perl5-font-lock-keywords/variable () - :tags '(fontification syntax-table) - (perl6-test-with-temp-buffer "$::foo @!bar" - (should (eq (perl6-test-face-at 3) 'perl6-var-package)) - (should (eq (perl6-test-face-at 4) 'perl6-var-name)) - (should (eq (perl6-test-face-at 8) 'perl6-sigil)) - (should (eq (perl6-test-face-at 9) 'perl6-twigil)) - (should (eq (perl6-test-face-at 10) 'perl6-var-name)))) - -(provide 'perl6-mode-test) - -;; Local Variables: -;; indent-tabs-mode: nil -;; End: - -;;; perl6-mode-test.el ends here diff --git a/test/raku-mode-test.el b/test/raku-mode-test.el new file mode 100644 index 0000000000..a503a1956d --- /dev/null +++ b/test/raku-mode-test.el @@ -0,0 +1,122 @@ +;;; raku-mode-test.el --- Raku Mode: Unit test suite -*- lexical-binding: t; -*- + +;;; Commentary: + +;; The unit test suite of Raku Mode. + +;;; Code: + +(require 'raku-mode) +(require 'ert) + + +;;;; Utilities + +(defmacro raku-test-with-temp-buffer (content &rest body) + "In the temporary buffer CONTENT, evaluate BODY." + (declare (debug t) + (indent 1)) + `(with-temp-buffer + (insert ,content) + (raku-mode) + (font-lock-fontify-buffer) + (goto-char (point-min)) + ,@body)) + +(defun raku-test-face-at (pos &optional content) + "Get the face at POS in CONTENT. + +If CONTENT is not given, return the face at POS in the current +buffer." + (if content + (raku-test-with-temp-buffer content + (get-text-property pos 'face)) + (get-text-property pos 'face))) + +(defconst raku-test-syntax-classes + [whitespace punctuation word symbol open-paren close-paren expression-prefix + string-quote paired-delim escape character-quote comment-start + comment-end inherit generic-comment generic-string] + "Readable symbols for syntax classes. + +Each symbol in this vector corresponding to the syntax code of +its index.") + +(defun raku-test-syntax-at (pos) + "Get the syntax at POS. + +Get the syntax class symbol at POS, or nil if there is no syntax a +POS." + (let ((code (syntax-class (syntax-after pos)))) + (aref raku-test-syntax-classes code))) + + +;;;; Font locking +(ert-deftest raku-syntax-propertize/colons-identifier () + :tags '(syntax-table syntax-properties) + (raku-test-with-temp-buffer "class Foo::Bar" + (should (eq (raku-test-syntax-at 10) 'symbol)) + (should (eq (raku-test-syntax-at 11) 'symbol)))) + +(ert-deftest raku-syntax-propertize/angles () + :tags '(syntax-table syntax-properties) + (raku-test-with-temp-buffer "my @foo = <bar>; for @foo <-> $bar {}" + (should (eq (raku-test-syntax-at 11) 'generic-string)) + (should (eq (raku-test-syntax-at 15) 'generic-string)) + (should (eq (raku-test-syntax-at 27) 'punctuation)) + (should (eq (raku-test-syntax-at 29) 'punctuation)))) + +(ert-deftest raku-syntax-propertize/dq-words () + :tags '(syntax-table syntax-properties) + (raku-test-with-temp-buffer "foo «bar1 bar2» bla <<baz1 baz2>> quux" + (should (eq (raku-test-syntax-at 1) 'word)) + (should (eq (raku-test-syntax-at 5) 'generic-string)) + (should (eq (raku-test-syntax-at 15) 'generic-string)) + (should (eq (raku-test-syntax-at 21) 'generic-string)) + (should (eq (raku-test-syntax-at 22) 'punctuation)) + (should (eq (raku-test-syntax-at 32) 'punctuation)) + (should (eq (raku-test-syntax-at 33) 'generic-string)))) + +(ert-deftest raku-mode-syntax-table/fontify-dq-string () + :tags '(fontification syntax-table) + (should (eq (raku-test-face-at 9 "$foo = \"bar\"") 'raku-string))) + +(ert-deftest raku-mode-syntax-table/fontify-set-operator () + :tags '(fontification syntax-table) + (should (eq (raku-test-face-at 6 "$mh (<+) $m") 'raku-operator))) + +(ert-deftest raku-mode-syntax-table/fontify-sq-string () + :tags '(fontification syntax-table) + (should (eq (raku-test-face-at 9 "$foo = 'bar'") 'raku-string))) + +(ert-deftest raku-mode-syntax-table/fontify-line-comment () + :tags '(fontification syntax-table) + (raku-test-with-temp-buffer "# class +bar #`<foo> baz" + (should (eq (raku-test-face-at 3) 'raku-comment)) + (should (eq (raku-test-face-at 7) 'raku-comment)) + (should (eq (raku-test-face-at 8) 'raku-comment)) + (should (eq (raku-test-face-at 9) 'raku-identifier)) + (should (eq (raku-test-face-at 16) 'raku-comment)))) + +(ert-deftest raku-font-lock-keywords/phaser () + :tags '(fontification font-lock-keywords) + (raku-test-with-temp-buffer "BEGIN {" + (should (eq (raku-test-face-at 1) 'raku-phaser)))) + +(ert-deftest perl5-font-lock-keywords/variable () + :tags '(fontification syntax-table) + (raku-test-with-temp-buffer "$::foo @!bar" + (should (eq (raku-test-face-at 3) 'raku-var-package)) + (should (eq (raku-test-face-at 4) 'raku-var-name)) + (should (eq (raku-test-face-at 8) 'raku-sigil)) + (should (eq (raku-test-face-at 9) 'raku-twigil)) + (should (eq (raku-test-face-at 10) 'raku-var-name)))) + +(provide 'raku-mode-test) + +;; Local Variables: +;; indent-tabs-mode: nil +;; End: + +;;; raku-mode-test.el ends here diff --git a/test/test-helper.el b/test/test-helper.el index bddd17f9a9..be45a29abc 100644 --- a/test/test-helper.el +++ b/test/test-helper.el @@ -1,4 +1,4 @@ -;;; test-helper.el --- Perl 6 Mode: Non-interactive unit-test setup -*- lexical-binding: t; -*- +;;; test-helper.el --- Raku Mode: Non-interactive unit-test setup -*- lexical-binding: t; -*- ;;; Commentary: @@ -14,7 +14,7 @@ (load-prefer-newer t)) ;; Load the file under test (add-to-list 'load-path source-directory) - (load (expand-file-name "perl6-mode"))) + (load (expand-file-name "raku-mode"))) ;; Local Variables: ;; indent-tabs-mode: nil diff --git a/test/test-imenu.nqp b/test/test-imenu.nqp index 307bd422b6..7f2b5d5b56 100644 --- a/test/test-imenu.nqp +++ b/test/test-imenu.nqp @@ -1,8 +1,8 @@ # file: test-imenu.p6 -# Perl 6 syntax file for testing perl6-mode with imenu support, which is located at: +# Raku syntax file for testing raku-mode with imenu support, which is located at: # -# https://github.com/tbrowder/perl6-mode [branch: "my-branch"] +# https://github.com/tbrowder/raku-mode [branch: "my-branch"] my $a; my @b; diff --git a/test/test-imenu.p6 b/test/test-imenu.p6 index 6268250e4d..8b5fcb4820 100644 --- a/test/test-imenu.p6 +++ b/test/test-imenu.p6 @@ -1,9 +1,9 @@ # file: test-imenu.p6 -# Perl 6 syntax file for testing perl6-mode with imenu support, which +# Raku syntax file for testing raku-mode with imenu support, which # is located at: # -# https://github.com/tbrowder/perl6-mode [branch: "my-branch"] +# https://github.com/tbrowder/raku-mode [branch: "my-branch"] my $a; my @b; diff --git a/test/test-smie.p6 b/test/test-smie.p6 index d6cdbd1c3f..f035ebee52 100644 --- a/test/test-smie.p6 +++ b/test/test-smie.p6 @@ -1,4 +1,4 @@ -#!/usr/bin/env perl6 +#!/usr/bin/env raku qq:to/HERE/; This is text that should not have its indention changed