OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 // Test to check if we are able to import multiple libraries using the | 5 // Test to check if we are able to import multiple libraries using the |
6 // same prefix. | 6 // same prefix. |
7 | 7 |
8 library Prefix101Test.dart; | 8 library Prefix101Test.dart; |
9 | 9 |
10 import "package:expect/expect.dart"; | 10 import "package:expect/expect.dart"; |
11 import "library10.dart" as lib101; | 11 import "library10.dart" as lib101; |
12 import "library11.dart" as lib101; | 12 import "library11.dart" as lib101; |
13 | 13 |
14 class Prefix101Test { | 14 class Prefix101Test { |
15 static Test1() { | 15 static Test1() { |
16 var result = 0; | 16 var result = 0; |
17 var obj = new lib101.Library10(1); | 17 var obj = new lib101.Library10(1); |
18 result = obj.fld; | 18 result = obj.fld; |
19 Expect.equals(1, result); | 19 Expect.equals(1, result); |
20 result += obj.func(); | 20 result += obj.func(); |
21 Expect.equals(3, result); | 21 Expect.equals(3, result); |
22 result += lib101.Library10.static_func(); | 22 result += lib101.Library10.static_func(); |
23 Expect.equals(6, result); | 23 Expect.equals(6, result); |
24 result += lib101.Library10.static_fld; | 24 result += lib101.Library10.static_fld; |
25 Expect.equals(10, result); | 25 Expect.equals(10, result); |
26 } | 26 } |
| 27 |
27 static Test2() { | 28 static Test2() { |
28 var result = 0; | 29 var result = 0; |
29 var obj = new lib101.Library11(4); | 30 var obj = new lib101.Library11(4); |
30 result = obj.fld; | 31 result = obj.fld; |
31 Expect.equals(4, result); | 32 Expect.equals(4, result); |
32 result += obj.func(); | 33 result += obj.func(); |
33 Expect.equals(7, result); | 34 Expect.equals(7, result); |
34 result += lib101.Library11.static_func(); | 35 result += lib101.Library11.static_func(); |
35 Expect.equals(9, result); | 36 Expect.equals(9, result); |
36 result += lib101.Library11.static_fld; | 37 result += lib101.Library11.static_fld; |
37 Expect.equals(10, result); | 38 Expect.equals(10, result); |
38 } | 39 } |
| 40 |
39 static Test3() { | 41 static Test3() { |
40 Expect.equals(10, lib101.top_level10); | 42 Expect.equals(10, lib101.top_level10); |
41 Expect.equals(20, lib101.top_level_func10()); | 43 Expect.equals(20, lib101.top_level_func10()); |
42 } | 44 } |
| 45 |
43 static Test4() { | 46 static Test4() { |
44 Expect.equals(100, lib101.top_level11); | 47 Expect.equals(100, lib101.top_level11); |
45 Expect.equals(200, lib101.top_level_func11()); | 48 Expect.equals(200, lib101.top_level_func11()); |
46 } | 49 } |
47 } | 50 } |
48 | 51 |
49 main() { | 52 main() { |
50 Prefix101Test.Test1(); | 53 Prefix101Test.Test1(); |
51 Prefix101Test.Test2(); | 54 Prefix101Test.Test2(); |
52 Prefix101Test.Test3(); | 55 Prefix101Test.Test3(); |
53 Prefix101Test.Test4(); | 56 Prefix101Test.Test4(); |
54 } | 57 } |
OLD | NEW |