From 568255dbecd4ebc6e103dd2b2c0ec8cb0ebc2fcf Mon Sep 17 00:00:00 2001 From: Erik Ernst Date: Tue, 17 Mar 2020 13:43:17 +0000 Subject: [PATCH] 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 Commit-Queue: Erik Ernst --- .../from_environment_const_type_undefined_test.dart | 8 ++++---- tests/corelib/int_from_environment2_test.dart | 10 +++++----- .../from_environment_const_type_undefined_test.dart | 8 ++++---- tests/corelib_2/int_from_environment2_test.dart | 10 +++++----- tests/language_2/string/const_interpolation2_test.dart | 2 +- .../int_from_environment_default_value_test.dart | 2 +- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/tests/corelib/from_environment_const_type_undefined_test.dart b/tests/corelib/from_environment_const_type_undefined_test.dart index c555b027a27..c2e90ef6344 100644 --- a/tests/corelib/from_environment_const_type_undefined_test.dart +++ b/tests/corelib/from_environment_const_type_undefined_test.dart @@ -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); } diff --git a/tests/corelib/int_from_environment2_test.dart b/tests/corelib/int_from_environment2_test.dart index 348f0b04a68..102805647d8 100644 --- a/tests/corelib/int_from_environment2_test.dart +++ b/tests/corelib/int_from_environment2_test.dart @@ -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')); } diff --git a/tests/corelib_2/from_environment_const_type_undefined_test.dart b/tests/corelib_2/from_environment_const_type_undefined_test.dart index c555b027a27..c2e90ef6344 100644 --- a/tests/corelib_2/from_environment_const_type_undefined_test.dart +++ b/tests/corelib_2/from_environment_const_type_undefined_test.dart @@ -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); } diff --git a/tests/corelib_2/int_from_environment2_test.dart b/tests/corelib_2/int_from_environment2_test.dart index 348f0b04a68..102805647d8 100644 --- a/tests/corelib_2/int_from_environment2_test.dart +++ b/tests/corelib_2/int_from_environment2_test.dart @@ -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')); } diff --git a/tests/language_2/string/const_interpolation2_test.dart b/tests/language_2/string/const_interpolation2_test.dart index 4033d8e3e5a..968d2c2c740 100644 --- a/tests/language_2/string/const_interpolation2_test.dart +++ b/tests/language_2/string/const_interpolation2_test.dart @@ -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); diff --git a/tests/lib_2/isolate/int_from_environment_default_value_test.dart b/tests/lib_2/isolate/int_from_environment_default_value_test.dart index 852d6461de8..af7ccac13bf 100644 --- a/tests/lib_2/isolate/int_from_environment_default_value_test.dart +++ b/tests/lib_2/isolate/int_from_environment_default_value_test.dart @@ -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);