* frame.c (delete_frame): Avoid unnecessary 'this_f' test.
[emacs.git] / test / indent / ruby.rb
blob853f4dbf992456eb28872670d5b1cfbb0ce60258
1 # Percent literals.
2 b = %Q{This is a "string"}
3 c = %w!foo
4  bar
5  baz!
6 d = %(hello (nested) world)
8 # Don't propertize percent literals inside strings.
9 "(%s, %s)" % [123, 456]
11 # Or inside comments.
12 x = # "tot %q/to"; =
13   y = 2 / 3
15 # Regexp after whitelisted method.
16 "abc".sub /b/, 'd'
18 # Don't mis-match "sub" at the end of words.
19 a = asub / aslb + bsub / bslb;
21 # Highlight the regexp after "if".
22 x = toto / foo if /do bar/ =~ "dobar"
24 # Multiline regexp.
25 /bars
26  tees # toots
27  nfoos/
29 def test1(arg)
30   puts "hello"
31 end
33 def test2 (arg)
34   a = "apple"
36   if a == 2
37     puts "hello"
38   else
39     puts "there"
40   end
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
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
65 # Some Cucumber code:
66 Given /toto/ do
67   print "hello"
68 end