mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 09:43:08 +00:00
7348441514
This test always fails on the VM because unlike other targets VM allows to invoke this constructor with `new`. Instead of having an always failing test change this test to test VM's current behavior. This will also allow us to catch breaking changes in the future. Closes https://github.com/dart-lang/sdk/issues/53183 R=eernst@google.com Change-Id: I4ba63dc94d2bd824df44c604b0ca1c57eb8bd559 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/338124 Commit-Queue: Slava Egorov <vegorov@google.com> Reviewed-by: Erik Ernst <eernst@google.com>
17 lines
631 B
Dart
17 lines
631 B
Dart
// Copyright (c) 2020, 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";
|
|
|
|
const bool isVM = const bool.fromEnvironment('dart.isVM');
|
|
|
|
main() {
|
|
// 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"));
|
|
}
|
|
}
|