| 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 = null; | 8 const NOT_PRESENT = null; |
| 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")); |
| 16 |
| 17 // Internal libraries should not be exposed. |
| 18 Expect.equals(NOT_PRESENT, |
| 19 const bool.fromEnvironment("dart.library._internal", |
| 20 defaultValue: NOT_PRESENT)); |
| 15 | 21 |
| 16 | 22 |
| 17 bool hasHtmlSupport; | 23 bool hasHtmlSupport; |
| 18 hasHtmlSupport = true; /// has_html_support: ok | 24 hasHtmlSupport = true; /// has_html_support: ok |
| 19 hasHtmlSupport = false; /// has_no_html_support: ok | 25 hasHtmlSupport = false; /// has_no_html_support: ok |
| 20 | 26 |
| 21 if (hasHtmlSupport != null) { | 27 if (hasHtmlSupport != null) { |
| 22 bool expectedResult = hasHtmlSupport ? true : NOT_PRESENT; | 28 bool expectedResult = hasHtmlSupport ? true : NOT_PRESENT; |
| 23 | 29 |
| 24 Expect.equals(expectedResult, | 30 Expect.equals(expectedResult, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 39 Expect.equals(expectedResult, | 45 Expect.equals(expectedResult, |
| 40 const bool.fromEnvironment("dart.library.web_sql", | 46 const bool.fromEnvironment("dart.library.web_sql", |
| 41 defaultValue: NOT_PRESENT)); | 47 defaultValue: NOT_PRESENT)); |
| 42 } | 48 } |
| 43 | 49 |
| 44 bool hasIoSupport; | 50 bool hasIoSupport; |
| 45 hasIoSupport = true; /// has_io_support: ok | 51 hasIoSupport = true; /// has_io_support: ok |
| 46 hasIoSupport = false; /// has_no_io_support: ok | 52 hasIoSupport = false; /// has_no_io_support: ok |
| 47 | 53 |
| 48 if (hasIoSupport != null) { | 54 if (hasIoSupport != null) { |
| 49 bool expectedResult = hasIoSupport ? true : NOT_PRESENT; | 55 // Dartium overrides 'dart.library.io' to return "false". |
| 50 | 56 // We don't test for the non-existance, but just make sure that |
| 51 Expect.equals(expectedResult, | 57 // dart.library.io is not set to true. |
| 58 Expect.equals(hasIoSupport, |
| 52 const bool.fromEnvironment("dart.library.io", | 59 const bool.fromEnvironment("dart.library.io", |
| 53 defaultValue: NOT_PRESENT)); | 60 defaultValue: false)); |
| 54 Expect.equals(expectedResult, | |
| 55 const bool.fromEnvironment("dart.library.developer", | |
| 56 defaultValue: NOT_PRESENT)); | |
| 57 } | 61 } |
| 58 | 62 |
| 59 bool hasMirrorSupport; | 63 bool hasMirrorSupport; |
| 60 hasMirrorSupport = true; /// has_mirror_support: ok | 64 hasMirrorSupport = true; /// has_mirror_support: ok |
| 61 hasMirrorSupport = false; /// has_no_mirror_support: ok | 65 hasMirrorSupport = false; /// has_no_mirror_support: ok |
| 62 | 66 |
| 63 if (hasMirrorSupport != null) { | 67 if (hasMirrorSupport != null) { |
| 64 bool expectedResult = hasMirrorSupport ? true : NOT_PRESENT; | 68 bool expectedResult = hasMirrorSupport ? true : NOT_PRESENT; |
| 65 | 69 |
| 66 Expect.equals(expectedResult, | 70 Expect.equals(expectedResult, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 78 const bool.fromEnvironment("dart.library.converT", | 82 const bool.fromEnvironment("dart.library.converT", |
| 79 defaultValue: NOT_PRESENT)); | 83 defaultValue: NOT_PRESENT)); |
| 80 Expect.equals(NOT_PRESENT, | 84 Expect.equals(NOT_PRESENT, |
| 81 const bool.fromEnvironment("dart.library.", | 85 const bool.fromEnvironment("dart.library.", |
| 82 defaultValue: NOT_PRESENT)); | 86 defaultValue: NOT_PRESENT)); |
| 83 Expect.equals(NOT_PRESENT, | 87 Expect.equals(NOT_PRESENT, |
| 84 const bool.fromEnvironment("dart.library.core ", | 88 const bool.fromEnvironment("dart.library.core ", |
| 85 defaultValue: NOT_PRESENT)); | 89 defaultValue: NOT_PRESENT)); |
| 86 | 90 |
| 87 } | 91 } |
| OLD | NEW |