Files
sdk/pkg/front_end/testcases/general/constants/const_asserts.dart
T
Johnni Winther 56f46b0659 Remove non-nullable experiment flag from front_end test cases.
This changes the CFE expectation test suites to use unsound null safety
as default to avoid passing --enable-experiments=no-non-nullable to opt
out old test folders.

This change removes most test folders from the 'strong' tester, since
this now only supports sound null safety, which requires all libraries
to be opted in. Instead, the 'weak' tester now runs all test folders.
Additionally the 'outline' tester is changed to use unsound null safety
so that it call be used on all test folders.

The 'fast_strong' tester is removed since it should just be run locally
and it can be run by passing an option to the other testers.

References to non-existing 'shaker' folder has been removed from
testing.json.


Change-Id: Ibcc306f7b27d06b9637c205238bc408194f1d062
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184787
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-18 12:29:18 +00:00

48 lines
1.8 KiB
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.
// @dart=2.9
class Foo {
final int x;
const Foo(this.x)
: assert(x > 0, "x is not positive"),
assert(x > 0),
assert(x > 0, ""),
assert(const bool.fromEnvironment("foo") == false,
"foo was ${const bool.fromEnvironment("foo")}"),
assert(const bool.fromEnvironment("foo") == false);
const Foo.withMessage(this.x)
: assert(x < 0, "btw foo was ${const bool.fromEnvironment("foo")}");
const Foo.withInvalidMessage(this.x) : assert(x < 0, x);
const Foo.withInvalidCondition(this.x) : assert(x);
const Foo.withNullConditionFromEnv1(this.x)
: assert(bool.fromEnvironment("foo", defaultValue: null));
const Foo.withNullConditionFromEnv2(this.x)
: assert(const bool.fromEnvironment("foo", defaultValue: null));
}
class Bar {
final int x;
const Bar.withMessage(this.x) : assert(x < 0, "x is not negative");
const Bar.withoutMessage(this.x) : assert(x < 0);
const Bar.withEmptyMessage(this.x) : assert(x < 0);
}
const Foo foo1 = const Foo(1);
const Foo foo2 = const Foo(0);
const Foo foo3 = const Foo.withMessage(42);
const Foo foo4 = const Foo.withInvalidMessage(42);
const Foo foo5 = const Foo.withInvalidCondition(42);
const Foo foo6 = const Foo.withNullConditionFromEnv1(42);
const Foo foo7 = const Foo.withNullConditionFromEnv2(42);
const Bar bar1 = const Bar.withMessage(1);
const Bar bar2 = const Bar.withMessage(0);
const Bar bar3 = const Bar.withoutMessage(1);
const Bar bar4 = const Bar.withoutMessage(0);
const Bar bar5 = const Bar.withEmptyMessage(1);
const Bar bar6 = const Bar.withEmptyMessage(0);
main() {
print(foo1);
}