diff options
| author | Stefan Monnier | 2013-10-06 23:38:26 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2013-10-06 23:38:26 -0400 |
| commit | 7ccae3b126e1b01814e8bed7f903f5e2b6d448bd (patch) | |
| tree | c27b63b78e52c5aa573a46e9a9b94affc015c543 /test | |
| parent | c8af480df782d6ff2d99f34a1672b8640dfb673f (diff) | |
| download | emacs-7ccae3b126e1b01814e8bed7f903f5e2b6d448bd.tar.gz emacs-7ccae3b126e1b01814e8bed7f903f5e2b6d448bd.zip | |
* lisp/progmodes/ruby-mode.el: Fix recently added tests.
(ruby-smie-grammar): Add - and +.
(ruby-smie--redundant-do-p, ruby-smie--forward-id)
(ruby-smie--backward-id): New functions.
(ruby-smie--forward-token, ruby-smie--backward-token): Use them.
(ruby-smie-rules): Handle hanging do. Get rid of hack, not needed
any more.
* test/indent/ruby.rb: Add a few more tests; adjust some indentation.
Diffstat (limited to 'test')
| -rw-r--r-- | test/indent/ruby.rb | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/test/indent/ruby.rb b/test/indent/ruby.rb index e40ef217e54..7c8de323bdb 100644 --- a/test/indent/ruby.rb +++ b/test/indent/ruby.rb | |||
| @@ -99,6 +99,14 @@ if something == :== | |||
| 99 | do_something | 99 | do_something |
| 100 | end | 100 | end |
| 101 | 101 | ||
| 102 | # Example from http://www.ruby-doc.org/docs/ProgrammingRuby/html/language.html | ||
| 103 | d = 4 + 5 + # no '\' needed | ||
| 104 | 6 + 7 | ||
| 105 | |||
| 106 | # Example from http://www.ruby-doc.org/docs/ProgrammingRuby/html/language.html | ||
| 107 | e = 8 + 9 \ | ||
| 108 | + 10 # '\' needed | ||
| 109 | |||
| 102 | begin | 110 | begin |
| 103 | foo | 111 | foo |
| 104 | ensure | 112 | ensure |
| @@ -109,20 +117,27 @@ end | |||
| 109 | MSG = 'Separate every 3 digits in the integer portion of a number' + | 117 | MSG = 'Separate every 3 digits in the integer portion of a number' + |
| 110 | 'with underscores(_).' | 118 | 'with underscores(_).' |
| 111 | 119 | ||
| 112 | # Examples below fail with SMIE. | 120 | class C |
| 121 | def foo | ||
| 122 | self.end | ||
| 123 | D.new.class | ||
| 124 | end | ||
| 125 | end | ||
| 113 | 126 | ||
| 114 | a = foo(j, k) - | 127 | a = foo(j, k) - |
| 115 | bar_tee | 128 | bar_tee |
| 116 | 129 | ||
| 117 | while a < b do # "do" is optional | 130 | while a < b do # "do" is optional |
| 118 | foo | 131 | foo |
| 119 | end | 132 | end |
| 120 | 133 | ||
| 121 | desc "foo foo" \ | 134 | desc "foo foo" \ |
| 122 | "bar bar" | 135 | "bar bar" |
| 123 | 136 | ||
| 124 | foo. | 137 | foo. |
| 125 | bar | 138 | bar |
| 126 | 139 | ||
| 140 | # FIXME: is this really valid Ruby? Isn't the newline after "foo" treated as | ||
| 141 | # an implicit semi-colon? | ||
| 127 | foo | 142 | foo |
| 128 | .bar | 143 | .bar |