dart-sdk/tests/corelib_2/from_environment_const_type_test.dart
Janice Collins 328c30324c Migrate test block 8 to Dart 2.0.
This was a hairy test block, please review carefully.  Special circumstances:
file_resource_test.dart: deleted, depends on Resource class which was moved outside the SDK
from_environment_const_type_undefined_test.dart, from_environment_const_type_test: change to expect compile-time errors for all error cases.
Hacked up status files to enable non-strong/checked/non-checked modes to work in all cases.
format_exception_test.dart: corelib is newer, has updated tests
growable_list_test.dart: corelib is newer, with updated comments.  Stripped runtime checking of checked mode.  Also, this doesn't work, but should, with dartdevc, so added to exclusion list
hash_map2_test.dart: corelib_strong version seems to be newer, has VM option comments

BUG=
R=rnystrom@google.com

Review-Url: https://codereview.chromium.org/2989643002 .
2017-08-03 08:37:46 -07:00

44 lines
1.2 KiB
Dart

// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// SharedOptions=-Da=true -Db=false -Dc=3 -Dd=STRING
import "package:expect/expect.dart";
class Foo {}
const
bool // //# 01: ok
int // //# 02: compile-time error
String // //# 03: compile-time error
Foo // //# 04: compile-time error
a = const bool.fromEnvironment('a');
const
bool // //# 05: ok
int // //# 06: compile-time error
String // //# 07: compile-time error
Foo // //# 08: compile-time error
b = const bool.fromEnvironment('b');
const
bool // //# 09: compile-time error
int // //# 10: ok
String // //# 11: compile-time error
Foo // //# 12: compile-time error
c = const int.fromEnvironment('c');
const
bool // //# 13: compile-time error
int // //# 14: compile-time error
String // //# 15: ok
Foo // //# 16: compile-time error
d = const String.fromEnvironment('d');
main() {
Expect.equals(a, true);
Expect.equals(b, false);
Expect.equals(c, 3);
Expect.equals(d, 'STRING');
}