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