Newer
Older
Ary Borenszweig
committed
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
require "../../spec_helper"
describe "Code gen: void" do
it "codegens void assignment" do
run("
fun foo : Void
end
a = foo
a
1
").to_i.should eq(1)
end
it "codegens void assignment in case" do
run("
require \"prelude\"
fun foo : Void
end
def bar
case 1
when 1
foo
when 2
raise \"oh no\"
end
end
bar
1
").to_i.should eq(1)
end
it "codegens void assignment in case with local variable" do
run("
require \"prelude\"
fun foo : Void
end
def bar
case 1
when 1
a = 1
foo
when 2
raise \"oh no\"
end
end
bar
1
").to_i.should eq(1)
end
it "codegens unreachable code" do
run(%(
a = nil
if a
b = a.foo
end
))
end
Ary Borenszweig
committed
it "codegens no return assignment" do
build("
Ary Borenszweig
committed
fun exit : NoReturn
end
Ary Borenszweig
committed
a
")
end