diff --git a/tests/language/bool/has_environment_not_new_test.dart b/tests/language/bool/has_environment_not_new_test.dart index 947c6bed579..ec4a7f062a2 100644 --- a/tests/language/bool/has_environment_not_new_test.dart +++ b/tests/language/bool/has_environment_not_new_test.dart @@ -4,6 +4,14 @@ import "package:expect/expect.dart"; +const bool isVM = const bool.fromEnvironment('dart.isVM'); + main() { - Expect.throws(() => new bool.hasEnvironment("Anything")); + // On non-VM targets `new bool.hasEnvironment(...)` just throws, because it + // is only guaranted to work with `const`. However on VM it actually works. + if (!isVM) { + Expect.throws(() => new bool.hasEnvironment("Anything")); + } else { + Expect.isFalse(new bool.hasEnvironment("Anything")); + } }