Files
sdk/pkg/dev_compiler/test/expression_compiler/assertions_enabled_test.dart
T
Mayank Patke aa0a7e7083 [ddc] Add dart.web.assertions_enabled environment variable.
Change-Id: If28f2f1404f02c5d757774188a5a006137c8734f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273284
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
2023-02-14 01:35:05 +00:00

46 lines
1.3 KiB
Dart

// Copyright (c) 2023, 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:test/test.dart';
import 'expression_compiler_e2e_suite.dart';
void main() async {
var driver = await TestDriver.init();
group('dart.web.assertions_enabled', () {
const source = r'''
void main() {
var b = const bool.fromEnvironment('dart.web.assertions_enabled');
// Breakpoint: bp
print('hello world');
}
''';
tearDown(() async {
await driver.cleanupTest();
});
tearDownAll(() async {
await driver.finish();
});
test('is automatically set', () async {
var setup = SetupCompilerOptions(enableAsserts: true);
await driver.initSource(setup, source);
// TODO(43986): Update when assertions are enabled.
await driver.check(
breakpointId: 'bp', expression: 'b', expectedResult: 'false');
});
test('is automatically unset', () async {
var setup = SetupCompilerOptions(enableAsserts: false);
await driver.initSource(setup, source);
await driver.check(
breakpointId: 'bp', expression: 'b', expectedResult: 'false');
});
});
}