Skip to content

Commit af8eb24

Browse files
committed
Added tests for callref with sav
New tests in `tests/test_callref.nit` Signed-off-by: Louis-Vincent Boudreault <lv.boudreault95@gmail.com>
1 parent 57b1d75 commit af8eb24

File tree

2 files changed

+28
-15
lines changed

2 files changed

+28
-15
lines changed

tests/sav/test_callref.res

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
in A::fun1
2+
in B::fun1
3+
100
4+
in B::fun1
5+
in B::fun1
6+
in B::fun1
7+
110
8+
3
9+
5
10+
x is null
11+
x is null
12+
x is test
13+
x is 100

src/test_callref.nit renamed to tests/test_callref.nit

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# This file is part of NIT ( http://www.nitlanguage.org ).
22
#
3-
# Copyright 2019-2020 Louis-Vincent Boudreault <lv.boudreault95@gmail.com>
4-
#
53
# Licensed under the Apache License, Version 2.0 (the "License");
64
# you may not use this file except in compliance with the License.
75
# You may obtain a copy of the License at
@@ -63,42 +61,44 @@ end
6361

6462
var a = new A
6563
var b: A = new B
64+
6665
var f1 = &a.fun1
67-
assert f1.call == "in A::fun1"
66+
print f1.call # "in A::fun1"
67+
6868
var f2 = &b.fun1
69-
assert f2.call == "in B::fun1"
69+
print f2.call # "in B::fun1"
7070

7171
var f3 = &10.mult_by
72-
assert f3.call(10) == 100
72+
print f3.call(10) # 100
7373

7474
var f4 = &f2.call
75-
assert f4.call == "in B::fun1"
75+
print f4.call # "in B::fun1"
7676

7777
var f5: Fun0[Object] = &f4.call
78-
assert f5.call == "in B::fun1"
79-
assert f5.call == "in B::fun1"
78+
print f5.call
79+
print f5.call
8080

81-
assert (&10.toto).call(100) == 110
82-
assert (&"allo".toto).call(1) == 2
81+
print((&10.toto).call(100)) # 110
82+
print((&"allo".toto).call(2)) # 3
8383

8484
var cnt = new Counter
8585
var p1 = &cnt.incr
8686
var ps = [p1,p1,p1,p1,p1]
8787

8888
for p in ps do p.call
89-
assert cnt.x == 5
89+
print cnt.x # 5
9090

9191
var c1 = new C[nullable Object](null)
9292
var c2 = new C[nullable Int](null)
9393

9494
var f6 = &c1.to_s
9595
var f7 = &c2.to_s
9696

97-
assert f6.call == "x is null"
98-
assert f7.call == "x is null"
97+
print f6.call # "x is null"
98+
print f7.call # "x is null"
9999

100100
c1.x = "test"
101101
c2.x = 100
102102

103-
assert f6.call == "x is test"
104-
assert f7.call == "x is 100"
103+
print f6.call # "x is test"
104+
print f7.call # "x is 100"

0 commit comments

Comments
 (0)