OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 import 'package:expect/expect.dart'; |
| 6 |
| 7 main() { |
| 8 const NOT_PRESENT = null; |
| 9 |
| 10 Expect.isTrue(const bool.fromEnvironment("dart.library.async")); |
| 11 Expect.isTrue(const bool.fromEnvironment("dart.library.collection")); |
| 12 Expect.isTrue(const bool.fromEnvironment("dart.library.convert")); |
| 13 Expect.isTrue(const bool.fromEnvironment("dart.library.core")); |
| 14 Expect.isTrue(const bool.fromEnvironment("dart.library.typed_data")); |
| 15 |
| 16 |
| 17 bool hasHtmlSupport; |
| 18 hasHtmlSupport = true; /// has_html_support: ok |
| 19 hasHtmlSupport = false; /// has_no_html_support: ok |
| 20 |
| 21 if (hasHtmlSupport != null) { |
| 22 bool expectedResult = hasHtmlSupport ? true : NOT_PRESENT; |
| 23 |
| 24 Expect.equals(expectedResult, |
| 25 const bool.fromEnvironment("dart.library.html", |
| 26 defaultValue: NOT_PRESENT)); |
| 27 Expect.equals(expectedResult, |
| 28 const bool.fromEnvironment("dart.library.indexed_db", |
| 29 defaultValue: NOT_PRESENT)); |
| 30 Expect.equals(expectedResult, |
| 31 const bool.fromEnvironment("dart.library.svg", |
| 32 defaultValue: NOT_PRESENT)); |
| 33 Expect.equals(expectedResult, |
| 34 const bool.fromEnvironment("dart.library.web_audio", |
| 35 defaultValue: NOT_PRESENT)); |
| 36 Expect.equals(expectedResult, |
| 37 const bool.fromEnvironment("dart.library.web_gl", |
| 38 defaultValue: NOT_PRESENT)); |
| 39 Expect.equals(expectedResult, |
| 40 const bool.fromEnvironment("dart.library.web_sql", |
| 41 defaultValue: NOT_PRESENT)); |
| 42 } |
| 43 |
| 44 bool hasIoSupport; |
| 45 hasIoSupport = true; /// has_io_support: ok |
| 46 hasIoSupport = false; /// has_no_io_support: ok |
| 47 |
| 48 if (hasIoSupport != null) { |
| 49 bool expectedResult = hasIoSupport ? true : NOT_PRESENT; |
| 50 |
| 51 Expect.equals(expectedResult, |
| 52 const bool.fromEnvironment("dart.library.io", |
| 53 defaultValue: NOT_PRESENT)); |
| 54 Expect.equals(expectedResult, |
| 55 const bool.fromEnvironment("dart.library.developer", |
| 56 defaultValue: NOT_PRESENT)); |
| 57 } |
| 58 |
| 59 bool hasMirrorSupport; |
| 60 hasMirrorSupport = true; /// has_mirror_support: ok |
| 61 hasMirrorSupport = false; /// has_no_mirror_support: ok |
| 62 |
| 63 if (hasMirrorSupport != null) { |
| 64 bool expectedResult = hasMirrorSupport ? true : NOT_PRESENT; |
| 65 |
| 66 Expect.equals(expectedResult, |
| 67 const bool.fromEnvironment("dart.library.mirrors", |
| 68 defaultValue: NOT_PRESENT)); |
| 69 } |
| 70 |
| 71 Expect.equals(NOT_PRESENT, |
| 72 const bool.fromEnvironment("dart.library.XYZ", |
| 73 defaultValue: NOT_PRESENT)); |
| 74 Expect.equals(NOT_PRESENT, |
| 75 const bool.fromEnvironment("dart.library.Collection", |
| 76 defaultValue: NOT_PRESENT)); |
| 77 Expect.equals(NOT_PRESENT, |
| 78 const bool.fromEnvironment("dart.library.converT", |
| 79 defaultValue: NOT_PRESENT)); |
| 80 Expect.equals(NOT_PRESENT, |
| 81 const bool.fromEnvironment("dart.library.", |
| 82 defaultValue: NOT_PRESENT)); |
| 83 Expect.equals(NOT_PRESENT, |
| 84 const bool.fromEnvironment("dart.library.core ", |
| 85 defaultValue: NOT_PRESENT)); |
| 86 |
| 87 } |
OLD | NEW |