Skip to content

Commit b87a249

Browse files
authored
Enable asserts (dart-lang#2719)
Fixes dart-lang#2718
1 parent dd426d4 commit b87a249

4 files changed

Lines changed: 34 additions & 0 deletions

File tree

‎pkgs/test/CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* Pass Node.js test process connection configuration and secret token via a
1919
restricted temporary authentication file to prevent secret leakage in command
2020
line process arguments.
21+
* Enable asserts in the `exe` compiler.
2122

2223
## 1.31.2
2324

‎pkgs/test/test/runner/compiler_runtime_matrix_test.dart‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,25 @@ void main() {
200200
await test.shouldExit(0);
201201
});
202202
}
203+
204+
test(
205+
'enables asserts',
206+
() async {
207+
await d.file('test.dart', _assertionsEnabledTest).create();
208+
var test = await runTest(testArgs);
209+
210+
expect(
211+
test.stdout,
212+
emitsThrough(contains('+1: All tests passed!')),
213+
);
214+
await test.shouldExit(0);
215+
},
216+
skip: compiler == Compiler.cli
217+
? 'https://github.com/dart-lang/test/issues/2718'
218+
: runtime == Runtime.safari
219+
? 'https://github.com/dart-lang/test/issues/2720'
220+
: null,
221+
);
203222
},
204223
);
205224
}
@@ -263,3 +282,15 @@ void main() {
263282
});
264283
}
265284
''';
285+
286+
final _assertionsEnabledTest = '''
287+
import 'package:test/test.dart';
288+
289+
void main() {
290+
test('asserts are enabled', () {
291+
expect(() {
292+
assert(false);
293+
}, throwsA(isA<AssertionError>()));
294+
});
295+
}
296+
''';

‎pkgs/test_core/CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
it when only using coverage.
1111
* Migrate out of process VM tests communication channel from TCP sockets to Unix
1212
domain sockets inside a restricted temporary directory.
13+
* Enable asserts in the `exe` compiler.
1314

1415
## 0.6.19
1516

‎pkgs/test_core/lib/src/runner/vm/platform.dart‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ stderr: ${processResult.stderr}''');
367367
if (platform.runtime == Runtime.vmAsan) '--target-sanitizer=asan',
368368
if (platform.runtime == Runtime.vmMsan) '--target-sanitizer=msan',
369369
if (platform.runtime == Runtime.vmTsan) '--target-sanitizer=tsan',
370+
'--enable-asserts',
370371
]);
371372
if (processResult.exitCode != 0 || !(await output.exists())) {
372373
throw LoadException(path, '''

0 commit comments

Comments
 (0)