mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 01:45:06 +00:00
[ CLI ] Fix dart run --enable-experiment
Fixes issue where --enable-experiment options passed after `dart run` weren't being handled by the VM. Fixes https://github.com/dart-lang/sdk/issues/50205 TEST=pkg/dartdev/test/commands/run_test.dart Change-Id: Ia9c585a16756fd4450cfd159a1b9864ebfb6d200 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/264200 Reviewed-by: Siva Annamalai <asiva@google.com> Commit-Queue: Ben Konyi <bkonyi@google.com>
This commit is contained in:
parent
bc7094dbc1
commit
39168c9ef0
|
@ -107,6 +107,39 @@ void run() {
|
||||||
expect(result.exitCode, 255);
|
expect(result.exitCode, 255);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('experiments are enabled correctly', () async {
|
||||||
|
// TODO(bkonyi): find a more robust way to test experiments by exposing
|
||||||
|
// enabled experiments for an isolate (e.g., through dart:developer or the
|
||||||
|
// VM service).
|
||||||
|
//
|
||||||
|
// See https://github.com/dart-lang/sdk/issues/50230
|
||||||
|
p = project();
|
||||||
|
p.file('main.dart', 'void main(args) { print("Record: \${(1, 2)}"); }');
|
||||||
|
ProcessResult result = await p.run([
|
||||||
|
'run',
|
||||||
|
'--enable-experiment=records',
|
||||||
|
'main.dart',
|
||||||
|
]);
|
||||||
|
|
||||||
|
// The records experiment should be enabled.
|
||||||
|
expect(result.stdout, contains('Record: '));
|
||||||
|
expect(result.stderr, isEmpty);
|
||||||
|
expect(result.exitCode, 0);
|
||||||
|
|
||||||
|
// Run again with the experiment disabled to make sure the test is actually
|
||||||
|
// working as expected.
|
||||||
|
result = await p.run([
|
||||||
|
'run',
|
||||||
|
'main.dart',
|
||||||
|
]);
|
||||||
|
|
||||||
|
// The records experiment should not be enabled and the program should fail
|
||||||
|
// to run.
|
||||||
|
expect(result.stdout, isEmpty);
|
||||||
|
expect(result.stderr, isNotEmpty);
|
||||||
|
expect(result.exitCode, 254);
|
||||||
|
});
|
||||||
|
|
||||||
test('arguments are properly passed', () async {
|
test('arguments are properly passed', () async {
|
||||||
p = project();
|
p = project();
|
||||||
p.file('main.dart', 'void main(args) { print(args); }');
|
p.file('main.dart', 'void main(args) { print(args); }');
|
||||||
|
|
|
@ -415,7 +415,8 @@ bool Options::ProcessVMDebuggingOptions(const char* arg,
|
||||||
V("--pause-isolates-on-unhandled-exception", arg) \
|
V("--pause-isolates-on-unhandled-exception", arg) \
|
||||||
V("--no-pause-isolates-on-unhandled-exception", arg) \
|
V("--no-pause-isolates-on-unhandled-exception", arg) \
|
||||||
V("--warn-on-pause-with-no-debugger", arg) \
|
V("--warn-on-pause-with-no-debugger", arg) \
|
||||||
V("--no-warn-on-pause-with-no-debugger", arg)
|
V("--no-warn-on-pause-with-no-debugger", arg) \
|
||||||
|
V("--enable-experiment", arg)
|
||||||
HANDLE_DARTDEV_VM_DEBUG_OPTIONS(IS_DEBUG_OPTION, arg);
|
HANDLE_DARTDEV_VM_DEBUG_OPTIONS(IS_DEBUG_OPTION, arg);
|
||||||
|
|
||||||
#undef IS_DEBUG_OPTION
|
#undef IS_DEBUG_OPTION
|
||||||
|
|
Loading…
Reference in a new issue