|
1 | 1 | # This file is part of NIT ( http://www.nitlanguage.org ).
|
2 | 2 | #
|
3 |
| -# Copyright 2019-2020 Louis-Vincent Boudreault <lv.boudreault95@gmail.com> |
4 |
| -# |
5 | 3 | # Licensed under the Apache License, Version 2.0 (the "License");
|
6 | 4 | # you may not use this file except in compliance with the License.
|
7 | 5 | # You may obtain a copy of the License at
|
|
63 | 61 |
|
64 | 62 | var a = new A
|
65 | 63 | var b: A = new B
|
| 64 | + |
66 | 65 | var f1 = &a.fun1
|
67 |
| -assert f1.call == "in A::fun1" |
| 66 | +print f1.call # "in A::fun1" |
| 67 | + |
68 | 68 | var f2 = &b.fun1
|
69 |
| -assert f2.call == "in B::fun1" |
| 69 | +print f2.call # "in B::fun1" |
70 | 70 |
|
71 | 71 | var f3 = &10.mult_by
|
72 |
| -assert f3.call(10) == 100 |
| 72 | +print f3.call(10) # 100 |
73 | 73 |
|
74 | 74 | var f4 = &f2.call
|
75 |
| -assert f4.call == "in B::fun1" |
| 75 | +print f4.call # "in B::fun1" |
76 | 76 |
|
77 | 77 | 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 |
80 | 80 |
|
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 |
83 | 83 |
|
84 | 84 | var cnt = new Counter
|
85 | 85 | var p1 = &cnt.incr
|
86 | 86 | var ps = [p1,p1,p1,p1,p1]
|
87 | 87 |
|
88 | 88 | for p in ps do p.call
|
89 |
| -assert cnt.x == 5 |
| 89 | +print cnt.x # 5 |
90 | 90 |
|
91 | 91 | var c1 = new C[nullable Object](null)
|
92 | 92 | var c2 = new C[nullable Int](null)
|
93 | 93 |
|
94 | 94 | var f6 = &c1.to_s
|
95 | 95 | var f7 = &c2.to_s
|
96 | 96 |
|
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" |
99 | 99 |
|
100 | 100 | c1.x = "test"
|
101 | 101 | c2.x = 100
|
102 | 102 |
|
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