Change tests to expect new behavior of fromEnvironment

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>
This commit is contained in:
Erik Ernst
2020-03-17 13:43:17 +00:00
committed by commit-bot@chromium.org
parent 4aba58122c
commit 568255dbec
6 changed files with 20 additions and 20 deletions
@@ -35,8 +35,8 @@ const
d = const String.fromEnvironment('d');
main() {
Expect.equals(a, false);
Expect.equals(b, false);
Expect.equals(c, null);
Expect.equals(d, null);
Expect.equals(false, a);
Expect.equals(false, b);
Expect.equals(0, c);
Expect.equals('', d);
}
@@ -6,9 +6,9 @@
import "package:expect/expect.dart";
main() {
Expect.isNull(const int.fromEnvironment('a'));
Expect.isNull(const int.fromEnvironment('b'));
Expect.isNull(const int.fromEnvironment('c'));
Expect.isNull(const int.fromEnvironment('d'));
Expect.isNull(const int.fromEnvironment('e'));
Expect.equals(0, const int.fromEnvironment('a'));
Expect.equals(0, const int.fromEnvironment('b'));
Expect.equals(0, const int.fromEnvironment('c'));
Expect.equals(0, const int.fromEnvironment('d'));
Expect.equals(0, const int.fromEnvironment('e'));
}
@@ -35,8 +35,8 @@ const
d = const String.fromEnvironment('d');
main() {
Expect.equals(a, false);
Expect.equals(b, false);
Expect.equals(c, null);
Expect.equals(d, null);
Expect.equals(false, a);
Expect.equals(false, b);
Expect.equals(0, c);
Expect.equals('', d);
}
@@ -6,9 +6,9 @@
import "package:expect/expect.dart";
main() {
Expect.isNull(const int.fromEnvironment('a'));
Expect.isNull(const int.fromEnvironment('b'));
Expect.isNull(const int.fromEnvironment('c'));
Expect.isNull(const int.fromEnvironment('d'));
Expect.isNull(const int.fromEnvironment('e'));
Expect.equals(0, const int.fromEnvironment('a'));
Expect.equals(0, const int.fromEnvironment('b'));
Expect.equals(0, const int.fromEnvironment('c'));
Expect.equals(0, const int.fromEnvironment('d'));
Expect.equals(0, const int.fromEnvironment('e'));
}
@@ -88,7 +88,7 @@ main() {
Expect.equals(b2.toString(), sb2);
Expect.equals(b3.toString(), sb3);
Expect.equals(b4.toString(), sb4);
var expect = "null null null null null null 42 3.1415 37 4.6692 2.71828 87 "
var expect = "null null null 0 null 42 3.1415 37 4.6692 2.71828 87 "
"s1 s2 s1s2 s4 true false false true";
Expect.equals(expect, interpolation1);
Expect.equals(expect, interpolation2);
@@ -11,7 +11,7 @@ import "package:async_helper/async_helper.dart";
import "package:expect/expect.dart";
void test(port) {
Expect.isNull(const int.fromEnvironment('NOT_FOUND'));
Expect.equals(0, const int.fromEnvironment('NOT_FOUND'));
Expect.equals(
12345, const int.fromEnvironment('NOT_FOUND', defaultValue: 12345));
if (port != null) port.send(null);