blob: 47221d42553a9fd48e9816433a0996f89bac5025 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
assert('super', '11.3.4') do
test = false
begin
super
rescue NoMethodError
test = true
end
class SuperFoo
def foo
true
end
def bar(*a)
a
end
end
class SuperBar < SuperFoo
def foo
super
end
def bar(*a)
super(*a)
end
end
bar = SuperBar.new
test &&= bar.foo
test &&= (bar.bar(1,2,3) == [1,2,3])
test
end
assert('yield', '11.3.5') do
begin
yield
rescue LocalJumpError
true
else
false
end
end
assert('Abbreviated variable assignment', '11.4.2.3.2') do
a ||= 1
b &&= 1
c = 1
c += 2
a == 1 and b == nil and c == 3
end
assert('Nested const reference') do
module Syntax4Const
CONST1 = "hello world"
class Const2
def const1
CONST1
end
end
end
Syntax4Const::CONST1 == "hello world" and
Syntax4Const::Const2.new.const1 == "hello world"
end
|