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(NOT_PRESENT, | 18 Expect.equals( |
| 19 NOT_PRESENT, |
19 const bool.fromEnvironment("dart.library._internal", | 20 const bool.fromEnvironment("dart.library._internal", |
20 defaultValue: NOT_PRESENT)); | 21 defaultValue: NOT_PRESENT)); |
21 | 22 |
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(expectedResult, | 30 Expect.equals( |
| 31 expectedResult, |
31 const bool.fromEnvironment("dart.library.html", | 32 const bool.fromEnvironment("dart.library.html", |
32 defaultValue: NOT_PRESENT)); | 33 defaultValue: NOT_PRESENT)); |
33 Expect.equals(expectedResult, | 34 Expect.equals( |
| 35 expectedResult, |
34 const bool.fromEnvironment("dart.library.indexed_db", | 36 const bool.fromEnvironment("dart.library.indexed_db", |
35 defaultValue: NOT_PRESENT)); | 37 defaultValue: NOT_PRESENT)); |
36 Expect.equals(expectedResult, | 38 Expect.equals( |
| 39 expectedResult, |
37 const bool.fromEnvironment("dart.library.svg", | 40 const bool.fromEnvironment("dart.library.svg", |
38 defaultValue: NOT_PRESENT)); | 41 defaultValue: NOT_PRESENT)); |
39 Expect.equals(expectedResult, | 42 Expect.equals( |
| 43 expectedResult, |
40 const bool.fromEnvironment("dart.library.web_audio", | 44 const bool.fromEnvironment("dart.library.web_audio", |
41 defaultValue: NOT_PRESENT)); | 45 defaultValue: NOT_PRESENT)); |
42 Expect.equals(expectedResult, | 46 Expect.equals( |
| 47 expectedResult, |
43 const bool.fromEnvironment("dart.library.web_gl", | 48 const bool.fromEnvironment("dart.library.web_gl", |
44 defaultValue: NOT_PRESENT)); | 49 defaultValue: NOT_PRESENT)); |
45 Expect.equals(expectedResult, | 50 Expect.equals( |
| 51 expectedResult, |
46 const bool.fromEnvironment("dart.library.web_sql", | 52 const bool.fromEnvironment("dart.library.web_sql", |
47 defaultValue: NOT_PRESENT)); | 53 defaultValue: NOT_PRESENT)); |
48 } | 54 } |
49 | 55 |
50 bool hasIoSupport; | 56 bool hasIoSupport; |
51 hasIoSupport = true; // //# has_io_support: ok | 57 hasIoSupport = true; // //# has_io_support: ok |
52 hasIoSupport = false; // //# has_no_io_support: ok | 58 hasIoSupport = false; // //# has_no_io_support: ok |
53 | 59 |
54 if (hasIoSupport != null) { | 60 if (hasIoSupport != null) { |
55 // Dartium overrides 'dart.library.io' to return "false". | 61 // Dartium overrides 'dart.library.io' to return "false". |
56 // We don't test for the non-existance, but just make sure that | 62 // We don't test for the non-existance, but just make sure that |
57 // dart.library.io is not set to true. | 63 // dart.library.io is not set to true. |
58 Expect.equals(hasIoSupport, | 64 Expect.equals(hasIoSupport, |
59 const bool.fromEnvironment("dart.library.io", | 65 const bool.fromEnvironment("dart.library.io", defaultValue: false)); |
60 defaultValue: false)); | |
61 } | 66 } |
62 | 67 |
63 bool hasMirrorSupport; | 68 bool hasMirrorSupport; |
64 hasMirrorSupport = true; // //# has_mirror_support: ok | 69 hasMirrorSupport = true; // //# has_mirror_support: ok |
65 hasMirrorSupport = false; // //# has_no_mirror_support: ok | 70 hasMirrorSupport = false; // //# has_no_mirror_support: ok |
66 | 71 |
67 if (hasMirrorSupport != null) { | 72 if (hasMirrorSupport != null) { |
68 bool expectedResult = hasMirrorSupport ? true : NOT_PRESENT; | 73 bool expectedResult = hasMirrorSupport ? true : NOT_PRESENT; |
69 | 74 |
70 Expect.equals(expectedResult, | 75 Expect.equals( |
| 76 expectedResult, |
71 const bool.fromEnvironment("dart.library.mirrors", | 77 const bool.fromEnvironment("dart.library.mirrors", |
72 defaultValue: NOT_PRESENT)); | 78 defaultValue: NOT_PRESENT)); |
73 } | 79 } |
74 | 80 |
75 Expect.equals(NOT_PRESENT, | 81 Expect.equals( |
| 82 NOT_PRESENT, |
76 const bool.fromEnvironment("dart.library.XYZ", | 83 const bool.fromEnvironment("dart.library.XYZ", |
77 defaultValue: NOT_PRESENT)); | 84 defaultValue: NOT_PRESENT)); |
78 Expect.equals(NOT_PRESENT, | 85 Expect.equals( |
| 86 NOT_PRESENT, |
79 const bool.fromEnvironment("dart.library.Collection", | 87 const bool.fromEnvironment("dart.library.Collection", |
80 defaultValue: NOT_PRESENT)); | 88 defaultValue: NOT_PRESENT)); |
81 Expect.equals(NOT_PRESENT, | 89 Expect.equals( |
| 90 NOT_PRESENT, |
82 const bool.fromEnvironment("dart.library.converT", | 91 const bool.fromEnvironment("dart.library.converT", |
83 defaultValue: NOT_PRESENT)); | 92 defaultValue: NOT_PRESENT)); |
84 Expect.equals(NOT_PRESENT, | 93 Expect.equals(NOT_PRESENT, |
85 const bool.fromEnvironment("dart.library.", | 94 const bool.fromEnvironment("dart.library.", defaultValue: NOT_PRESENT)); |
86 defaultValue: NOT_PRESENT)); | 95 Expect.equals( |
87 Expect.equals(NOT_PRESENT, | 96 NOT_PRESENT, |
88 const bool.fromEnvironment("dart.library.core ", | 97 const bool.fromEnvironment("dart.library.core ", |
89 defaultValue: NOT_PRESENT)); | 98 defaultValue: NOT_PRESENT)); |
90 | |
91 } | 99 } |
OLD | NEW |