mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 16:41:07 +00:00
568255dbec
Constructors int.fromEnvironment and String.fromEnvironment will now yield 0 or '' rather than null in the case where the requested environment declaration does not exist, so various expectations needed to be updated accordingly. Change-Id: Ie6f3b9ee18a970e50520ac84c2741b4875ada3c9 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139804 Reviewed-by: Johnni Winther <johnniwinther@google.com> Commit-Queue: Erik Ernst <eernst@google.com>
43 lines
1.1 KiB
Dart
43 lines
1.1 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.
|
|
|
|
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(false, a);
|
|
Expect.equals(false, b);
|
|
Expect.equals(0, c);
|
|
Expect.equals('', d);
|
|
}
|