diff options
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 |