OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2017, 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 /// Dart2js only supports the const constructor for `?.fromEnvironment`. The |
| 8 /// current behavior is to throw at runtime if they call this constructor with |
| 9 /// `new` instead of `const`. |
| 10 main() { |
| 11 Expect.isFalse(const bool.fromEnvironment('X')); |
| 12 Expect.isNull(const String.fromEnvironment('X')); |
| 13 Expect.equals(const int.fromEnvironment('X', defaultValue: 0), 0); |
| 14 |
| 15 Expect.throws(() => new bool.fromEnvironment('X')); |
| 16 Expect.throws(() => new String.fromEnvironment('X')); |
| 17 Expect.throws(() => new int.fromEnvironment('X', defaultValue: 0)); |
| 18 } |
OLD | NEW |