Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 48 lines (44 sloc) 0.632 kB
46b098e @matz minor correction in test/t/syntax.rb
matz authored
1 assert('super', '11.3.4') do
2 test = false
3 begin
4 super
5 rescue NoMethodError
6 test = true
7 end
8
9 class SuperFoo
10 def foo
11 true
12 end
13 def bar(*a)
14 a
15 end
16 end
17 class SuperBar < SuperFoo
18 def foo
19 super
20 end
21 def bar(*a)
22 super(*a)
23 end
24 end
25 bar = SuperBar.new
26 test &&= bar.foo
27 test &&= (bar.bar(1,2,3) == [1,2,3])
28 test
29 end
30
31 assert('yield', '11.3.5') do
32 begin
33 yield
34 rescue LocalJumpError
35 true
36 else
37 false
38 end
39 end
40
41 assert('Abbreviated variable assignment', '11.4.2.3.2') do
42 a ||= 1
43 b &&= 1
44 c = 1
45 c += 2
46 a == 1 and b == nil and c == 3
47 end
Something went wrong with that request. Please try again.