diff options
Diffstat (limited to 'test/indent/ruby.rb')
| -rw-r--r-- | test/indent/ruby.rb | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/test/indent/ruby.rb b/test/indent/ruby.rb index 4f2e9e63377..853f4dbf992 100644 --- a/test/indent/ruby.rb +++ b/test/indent/ruby.rb | |||
| @@ -10,7 +10,7 @@ d = %(hello (nested) world) | |||
| 10 | 10 | ||
| 11 | # Or inside comments. | 11 | # Or inside comments. |
| 12 | x = # "tot %q/to"; = | 12 | x = # "tot %q/to"; = |
| 13 | y = 2 / 3 | 13 | y = 2 / 3 |
| 14 | 14 | ||
| 15 | # Regexp after whitelisted method. | 15 | # Regexp after whitelisted method. |
| 16 | "abc".sub /b/, 'd' | 16 | "abc".sub /b/, 'd' |
| @@ -21,6 +21,47 @@ 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 | |||
| 29 | def test1(arg) | ||
| 30 | puts "hello" | ||
| 31 | end | ||
| 32 | |||
| 33 | def test2 (arg) | ||
| 34 | a = "apple" | ||
| 35 | |||
| 36 | if a == 2 | ||
| 37 | puts "hello" | ||
| 38 | else | ||
| 39 | puts "there" | ||
| 40 | end | ||
| 41 | |||
| 42 | if a == 2 then | ||
| 43 | puts "hello" | ||
| 44 | elsif a == 3 | ||
| 45 | puts "hello3" | ||
| 46 | elsif a == 3 then | ||
| 47 | puts "hello3" | ||
| 48 | else | ||
| 49 | puts "there" | ||
| 50 | end | ||
| 51 | |||
| 52 | case a | ||
| 53 | when "a" | ||
| 54 | 6 | ||
| 55 | # Support for this syntax was removed in Ruby 1.9, so we | ||
| 56 | # probably don't need to handle it either. | ||
| 57 | # when "b" : | ||
| 58 | # 7 | ||
| 59 | # when "c" : 2 | ||
| 60 | when "d" then 4 | ||
| 61 | else 5 | ||
| 62 | end | ||
| 63 | end | ||
| 64 | |||
| 24 | # Some Cucumber code: | 65 | # Some Cucumber code: |
| 25 | Given /toto/ do | 66 | Given /toto/ do |
| 26 | print "hello" | 67 | print "hello" |