diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/ChangeLog | 10 | ||||
| -rw-r--r-- | test/automated/ruby-mode-tests.el | 19 | ||||
| -rw-r--r-- | test/indent/ruby.rb | 7 |
3 files changed, 36 insertions, 0 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index c11d5d26c13..5c17e09e962 100644 --- a/test/ChangeLog +++ b/test/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2013-05-19 Dmitry Gutov <dgutov@yandex.ru> | ||
| 2 | |||
| 3 | * indent/ruby.rb: Add multiline regexp example. | ||
| 4 | |||
| 5 | * automated/ruby-mode-tests.el (ruby-heredoc-highlights-interpolations) | ||
| 6 | (ruby-regexp-skips-over-interpolation) | ||
| 7 | (ruby-regexp-continues-till-end-when-unclosed) | ||
| 8 | (ruby-regexp-can-be-multiline) | ||
| 9 | (ruby-interpolation-inside-percent-literal): New tests. | ||
| 10 | |||
| 1 | 2013-05-08 Stefan Monnier <monnier@iro.umontreal.ca> | 11 | 2013-05-08 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 12 | ||
| 3 | * indent/ruby.rb: Fix indentation after =; add more cases. | 13 | * indent/ruby.rb: Fix indentation after =; add more cases. |
diff --git a/test/automated/ruby-mode-tests.el b/test/automated/ruby-mode-tests.el index 23dc45ad509..e52927a2968 100644 --- a/test/automated/ruby-mode-tests.el +++ b/test/automated/ruby-mode-tests.el | |||
| @@ -84,6 +84,9 @@ VALUES-PLIST is a list with alternating index and value elements." | |||
| 84 | (ert-deftest ruby-singleton-class-no-heredoc-font-lock () | 84 | (ert-deftest ruby-singleton-class-no-heredoc-font-lock () |
| 85 | (ruby-assert-face "class<<a" 8 nil)) | 85 | (ruby-assert-face "class<<a" 8 nil)) |
| 86 | 86 | ||
| 87 | (ert-deftest ruby-heredoc-highlights-interpolations () | ||
| 88 | (ruby-assert-face "s = <<EOS\n #{foo}\nEOS" 15 font-lock-variable-name-face)) | ||
| 89 | |||
| 87 | (ert-deftest ruby-deep-indent () | 90 | (ert-deftest ruby-deep-indent () |
| 88 | (let ((ruby-deep-arglist nil) | 91 | (let ((ruby-deep-arglist nil) |
| 89 | (ruby-deep-indent-paren '(?\( ?\{ ?\[ ?\] t))) | 92 | (ruby-deep-indent-paren '(?\( ?\{ ?\[ ?\] t))) |
| @@ -109,6 +112,15 @@ VALUES-PLIST is a list with alternating index and value elements." | |||
| 109 | (ert-deftest ruby-regexp-starts-after-string () | 112 | (ert-deftest ruby-regexp-starts-after-string () |
| 110 | (ruby-assert-state "'(/', /\d+/" 3 ?/ 8)) | 113 | (ruby-assert-state "'(/', /\d+/" 3 ?/ 8)) |
| 111 | 114 | ||
| 115 | (ert-deftest ruby-regexp-skips-over-interpolation () | ||
| 116 | (ruby-assert-state "/#{foobs.join('/')}/" 3 nil)) | ||
| 117 | |||
| 118 | (ert-deftest ruby-regexp-continues-till-end-when-unclosed () | ||
| 119 | (ruby-assert-state "/bars" 3 ?/)) | ||
| 120 | |||
| 121 | (ert-deftest ruby-regexp-can-be-multiline () | ||
| 122 | (ruby-assert-state "/bars\ntees # toots \nfoos/" 3 nil)) | ||
| 123 | |||
| 112 | (ert-deftest ruby-indent-simple () | 124 | (ert-deftest ruby-indent-simple () |
| 113 | (ruby-should-indent-buffer | 125 | (ruby-should-indent-buffer |
| 114 | "if foo | 126 | "if foo |
| @@ -325,6 +337,13 @@ VALUES-PLIST is a list with alternating index and value elements." | |||
| 325 | (search-forward "tee") | 337 | (search-forward "tee") |
| 326 | (should (string= (thing-at-point 'symbol) "tee"))))) | 338 | (should (string= (thing-at-point 'symbol) "tee"))))) |
| 327 | 339 | ||
| 340 | (ert-deftest ruby-interpolation-inside-percent-literal () | ||
| 341 | (let ((s "%( #{boo} )")) | ||
| 342 | (ruby-assert-face s 1 font-lock-string-face) | ||
| 343 | (ruby-assert-face s 4 font-lock-variable-name-face) | ||
| 344 | (ruby-assert-face s 10 font-lock-string-face) | ||
| 345 | (ruby-assert-state s 8 nil))) | ||
| 346 | |||
| 328 | (ert-deftest ruby-interpolation-inside-percent-literal-with-paren () | 347 | (ert-deftest ruby-interpolation-inside-percent-literal-with-paren () |
| 329 | :expected-result :failed | 348 | :expected-result :failed |
| 330 | (let ((s "%(^#{\")\"}^)")) | 349 | (let ((s "%(^#{\")\"}^)")) |
diff --git a/test/indent/ruby.rb b/test/indent/ruby.rb index 90c6dcdc65c..853f4dbf992 100644 --- a/test/indent/ruby.rb +++ b/test/indent/ruby.rb | |||
| @@ -21,6 +21,11 @@ a = asub / aslb + bsub / bslb; | |||
| 21 | # Highlight the regexp after "if". | 21 | # Highlight the regexp after "if". |
| 22 | x = toto / foo if /do bar/ =~ "dobar" | 22 | x = toto / foo if /do bar/ =~ "dobar" |
| 23 | 23 | ||
| 24 | # Multiline regexp. | ||
| 25 | /bars | ||
| 26 | tees # toots | ||
| 27 | nfoos/ | ||
| 28 | |||
| 24 | def test1(arg) | 29 | def test1(arg) |
| 25 | puts "hello" | 30 | puts "hello" |
| 26 | end | 31 | end |
| @@ -47,6 +52,8 @@ def test2 (arg) | |||
| 47 | case a | 52 | case a |
| 48 | when "a" | 53 | when "a" |
| 49 | 6 | 54 | 6 |
| 55 | # Support for this syntax was removed in Ruby 1.9, so we | ||
| 56 | # probably don't need to handle it either. | ||
| 50 | # when "b" : | 57 | # when "b" : |
| 51 | # 7 | 58 | # 7 |
| 52 | # when "c" : 2 | 59 | # when "c" : 2 |