OLD | NEW |
| (Empty) |
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 | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 // Test to check if we are able to import multiple libraries using the | |
6 // same prefix. | |
7 | |
8 #library("Prefix101Test.dart"); | |
9 | |
10 #import("library10.dart", prefix : "lib101"); | |
11 #import("library11.dart", prefix : "lib101"); | |
12 | |
13 class Prefix101Test { | |
14 static Test1() { | |
15 var result = 0; | |
16 var obj = new lib101.Library10(1); | |
17 result = obj.fld; | |
18 Expect.equals(1, result); | |
19 result += obj.func(); | |
20 Expect.equals(3, result); | |
21 result += lib101.Library10.static_func(); | |
22 Expect.equals(6, result); | |
23 result += lib101.Library10.static_fld; | |
24 Expect.equals(10, result); | |
25 } | |
26 static Test2() { | |
27 var result = 0; | |
28 var obj = new lib101.Library11(4); | |
29 result = obj.fld; | |
30 Expect.equals(4, result); | |
31 result += obj.func(); | |
32 Expect.equals(7, result); | |
33 result += lib101.Library11.static_func(); | |
34 Expect.equals(9, result); | |
35 result += lib101.Library11.static_fld; | |
36 Expect.equals(10, result); | |
37 } | |
38 static Test3() { | |
39 Expect.equals(10, lib101.top_level10); | |
40 Expect.equals(20, lib101.top_level_func10()); | |
41 } | |
42 static Test4() { | |
43 Expect.equals(100, lib101.top_level11); | |
44 Expect.equals(200, lib101.top_level_func11()); | |
45 } | |
46 } | |
47 | |
48 main() { | |
49 Prefix101Test.Test1(); | |
50 Prefix101Test.Test2(); | |
51 Prefix101Test.Test3(); | |
52 Prefix101Test.Test4(); | |
53 } | |
OLD | NEW |