OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 import 'package:expect/expect.dart'; | 5 import 'package:expect/expect.dart'; |
6 | 6 |
7 main() { | 7 main() { |
8 const NOT_PRESENT = false; | 8 const NOT_PRESENT = false; |
9 | 9 |
10 Expect.isTrue(const bool.fromEnvironment("dart.library.async")); | 10 Expect.isTrue(const bool.fromEnvironment("dart.library.async")); |
11 Expect.isTrue(const bool.fromEnvironment("dart.library.collection")); | 11 Expect.isTrue(const bool.fromEnvironment("dart.library.collection")); |
12 Expect.isTrue(const bool.fromEnvironment("dart.library.convert")); | 12 Expect.isTrue(const bool.fromEnvironment("dart.library.convert")); |
13 Expect.isTrue(const bool.fromEnvironment("dart.library.core")); | 13 Expect.isTrue(const bool.fromEnvironment("dart.library.core")); |
14 Expect.isTrue(const bool.fromEnvironment("dart.library.typed_data")); | 14 Expect.isTrue(const bool.fromEnvironment("dart.library.typed_data")); |
15 Expect.isTrue(const bool.fromEnvironment("dart.library.developer")); | 15 Expect.isTrue(const bool.fromEnvironment("dart.library.developer")); |
16 | 16 |
17 // Internal libraries should not be exposed. | 17 // Internal libraries should not be exposed. |
18 Expect.equals( | 18 Expect.equals(NOT_PRESENT, |
19 NOT_PRESENT, | |
20 const bool.fromEnvironment("dart.library._internal", | 19 const bool.fromEnvironment("dart.library._internal", |
21 defaultValue: NOT_PRESENT)); | 20 defaultValue: NOT_PRESENT)); |
22 | 21 |
| 22 |
23 bool hasHtmlSupport; | 23 bool hasHtmlSupport; |
24 hasHtmlSupport = true; // //# has_html_support: ok | 24 hasHtmlSupport = true; // //# has_html_support: ok |
25 hasHtmlSupport = false; // //# has_no_html_support: ok | 25 hasHtmlSupport = false; // //# has_no_html_support: ok |
26 | 26 |
27 if (hasHtmlSupport != null) { | 27 if (hasHtmlSupport != null) { |
28 bool expectedResult = hasHtmlSupport ? true : NOT_PRESENT; | 28 bool expectedResult = hasHtmlSupport ? true : NOT_PRESENT; |
29 | 29 |
30 Expect.equals( | 30 Expect.equals(expectedResult, |
31 expectedResult, | |
32 const bool.fromEnvironment("dart.library.html", | 31 const bool.fromEnvironment("dart.library.html", |
33 defaultValue: NOT_PRESENT)); | 32 defaultValue: NOT_PRESENT)); |
34 Expect.equals( | 33 Expect.equals(expectedResult, |
35 expectedResult, | |
36 const bool.fromEnvironment("dart.library.indexed_db", | 34 const bool.fromEnvironment("dart.library.indexed_db", |
37 defaultValue: NOT_PRESENT)); | 35 defaultValue: NOT_PRESENT)); |
38 Expect.equals( | 36 Expect.equals(expectedResult, |
39 expectedResult, | |
40 const bool.fromEnvironment("dart.library.svg", | 37 const bool.fromEnvironment("dart.library.svg", |
41 defaultValue: NOT_PRESENT)); | 38 defaultValue: NOT_PRESENT)); |
42 Expect.equals( | 39 Expect.equals(expectedResult, |
43 expectedResult, | |
44 const bool.fromEnvironment("dart.library.web_audio", | 40 const bool.fromEnvironment("dart.library.web_audio", |
45 defaultValue: NOT_PRESENT)); | 41 defaultValue: NOT_PRESENT)); |
46 Expect.equals( | 42 Expect.equals(expectedResult, |
47 expectedResult, | |
48 const bool.fromEnvironment("dart.library.web_gl", | 43 const bool.fromEnvironment("dart.library.web_gl", |
49 defaultValue: NOT_PRESENT)); | 44 defaultValue: NOT_PRESENT)); |
50 Expect.equals( | 45 Expect.equals(expectedResult, |
51 expectedResult, | |
52 const bool.fromEnvironment("dart.library.web_sql", | 46 const bool.fromEnvironment("dart.library.web_sql", |
53 defaultValue: NOT_PRESENT)); | 47 defaultValue: NOT_PRESENT)); |
54 } | 48 } |
55 | 49 |
56 bool hasIoSupport; | 50 bool hasIoSupport; |
57 hasIoSupport = true; // //# has_io_support: ok | 51 hasIoSupport = true; // //# has_io_support: ok |
58 hasIoSupport = false; // //# has_no_io_support: ok | 52 hasIoSupport = false; // //# has_no_io_support: ok |
59 | 53 |
60 if (hasIoSupport != null) { | 54 if (hasIoSupport != null) { |
61 // Dartium overrides 'dart.library.io' to return "false". | 55 // Dartium overrides 'dart.library.io' to return "false". |
62 // We don't test for the non-existance, but just make sure that | 56 // We don't test for the non-existance, but just make sure that |
63 // dart.library.io is not set to true. | 57 // dart.library.io is not set to true. |
64 Expect.equals(hasIoSupport, | 58 Expect.equals(hasIoSupport, |
65 const bool.fromEnvironment("dart.library.io", defaultValue: false)); | 59 const bool.fromEnvironment("dart.library.io", |
| 60 defaultValue: false)); |
66 } | 61 } |
67 | 62 |
68 bool hasMirrorSupport; | 63 bool hasMirrorSupport; |
69 hasMirrorSupport = true; // //# has_mirror_support: ok | 64 hasMirrorSupport = true; // //# has_mirror_support: ok |
70 hasMirrorSupport = false; // //# has_no_mirror_support: ok | 65 hasMirrorSupport = false; // //# has_no_mirror_support: ok |
71 | 66 |
72 if (hasMirrorSupport != null) { | 67 if (hasMirrorSupport != null) { |
73 bool expectedResult = hasMirrorSupport ? true : NOT_PRESENT; | 68 bool expectedResult = hasMirrorSupport ? true : NOT_PRESENT; |
74 | 69 |
75 Expect.equals( | 70 Expect.equals(expectedResult, |
76 expectedResult, | |
77 const bool.fromEnvironment("dart.library.mirrors", | 71 const bool.fromEnvironment("dart.library.mirrors", |
78 defaultValue: NOT_PRESENT)); | 72 defaultValue: NOT_PRESENT)); |
79 } | 73 } |
80 | 74 |
81 Expect.equals( | 75 Expect.equals(NOT_PRESENT, |
82 NOT_PRESENT, | |
83 const bool.fromEnvironment("dart.library.XYZ", | 76 const bool.fromEnvironment("dart.library.XYZ", |
84 defaultValue: NOT_PRESENT)); | 77 defaultValue: NOT_PRESENT)); |
85 Expect.equals( | 78 Expect.equals(NOT_PRESENT, |
86 NOT_PRESENT, | |
87 const bool.fromEnvironment("dart.library.Collection", | 79 const bool.fromEnvironment("dart.library.Collection", |
88 defaultValue: NOT_PRESENT)); | 80 defaultValue: NOT_PRESENT)); |
89 Expect.equals( | 81 Expect.equals(NOT_PRESENT, |
90 NOT_PRESENT, | |
91 const bool.fromEnvironment("dart.library.converT", | 82 const bool.fromEnvironment("dart.library.converT", |
92 defaultValue: NOT_PRESENT)); | 83 defaultValue: NOT_PRESENT)); |
93 Expect.equals(NOT_PRESENT, | 84 Expect.equals(NOT_PRESENT, |
94 const bool.fromEnvironment("dart.library.", defaultValue: NOT_PRESENT)); | 85 const bool.fromEnvironment("dart.library.", |
95 Expect.equals( | 86 defaultValue: NOT_PRESENT)); |
96 NOT_PRESENT, | 87 Expect.equals(NOT_PRESENT, |
97 const bool.fromEnvironment("dart.library.core ", | 88 const bool.fromEnvironment("dart.library.core ", |
98 defaultValue: NOT_PRESENT)); | 89 defaultValue: NOT_PRESENT)); |
| 90 |
99 } | 91 } |
OLD | NEW |