update NOTICE and LICENSE
[nit.git] / tests / base_orelse.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 import kernel
16
17 class A
18 readable writable var _i: Int
19 end
20
21 var a: nullable A = new A(1)
22 var na: nullable A = null
23
24 var oa: A
25
26 do
27 var b = a or else new A(2)
28 b.i.output
29 oa = b
30 end
31
32 do
33 var b = na or else new A(3)
34 b.i.output
35 oa = b
36 end
37
38 do
39 var b = na or else a
40 b.i.output
41 #alt1#oa = b
42 end
43
44 do
45 var b = a or else na
46 b.i.output
47 #alt2#oa = b
48 end
49
50 do
51 var na2 = na
52 var b = na or else na2 or else new A(4)
53 b.i.output
54 oa = b
55 end
56
57 do
58 var b = na or else a or else new A(5)
59 b.i.output
60 oa = b
61 end
62
63 do
64 var b = a or else na or else new A(6)
65 b.i.output
66 oa = b
67 end