diff --git a/dwds/test/build_daemon_breakpoint_test.dart b/dwds/test/build_daemon_breakpoint_test.dart index 2bd0bda59..16dbdbf2a 100644 --- a/dwds/test/build_daemon_breakpoint_test.dart +++ b/dwds/test/build_daemon_breakpoint_test.dart @@ -17,8 +17,7 @@ void main() { final provider = TestSdkConfigurationProvider(); tearDownAll(provider.dispose); - final context = - TestContext(TestProject.testPackageWithSoundNullSafety(), provider); + final context = TestContext(TestProject.testPackage(), provider); group('shared context', () { setUpAll(() async { diff --git a/dwds/test/build_daemon_callstack_test.dart b/dwds/test/build_daemon_callstack_test.dart index 551084176..b8bac90d8 100644 --- a/dwds/test/build_daemon_callstack_test.dart +++ b/dwds/test/build_daemon_callstack_test.dart @@ -25,299 +25,294 @@ void main() { // Enable verbose logging for debugging. final debug = false; - for (var nullSafety in NullSafety.values) { - group('${nullSafety.name} null safety |', () { - final project = TestProject.testPackage(nullSafety: nullSafety); - final context = TestContext(project, provider); - - setUpAll(() async { - setCurrentLogWriter(debug: debug); - await context.setUp( - testSettings: TestSettings( - compilationMode: CompilationMode.buildDaemon, - enableExpressionEvaluation: true, - verboseCompiler: debug, - ), + final project = TestProject.testPackage(); + final context = TestContext(project, provider); + + setUpAll(() async { + setCurrentLogWriter(debug: debug); + await context.setUp( + testSettings: TestSettings( + compilationMode: CompilationMode.buildDaemon, + enableExpressionEvaluation: true, + verboseCompiler: debug, + ), + ); + }); + + tearDownAll(() async { + await context.tearDown(); + }); + + group('callStack |', () { + late VmServiceInterface service; + VM vm; + late Isolate isolate; + ScriptList scripts; + late ScriptRef mainScript; + late ScriptRef testLibraryScript; + late Stream stream; + + setUp(() async { + setCurrentLogWriter(debug: debug); + service = context.service; + vm = await service.getVM(); + isolate = await service.getIsolate(vm.isolates!.first.id!); + scripts = await service.getScripts(isolate.id!); + + await service.streamListen('Debug'); + stream = service.onEvent('Debug'); + + final testPackage = context.project.packageName; + mainScript = scripts.scripts! + .firstWhere((each) => each.uri!.contains('main.dart')); + testLibraryScript = scripts.scripts!.firstWhere( + (each) => + each.uri!.contains('package:$testPackage/test_library.dart'), + ); + }); + + tearDown(() async { + await service.resume(isolate.id!); + }); + + Future onBreakPoint( + BreakpointTestData breakpoint, + Future Function() body, + ) async { + Breakpoint? bp; + try { + final bpId = breakpoint.bpId; + final script = breakpoint.script; + final line = + await context.findBreakpointLine(bpId, isolate.id!, script); + bp = await service.addBreakpointWithScriptUri( + isolate.id!, + script.uri!, + line, ); - }); - tearDownAll(() async { - await context.tearDown(); - }); + expect(bp, isNotNull); + expect(bp.location, _matchBpLocation(script, line, 0)); - group('callStack |', () { - late VmServiceInterface service; - VM vm; - late Isolate isolate; - ScriptList scripts; - late ScriptRef mainScript; - late ScriptRef testLibraryScript; - late Stream stream; - - setUp(() async { - setCurrentLogWriter(debug: debug); - service = context.service; - vm = await service.getVM(); - isolate = await service.getIsolate(vm.isolates!.first.id!); - scripts = await service.getScripts(isolate.id!); - - await service.streamListen('Debug'); - stream = service.onEvent('Debug'); - - final testPackage = context.project.packageName; - mainScript = scripts.scripts! - .firstWhere((each) => each.uri!.contains('main.dart')); - testLibraryScript = scripts.scripts!.firstWhere( - (each) => each.uri! - .contains('package:$testPackage/test_library.dart'), - ); - }); - - tearDown(() async { - await service.resume(isolate.id!); - }); - - Future onBreakPoint( - BreakpointTestData breakpoint, - Future Function() body, - ) async { - Breakpoint? bp; - try { - final bpId = breakpoint.bpId; - final script = breakpoint.script; - final line = - await context.findBreakpointLine(bpId, isolate.id!, script); - bp = await service.addBreakpointWithScriptUri( - isolate.id!, - script.uri!, - line, - ); - - expect(bp, isNotNull); - expect(bp.location, _matchBpLocation(script, line, 0)); - - await stream.firstWhere( - (Event event) => event.kind == EventKind.kPauseBreakpoint, - ); - - await body(); - } finally { - // Remove breakpoint so it doesn't impact other tests or retries. - if (bp != null) { - await service.removeBreakpoint(isolate.id!, bp.id!); - } - } - } + await stream.firstWhere( + (Event event) => event.kind == EventKind.kPauseBreakpoint, + ); - Future testCallStack( - List breakpoints, { - int frameIndex = 1, - }) async { - // Find lines the breakpoints are located on. - final lines = await Future.wait( - breakpoints.map( - (frame) => context.findBreakpointLine( - frame.bpId, - isolate.id!, - frame.script, - ), - ), - ); - - // Get current stack. - final stack = await service.getStack(isolate.id!); - - // Verify the stack is correct. - expect(stack.frames!.length, greaterThanOrEqualTo(lines.length)); - final expected = [ - for (var i = 0; i < lines.length; i++) - _matchFrame( - breakpoints[i].script, - breakpoints[i].function, - lines[i], - ), - ]; - expect(stack.frames, containsAll(expected)); - - // Verify that expression evaluation is not failing. - final instance = await service.evaluateInFrame( - isolate.id!, - frameIndex, - 'true', - ); - expect(instance, isA()); + await body(); + } finally { + // Remove breakpoint so it doesn't impact other tests or retries. + if (bp != null) { + await service.removeBreakpoint(isolate.id!, bp.id!); } + } + } + + Future testCallStack( + List breakpoints, { + int frameIndex = 1, + }) async { + // Find lines the breakpoints are located on. + final lines = await Future.wait( + breakpoints.map( + (frame) => context.findBreakpointLine( + frame.bpId, + isolate.id!, + frame.script, + ), + ), + ); + + // Get current stack. + final stack = await service.getStack(isolate.id!); + + // Verify the stack is correct. + expect(stack.frames!.length, greaterThanOrEqualTo(lines.length)); + final expected = [ + for (var i = 0; i < lines.length; i++) + _matchFrame( + breakpoints[i].script, + breakpoints[i].function, + lines[i], + ), + ]; + expect(stack.frames, containsAll(expected)); + + // Verify that expression evaluation is not failing. + final instance = await service.evaluateInFrame( + isolate.id!, + frameIndex, + 'true', + ); + expect(instance, isA()); + } + + test('breakpoint succeeds with correct callstack', () async { + // Expected breakpoints on the stack + final breakpoints = [ + BreakpointTestData( + 'printEnclosingObject', + 'printEnclosingObject', + mainScript, + ), + BreakpointTestData( + 'printEnclosingFunctionMultiLine', + 'printNestedObjectsMultiLine', + mainScript, + ), + BreakpointTestData( + 'callPrintEnclosingFunctionMultiLine', + '', + mainScript, + ), + ]; + await onBreakPoint( + breakpoints[0], + () => testCallStack(breakpoints), + ); + }); - test('breakpoint succeeds with correct callstack', () async { - // Expected breakpoints on the stack - final breakpoints = [ - BreakpointTestData( - 'printEnclosingObject', - 'printEnclosingObject', - mainScript, - ), - BreakpointTestData( - 'printEnclosingFunctionMultiLine', - 'printNestedObjectsMultiLine', - mainScript, - ), - BreakpointTestData( - 'callPrintEnclosingFunctionMultiLine', - '', - mainScript, - ), - ]; - await onBreakPoint( - breakpoints[0], - () => testCallStack(breakpoints), - ); - }); - - test('expression evaluation succeeds on parent frame', () async { - // Expected breakpoints on the stack - final breakpoints = [ - BreakpointTestData( - 'testLibraryClassConstructor', - 'new', - testLibraryScript, - ), - BreakpointTestData( - 'createLibraryObject', - 'printFieldFromLibraryClass', - mainScript, - ), - BreakpointTestData( - 'callPrintFieldFromLibraryClass', - '', - mainScript, - ), - ]; - await onBreakPoint( - breakpoints[0], - () => testCallStack(breakpoints, frameIndex: 2), - ); - }); - - test('breakpoint inside a line gives correct callstack', () async { - // Expected breakpoints on the stack - final breakpoints = [ - BreakpointTestData( - 'newEnclosedClass', - 'new', - mainScript, - ), - BreakpointTestData( - 'printNestedObjectMultiLine', - 'printNestedObjectsMultiLine', - mainScript, - ), - BreakpointTestData( - 'callPrintEnclosingFunctionMultiLine', - '', - mainScript, - ), - ]; - await onBreakPoint( - breakpoints[0], - () => testCallStack(breakpoints), - ); - }); - - test('breakpoint gives correct callstack after step out', () async { - // Expected breakpoints on the stack - final breakpoints = [ - BreakpointTestData( - 'newEnclosedClass', - 'new', - mainScript, - ), - BreakpointTestData( - 'printEnclosingObjectMultiLine', - 'printNestedObjectsMultiLine', - mainScript, - ), - BreakpointTestData( - 'callPrintEnclosingFunctionMultiLine', - '', - mainScript, - ), - ]; - await onBreakPoint(breakpoints[0], () async { - await service.resume(isolate.id!, step: 'Out'); - await stream.firstWhere( - (Event event) => event.kind == EventKind.kPauseInterrupted, - ); - return testCallStack([breakpoints[1], breakpoints[2]]); - }); - }); - - test('breakpoint gives correct callstack after step in', () async { - // Expected breakpoints on the stack - final breakpoints = [ - BreakpointTestData( - 'newEnclosedClass', - 'new', - mainScript, - ), - BreakpointTestData( - 'printNestedObjectMultiLine', - 'printNestedObjectsMultiLine', - mainScript, - ), - BreakpointTestData( - 'callPrintEnclosingFunctionMultiLine', - '', - mainScript, - ), - ]; - await onBreakPoint(breakpoints[1], () async { - await service.resume(isolate.id!, step: 'Into'); - await stream.firstWhere( - (Event event) => event.kind == EventKind.kPauseInterrupted, - ); - return testCallStack(breakpoints); - }); - }); - - test( - 'breakpoint gives correct callstack after step into chain calls', - () async { - // Expected breakpoints on the stack - final breakpoints = [ - BreakpointTestData( - 'createObjectWithMethod', - 'createObject', - mainScript, - ), - BreakpointTestData( - // This is currently incorrect, should be printObjectMultiLine. - // See issue: https://github.com/dart-lang/sdk/issues/48874 - 'printMultiLine', - 'printObjectMultiLine', - mainScript, - ), - BreakpointTestData( - 'callPrintObjectMultiLine', - '', - mainScript, - ), - ]; - final bp = BreakpointTestData( - 'printMultiLine', - 'printObjectMultiLine', - mainScript, - ); - await onBreakPoint(bp, () async { - await service.resume(isolate.id!, step: 'Into'); - await stream.firstWhere( - (Event event) => event.kind == EventKind.kPauseInterrupted, - ); - return testCallStack(breakpoints); - }); - }); + test('expression evaluation succeeds on parent frame', () async { + // Expected breakpoints on the stack + final breakpoints = [ + BreakpointTestData( + 'testLibraryClassConstructor', + 'new', + testLibraryScript, + ), + BreakpointTestData( + 'createLibraryObject', + 'printFieldFromLibraryClass', + mainScript, + ), + BreakpointTestData( + 'callPrintFieldFromLibraryClass', + '', + mainScript, + ), + ]; + await onBreakPoint( + breakpoints[0], + () => testCallStack(breakpoints, frameIndex: 2), + ); + }); + + test('breakpoint inside a line gives correct callstack', () async { + // Expected breakpoints on the stack + final breakpoints = [ + BreakpointTestData( + 'newEnclosedClass', + 'new', + mainScript, + ), + BreakpointTestData( + 'printNestedObjectMultiLine', + 'printNestedObjectsMultiLine', + mainScript, + ), + BreakpointTestData( + 'callPrintEnclosingFunctionMultiLine', + '', + mainScript, + ), + ]; + await onBreakPoint( + breakpoints[0], + () => testCallStack(breakpoints), + ); + }); + + test('breakpoint gives correct callstack after step out', () async { + // Expected breakpoints on the stack + final breakpoints = [ + BreakpointTestData( + 'newEnclosedClass', + 'new', + mainScript, + ), + BreakpointTestData( + 'printEnclosingObjectMultiLine', + 'printNestedObjectsMultiLine', + mainScript, + ), + BreakpointTestData( + 'callPrintEnclosingFunctionMultiLine', + '', + mainScript, + ), + ]; + await onBreakPoint(breakpoints[0], () async { + await service.resume(isolate.id!, step: 'Out'); + await stream.firstWhere( + (Event event) => event.kind == EventKind.kPauseInterrupted, + ); + return testCallStack([breakpoints[1], breakpoints[2]]); + }); + }); + + test('breakpoint gives correct callstack after step in', () async { + // Expected breakpoints on the stack + final breakpoints = [ + BreakpointTestData( + 'newEnclosedClass', + 'new', + mainScript, + ), + BreakpointTestData( + 'printNestedObjectMultiLine', + 'printNestedObjectsMultiLine', + mainScript, + ), + BreakpointTestData( + 'callPrintEnclosingFunctionMultiLine', + '', + mainScript, + ), + ]; + await onBreakPoint(breakpoints[1], () async { + await service.resume(isolate.id!, step: 'Into'); + await stream.firstWhere( + (Event event) => event.kind == EventKind.kPauseInterrupted, + ); + return testCallStack(breakpoints); + }); + }); + + test('breakpoint gives correct callstack after step into chain calls', + () async { + // Expected breakpoints on the stack + final breakpoints = [ + BreakpointTestData( + 'createObjectWithMethod', + 'createObject', + mainScript, + ), + BreakpointTestData( + // This is currently incorrect, should be printObjectMultiLine. + // See issue: https://github.com/dart-lang/sdk/issues/48874 + 'printMultiLine', + 'printObjectMultiLine', + mainScript, + ), + BreakpointTestData( + 'callPrintObjectMultiLine', + '', + mainScript, + ), + ]; + final bp = BreakpointTestData( + 'printMultiLine', + 'printObjectMultiLine', + mainScript, + ); + await onBreakPoint(bp, () async { + await service.resume(isolate.id!, step: 'Into'); + await stream.firstWhere( + (Event event) => event.kind == EventKind.kPauseInterrupted, + ); + return testCallStack(breakpoints); }); }); - } + }); }, ); } diff --git a/dwds/test/chrome_proxy_service_test.dart b/dwds/test/chrome_proxy_service_test.dart index bba876707..ba70c1262 100644 --- a/dwds/test/chrome_proxy_service_test.dart +++ b/dwds/test/chrome_proxy_service_test.dart @@ -33,7 +33,7 @@ void main() { final provider = TestSdkConfigurationProvider(verbose: debug); tearDownAll(provider.dispose); - final context = TestContext(TestProject.testWithSoundNullSafety, provider); + final context = TestContext(TestProject.test, provider); group('shared context', () { setUpAll(() async { diff --git a/dwds/test/dart_uri_file_uri_test.dart b/dwds/test/dart_uri_file_uri_test.dart index 1f7e66640..4277dfd92 100644 --- a/dwds/test/dart_uri_file_uri_test.dart +++ b/dwds/test/dart_uri_file_uri_test.dart @@ -22,8 +22,8 @@ void main() { final provider = TestSdkConfigurationProvider(); tearDownAll(provider.dispose); - final testProject = TestProject.testWithSoundNullSafety; - final testPackageProject = TestProject.testPackageWithSoundNullSafety(); + final testProject = TestProject.test; + final testPackageProject = TestProject.testPackage(); /// The directory for the general _test package. final testDir = testProject.absolutePackageDirectory; diff --git a/dwds/test/debug_extension_test.dart b/dwds/test/debug_extension_test.dart index 9e199d653..002414481 100644 --- a/dwds/test/debug_extension_test.dart +++ b/dwds/test/debug_extension_test.dart @@ -37,7 +37,7 @@ void main() async { final provider = TestSdkConfigurationProvider(); tearDownAll(provider.dispose); - final context = TestContext(TestProject.testWithSoundNullSafety, provider); + final context = TestContext(TestProject.test, provider); Future waitForDartDevToolsWithRetry({ int retryCount = 6, diff --git a/dwds/test/debug_service_test.dart b/dwds/test/debug_service_test.dart index d5320ec97..ff2781056 100644 --- a/dwds/test/debug_service_test.dart +++ b/dwds/test/debug_service_test.dart @@ -20,7 +20,7 @@ void main() { final provider = TestSdkConfigurationProvider(); tearDownAll(provider.dispose); - final context = TestContext(TestProject.testWithSoundNullSafety, provider); + final context = TestContext(TestProject.test, provider); setUpAll(() async { // Disable DDS as we're testing DWDS behavior. diff --git a/dwds/test/devtools_test.dart b/dwds/test/devtools_test.dart index 8e9fb4868..def6e4497 100644 --- a/dwds/test/devtools_test.dart +++ b/dwds/test/devtools_test.dart @@ -30,7 +30,7 @@ void main() { final provider = TestSdkConfigurationProvider(); tearDownAll(provider.dispose); - final context = TestContext(TestProject.testWithSoundNullSafety, provider); + final context = TestContext(TestProject.test, provider); group( 'Injected client', diff --git a/dwds/test/evaluate_circular_common.dart b/dwds/test/evaluate_circular_common.dart index 0a777d298..4ddb16bc3 100644 --- a/dwds/test/evaluate_circular_common.dart +++ b/dwds/test/evaluate_circular_common.dart @@ -29,7 +29,7 @@ void testAll({ ); } - final testCircular1 = TestProject.testCircular1(); + final testCircular1 = TestProject.testCircular1; final testCircular2 = TestProject.testCircular2( baseMode: indexBaseMode, ); diff --git a/dwds/test/evaluate_common.dart b/dwds/test/evaluate_common.dart index e10fbd31e..67ca4e947 100644 --- a/dwds/test/evaluate_common.dart +++ b/dwds/test/evaluate_common.dart @@ -31,7 +31,7 @@ void testAll({ ); } - final testProject = TestProject.test(); + final testProject = TestProject.test; final testPackageProject = TestProject.testPackage(baseMode: indexBaseMode); final context = TestContext(testPackageProject, provider); diff --git a/dwds/test/events_test.dart b/dwds/test/events_test.dart index 186439fa2..3ce3fdd5c 100644 --- a/dwds/test/events_test.dart +++ b/dwds/test/events_test.dart @@ -23,7 +23,7 @@ void main() { final provider = TestSdkConfigurationProvider(); tearDownAll(provider.dispose); - final context = TestContext(TestProject.testWithSoundNullSafety, provider); + final context = TestContext(TestProject.test, provider); group('serve requests', () { late HttpServer server; diff --git a/dwds/test/fixtures/context.dart b/dwds/test/fixtures/context.dart index c0b63ce64..4932bba25 100644 --- a/dwds/test/fixtures/context.dart +++ b/dwds/test/fixtures/context.dart @@ -306,7 +306,6 @@ class TestContext { ); final compilerOptions = TestCompilerOptions( - nullSafety: project.nullSafety, experiments: buildSettings.experiments, canaryFeatures: buildSettings.canaryFeatures, moduleFormat: testSettings.moduleFormat, diff --git a/dwds/test/fixtures/project.dart b/dwds/test/fixtures/project.dart index f4f0c54e6..b06b1d5c8 100644 --- a/dwds/test/fixtures/project.dart +++ b/dwds/test/fixtures/project.dart @@ -8,8 +8,6 @@ import 'package:path/path.dart' as p; import 'package:test_common/utilities.dart'; -enum NullSafety { weak, sound } - enum IndexBaseMode { noBase, base } /// Project definitions from projects defined in webdev/fixtures. @@ -19,7 +17,6 @@ class TestProject { final String webAssetsPath; final String dartEntryFileName; final String htmlEntryFileName; - final NullSafety nullSafety; /// The top level directory in which we run the test server, e.g. /// "/workstation/webdev/fixtures/_testSound". @@ -67,7 +64,7 @@ class TestProject { dartEntryFileName, )}'); - const TestProject.testPackageWithSoundNullSafety({ + const TestProject.testPackage({ IndexBaseMode baseMode = IndexBaseMode.noBase, }) : this._( packageName: '_test_package_sound', @@ -76,55 +73,17 @@ class TestProject { dartEntryFileName: 'main.dart', htmlEntryFileName: baseMode == IndexBaseMode.base ? 'base_index.html' : 'index.html', - nullSafety: NullSafety.sound, - ); - - const TestProject.testPackageWithWeakNullSafety({ - IndexBaseMode baseMode = IndexBaseMode.noBase, - }) : this._( - packageName: '_test_package', - packageDirectory: '_testPackage', - webAssetsPath: 'web', - dartEntryFileName: 'main.dart', - htmlEntryFileName: - baseMode == IndexBaseMode.base ? 'base_index.html' : 'index.html', - nullSafety: NullSafety.weak, ); - factory TestProject.testPackage({ - NullSafety nullSafety = NullSafety.sound, - IndexBaseMode baseMode = IndexBaseMode.noBase, - }) => - nullSafety == NullSafety.sound - ? TestProject.testPackageWithSoundNullSafety(baseMode: baseMode) - : TestProject.testPackageWithWeakNullSafety(baseMode: baseMode); - - static const testCircular1WithSoundNullSafety = TestProject._( + static const testCircular1 = TestProject._( packageName: '_test_circular1_sound', packageDirectory: '_testCircular1Sound', webAssetsPath: 'web', dartEntryFileName: 'main.dart', htmlEntryFileName: 'index.html', - nullSafety: NullSafety.sound, - ); - - static const testCircular1WithWeakNullSafety = TestProject._( - packageName: '_test_circular1', - packageDirectory: '_testCircular1', - webAssetsPath: 'web', - dartEntryFileName: 'main.dart', - htmlEntryFileName: 'index.html', - nullSafety: NullSafety.weak, ); - factory TestProject.testCircular1({ - NullSafety nullSafety = NullSafety.sound, - }) => - nullSafety == NullSafety.sound - ? TestProject.testCircular1WithSoundNullSafety - : TestProject.testCircular1WithWeakNullSafety; - - const TestProject.testCircular2WithSoundNullSafety({ + const TestProject.testCircular2({ IndexBaseMode baseMode = IndexBaseMode.noBase, }) : this._( packageName: '_test_circular2_sound', @@ -133,77 +92,38 @@ class TestProject { dartEntryFileName: 'main.dart', htmlEntryFileName: baseMode == IndexBaseMode.base ? 'base_index.html' : 'index.html', - nullSafety: NullSafety.sound, ); - const TestProject.testCircular2WithWeakNullSafety({ - IndexBaseMode baseMode = IndexBaseMode.noBase, - }) : this._( - packageName: '_test_circular2', - packageDirectory: '_testCircular2', - webAssetsPath: 'web', - dartEntryFileName: 'main.dart', - htmlEntryFileName: - baseMode == IndexBaseMode.base ? 'base_index.html' : 'index.html', - nullSafety: NullSafety.weak, - ); - - factory TestProject.testCircular2({ - NullSafety nullSafety = NullSafety.sound, - IndexBaseMode baseMode = IndexBaseMode.noBase, - }) => - nullSafety == NullSafety.sound - ? TestProject.testCircular2WithSoundNullSafety(baseMode: baseMode) - : TestProject.testCircular2WithWeakNullSafety(baseMode: baseMode); - - static const testWithSoundNullSafety = TestProject._( + static const test = TestProject._( packageName: '_test_sound', packageDirectory: '_testSound', webAssetsPath: 'example/hello_world', dartEntryFileName: 'main.dart', htmlEntryFileName: 'index.html', - nullSafety: NullSafety.sound, - ); - - static const testWithWeakNullSafety = TestProject._( - packageName: '_test', - packageDirectory: '_test', - webAssetsPath: 'example/hello_world', - dartEntryFileName: 'main.dart', - htmlEntryFileName: 'index.html', - nullSafety: NullSafety.weak, ); - factory TestProject.test({NullSafety nullSafety = NullSafety.sound}) => - nullSafety == NullSafety.sound - ? TestProject.testWithSoundNullSafety - : TestProject.testWithWeakNullSafety; - - static final testScopesWithSoundNullSafety = TestProject._( + static final testScopes = TestProject._( packageName: '_test_sound', packageDirectory: '_testSound', webAssetsPath: webCompatiblePath(['example', 'scopes']), dartEntryFileName: 'main.dart', htmlEntryFileName: 'scopes.html', - nullSafety: NullSafety.sound, ); - static final testAppendBodyWithSoundNullSafety = TestProject._( + static final testAppendBody = TestProject._( packageName: '_test_sound', packageDirectory: '_testSound', webAssetsPath: webCompatiblePath(['example', 'append_body']), dartEntryFileName: 'main.dart', htmlEntryFileName: 'index.html', - nullSafety: NullSafety.sound, ); - static const testExperimentWithSoundNullSafety = TestProject._( + static const testExperiment = TestProject._( packageName: '_experiment_sound', packageDirectory: '_experimentSound', webAssetsPath: 'web', dartEntryFileName: 'main.dart', htmlEntryFileName: 'index.html', - nullSafety: NullSafety.sound, ); static const testHotRestart1 = TestProject._( @@ -212,7 +132,6 @@ class TestProject { webAssetsPath: 'web', dartEntryFileName: 'main.dart', htmlEntryFileName: 'index.html', - nullSafety: NullSafety.sound, ); /// This series of hot restart tests is divided across multiple packages in @@ -223,7 +142,6 @@ class TestProject { webAssetsPath: 'web', dartEntryFileName: 'main.dart', htmlEntryFileName: 'index.html', - nullSafety: NullSafety.sound, ); const TestProject._({ @@ -232,14 +150,9 @@ class TestProject { required this.webAssetsPath, required this.dartEntryFileName, required this.htmlEntryFileName, - required this.nullSafety, }); void validate() { - // Verify that the test fixtures package matches the null-safety mode: - final isSoundPackage = packageDirectory.toLowerCase().contains('sound'); - assert(nullSafety == NullSafety.sound ? isSoundPackage : !isSoundPackage); - // Verify that the web assets path has no starting slash: assert(!webAssetsPath.startsWith('/')); } diff --git a/dwds/test/fixtures/utilities.dart b/dwds/test/fixtures/utilities.dart index 3ce905f16..07193375c 100644 --- a/dwds/test/fixtures/utilities.dart +++ b/dwds/test/fixtures/utilities.dart @@ -15,7 +15,6 @@ import 'package:dwds/src/services/expression_compiler.dart'; import 'context.dart'; import 'fakes.dart'; -import 'project.dart'; /// Connects to the `build_runner` daemon. Future connectClient( @@ -298,12 +297,11 @@ class TestBuildSettings extends BuildSettings { class TestCompilerOptions extends CompilerOptions { TestCompilerOptions({ - required NullSafety nullSafety, required super.canaryFeatures, required List experiments, super.moduleFormat = ModuleFormat.amd, }) : super( - soundNullSafety: nullSafety == NullSafety.sound, + soundNullSafety: true, experiments: const [], ); } diff --git a/dwds/test/frontend_server_breakpoint_test.dart b/dwds/test/frontend_server_breakpoint_test.dart index db4de5f4d..02ca5bcf5 100644 --- a/dwds/test/frontend_server_breakpoint_test.dart +++ b/dwds/test/frontend_server_breakpoint_test.dart @@ -22,8 +22,7 @@ void main() { final provider = TestSdkConfigurationProvider(verbose: debug); tearDownAll(provider.dispose); - final context = - TestContext(TestProject.testPackageWithSoundNullSafety(), provider); + final context = TestContext(TestProject.testPackage(), provider); // Change to 'true' to print expression compiler messages to console. // diff --git a/dwds/test/handlers/asset_handler_test.dart b/dwds/test/handlers/asset_handler_test.dart index 2abfbcb57..471070cf3 100644 --- a/dwds/test/handlers/asset_handler_test.dart +++ b/dwds/test/handlers/asset_handler_test.dart @@ -16,7 +16,7 @@ import '../fixtures/utilities.dart'; void main() { group('Asset handler', () { final provider = TestSdkConfigurationProvider(); - final context = TestContext(TestProject.testWithSoundNullSafety, provider); + final context = TestContext(TestProject.test, provider); setUpAll(() async { setCurrentLogWriter(); diff --git a/dwds/test/inspector_test.dart b/dwds/test/inspector_test.dart index e84cd64ad..ea53ce63f 100644 --- a/dwds/test/inspector_test.dart +++ b/dwds/test/inspector_test.dart @@ -21,8 +21,7 @@ void main() { final provider = TestSdkConfigurationProvider(); tearDownAll(provider.dispose); - final context = - TestContext(TestProject.testScopesWithSoundNullSafety, provider); + final context = TestContext(TestProject.testScopes, provider); late AppInspector inspector; diff --git a/dwds/test/instances/class_inspection_test.dart b/dwds/test/instances/class_inspection_test.dart index aa05e6d8e..e9bf34092 100644 --- a/dwds/test/instances/class_inspection_test.dart +++ b/dwds/test/instances/class_inspection_test.dart @@ -24,8 +24,7 @@ void main() { verbose: debug, ); - final context = - TestContext(TestProject.testExperimentWithSoundNullSafety, provider); + final context = TestContext(TestProject.testExperiment, provider); final testInspector = TestInspector(context); late VmService service; diff --git a/dwds/test/instances/common/instance_common.dart b/dwds/test/instances/common/instance_common.dart index ebea38a86..7bb185f64 100644 --- a/dwds/test/instances/common/instance_common.dart +++ b/dwds/test/instances/common/instance_common.dart @@ -22,7 +22,7 @@ void runTypeSystemVerificationTests({ required bool canaryFeatures, required bool debug, }) { - final project = TestProject.testScopesWithSoundNullSafety; + final project = TestProject.testScopes; group('$compilationMode |', () { final context = TestContext(project, provider); @@ -95,7 +95,7 @@ void runTests({ required bool canaryFeatures, required bool debug, }) { - final project = TestProject.testScopesWithSoundNullSafety; + final project = TestProject.testScopes; final context = TestContext(project, provider); late AppInspector inspector; diff --git a/dwds/test/instances/common/instance_inspection_common.dart b/dwds/test/instances/common/instance_inspection_common.dart index 9de2072f5..63fb49302 100644 --- a/dwds/test/instances/common/instance_inspection_common.dart +++ b/dwds/test/instances/common/instance_inspection_common.dart @@ -18,7 +18,7 @@ void runTests({ required bool canaryFeatures, required bool debug, }) { - final project = TestProject.testPackageWithSoundNullSafety(); + final project = TestProject.testPackage(); final context = TestContext(project, provider); late VmService service; diff --git a/dwds/test/instances/common/patterns_inspection_common.dart b/dwds/test/instances/common/patterns_inspection_common.dart index 9a303a632..888e5fff2 100644 --- a/dwds/test/instances/common/patterns_inspection_common.dart +++ b/dwds/test/instances/common/patterns_inspection_common.dart @@ -18,8 +18,7 @@ void runTests({ required bool canaryFeatures, required bool debug, }) { - final context = - TestContext(TestProject.testExperimentWithSoundNullSafety, provider); + final context = TestContext(TestProject.testExperiment, provider); final testInspector = TestInspector(context); late VmService service; diff --git a/dwds/test/instances/common/record_inspection_common.dart b/dwds/test/instances/common/record_inspection_common.dart index 805a21657..5c40c77f2 100644 --- a/dwds/test/instances/common/record_inspection_common.dart +++ b/dwds/test/instances/common/record_inspection_common.dart @@ -18,8 +18,7 @@ void runTests({ required bool canaryFeatures, required bool debug, }) { - final context = - TestContext(TestProject.testExperimentWithSoundNullSafety, provider); + final context = TestContext(TestProject.testExperiment, provider); final testInspector = TestInspector(context); late VmService service; diff --git a/dwds/test/instances/common/record_type_inspection_common.dart b/dwds/test/instances/common/record_type_inspection_common.dart index 7aca5699a..b55a8acb2 100644 --- a/dwds/test/instances/common/record_type_inspection_common.dart +++ b/dwds/test/instances/common/record_type_inspection_common.dart @@ -19,8 +19,7 @@ void runTests({ required bool canaryFeatures, required bool debug, }) { - final context = - TestContext(TestProject.testExperimentWithSoundNullSafety, provider); + final context = TestContext(TestProject.testExperiment, provider); final testInspector = TestInspector(context); late VmService service; diff --git a/dwds/test/instances/common/type_inspection_common.dart b/dwds/test/instances/common/type_inspection_common.dart index 70b6f3ed4..8beb91be2 100644 --- a/dwds/test/instances/common/type_inspection_common.dart +++ b/dwds/test/instances/common/type_inspection_common.dart @@ -19,7 +19,7 @@ void runTests({ required bool canaryFeatures, required bool debug, }) { - final project = TestProject.testExperimentWithSoundNullSafety; + final project = TestProject.testExperiment; final context = TestContext(project, provider); final testInspector = TestInspector(context); diff --git a/dwds/test/listviews_test.dart b/dwds/test/listviews_test.dart index 3cb2209db..4cff22933 100644 --- a/dwds/test/listviews_test.dart +++ b/dwds/test/listviews_test.dart @@ -14,7 +14,7 @@ void main() { final provider = TestSdkConfigurationProvider(); tearDownAll(provider.dispose); - final context = TestContext(TestProject.testWithSoundNullSafety, provider); + final context = TestContext(TestProject.test, provider); setUpAll(() async { await context.setUp(); diff --git a/dwds/test/load_strategy_test.dart b/dwds/test/load_strategy_test.dart index 56bd55108..1d1bc2551 100644 --- a/dwds/test/load_strategy_test.dart +++ b/dwds/test/load_strategy_test.dart @@ -18,7 +18,7 @@ import 'fixtures/utilities.dart'; void main() { group('Load Strategy', () { - final project = TestProject.testWithSoundNullSafety; + final project = TestProject.test; final provider = TestSdkConfigurationProvider(); tearDownAll(provider.dispose); @@ -153,7 +153,7 @@ void main() { final isFlutterApp = true; final experiments = ['records']; - final project = TestProject.testWithSoundNullSafety; + final project = TestProject.test; final provider = TestSdkConfigurationProvider(canaryFeatures: canaryFeatures); tearDownAll(provider.dispose); diff --git a/dwds/test/package_uri_mapper_test.dart b/dwds/test/package_uri_mapper_test.dart index c3c7db9d3..45518e42b 100644 --- a/dwds/test/package_uri_mapper_test.dart +++ b/dwds/test/package_uri_mapper_test.dart @@ -15,7 +15,7 @@ import 'package:test/test.dart'; import 'fixtures/project.dart'; void main() { - final project = TestProject.testPackageWithSoundNullSafety(); + final project = TestProject.testPackage(); for (final useDebuggerModuleNames in [true, false]) { group( diff --git a/dwds/test/puppeteer/extension_common.dart b/dwds/test/puppeteer/extension_common.dart index 6a4fe105d..d7597640b 100644 --- a/dwds/test/puppeteer/extension_common.dart +++ b/dwds/test/puppeteer/extension_common.dart @@ -36,7 +36,7 @@ void testAll({ screenshotsEnabled = screenshotsEnabled; final provider = TestSdkConfigurationProvider(); - final context = TestContext(TestProject.testWithSoundNullSafety, provider); + final context = TestContext(TestProject.test, provider); tearDownAll(provider.dispose); group('${isMV3 ? 'MV3' : 'MV2'} Debug Extension', () { diff --git a/dwds/test/readers/frontend_server_asset_reader_test.dart b/dwds/test/readers/frontend_server_asset_reader_test.dart index e11c29dcd..ed8e4e5ed 100644 --- a/dwds/test/readers/frontend_server_asset_reader_test.dart +++ b/dwds/test/readers/frontend_server_asset_reader_test.dart @@ -21,7 +21,7 @@ void main() { late File jsonOriginal; late File mapOriginal; - final testProject = TestProject.testWithSoundNullSafety; + final testProject = TestProject.test; final packagesDir = testProject.absolutePackageDirectory; Future createTempFixtures() async { diff --git a/dwds/test/readers/proxy_server_asset_reader_test.dart b/dwds/test/readers/proxy_server_asset_reader_test.dart index 9f0e0887e..3ae4d0df9 100644 --- a/dwds/test/readers/proxy_server_asset_reader_test.dart +++ b/dwds/test/readers/proxy_server_asset_reader_test.dart @@ -16,7 +16,7 @@ void main() { final provider = TestSdkConfigurationProvider(); tearDownAll(provider.dispose); - final context = TestContext(TestProject.testWithSoundNullSafety, provider); + final context = TestContext(TestProject.test, provider); late ProxyServerAssetReader assetReader; setUpAll(() async { diff --git a/dwds/test/refresh_test.dart b/dwds/test/refresh_test.dart index 6cc1e3887..979fdf60d 100644 --- a/dwds/test/refresh_test.dart +++ b/dwds/test/refresh_test.dart @@ -22,7 +22,7 @@ void main() { final provider = TestSdkConfigurationProvider(); tearDownAll(provider.dispose); - final context = TestContext(TestProject.testWithSoundNullSafety, provider); + final context = TestContext(TestProject.test, provider); group('fresh context', () { late VmServiceInterface service; diff --git a/dwds/test/reload_test.dart b/dwds/test/reload_test.dart index 19fb076dc..fb5f17e23 100644 --- a/dwds/test/reload_test.dart +++ b/dwds/test/reload_test.dart @@ -25,8 +25,7 @@ void main() { final provider = TestSdkConfigurationProvider(verbose: debug); tearDownAll(provider.dispose); - final context = - TestContext(TestProject.testAppendBodyWithSoundNullSafety, provider); + final context = TestContext(TestProject.testAppendBody, provider); Future makeEditAndWaitForRebuild() async { context.makeEditToDartEntryFile( diff --git a/dwds/test/run_request_test.dart b/dwds/test/run_request_test.dart index 8efd4f0c4..c7afc0d11 100644 --- a/dwds/test/run_request_test.dart +++ b/dwds/test/run_request_test.dart @@ -22,7 +22,7 @@ void main() { final provider = TestSdkConfigurationProvider(verbose: debug); tearDownAll(provider.dispose); - final context = TestContext(TestProject.testWithSoundNullSafety, provider); + final context = TestContext(TestProject.test, provider); group( 'while debugger is attached', diff --git a/dwds/test/screenshot_test.dart b/dwds/test/screenshot_test.dart index db9e4c4e5..7e02c47c8 100644 --- a/dwds/test/screenshot_test.dart +++ b/dwds/test/screenshot_test.dart @@ -14,7 +14,7 @@ void main() { final provider = TestSdkConfigurationProvider(); tearDownAll(provider.dispose); - final context = TestContext(TestProject.testWithSoundNullSafety, provider); + final context = TestContext(TestProject.test, provider); setUpAll(() async { await context.setUp(); diff --git a/dwds/test/variable_scope_test.dart b/dwds/test/variable_scope_test.dart index 9036ec744..4d080f4f8 100644 --- a/dwds/test/variable_scope_test.dart +++ b/dwds/test/variable_scope_test.dart @@ -22,8 +22,7 @@ void main() { final provider = TestSdkConfigurationProvider(verbose: debug); tearDownAll(provider.dispose); - final context = - TestContext(TestProject.testScopesWithSoundNullSafety, provider); + final context = TestContext(TestProject.testScopes, provider); setUpAll(() async { setCurrentLogWriter(debug: debug); diff --git a/fixtures/_test/example/append_body/index.html b/fixtures/_test/example/append_body/index.html deleted file mode 100644 index d93440a94..000000000 --- a/fixtures/_test/example/append_body/index.html +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/fixtures/_test/example/append_body/main.dart b/fixtures/_test/example/append_body/main.dart deleted file mode 100644 index edfdacc12..000000000 --- a/fixtures/_test/example/append_body/main.dart +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2019, 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. - -// ignore: illegal_language_version_override -// @dart=2.9 - -import 'dart:async'; -import 'dart:developer'; -import 'dart:html'; - -void main() { - var count = 0; - // For setting breakpoints. - Timer.periodic(const Duration(seconds: 1), (_) { - print('Count is: ${++count}'); // Breakpoint: printCount - }); - - document.body.appendText('Hello World!'); - - registerExtension('ext.flutter.disassemble', (_, __) async { - document.body.appendText('start disassemble '); - await Future.delayed(const Duration(seconds: 1)); - document.body.appendText('end disassemble '); - return ServiceExtensionResponse.result('{}'); - }); -} diff --git a/fixtures/_test/example/hello_world/index.html b/fixtures/_test/example/hello_world/index.html deleted file mode 100644 index d93440a94..000000000 --- a/fixtures/_test/example/hello_world/index.html +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/fixtures/_test/example/hello_world/main.dart b/fixtures/_test/example/hello_world/main.dart deleted file mode 100644 index ff9ba068b..000000000 --- a/fixtures/_test/example/hello_world/main.dart +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) 2019, 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. - -// ignore: illegal_language_version_override -// @dart=2.9 - -import 'dart:async'; -import 'dart:convert'; -import 'dart:developer'; -import 'dart:html'; -import 'dart:js'; - -import 'package:intl/intl.dart'; -import 'package:path/path.dart' as p; - -part 'part.dart'; - -final myInstance = MyTestClass(); - -void main() async { - print(DateFormat()); - // Long running so that we can test the pause / resume behavior. - Timer.periodic(const Duration(seconds: 1), (_) {}); - - print(p.join('Hello', 'World')); // Breakpoint: printHelloWorld - - // long running to test evaluateInFrame - Timer.periodic(const Duration(seconds: 1), (_) { - var local = 42; - print(local); // Breakpoint: printLocal - }); - - context['inspectInstance'] = () { - inspect(myInstance); - }; - - context['postEvent'] = (String kind) { - postEvent(kind, {'example': 'data'}); - }; - - context['registerExtension'] = (String method) { - registerExtension(method, - (String method, Map parameters) async { - return ServiceExtensionResponse.result(jsonEncode(parameters ?? {})); - }); - }; - - context['registerExtensionWithError'] = (String method) { - registerExtension(method, - (String method, Map parameters) async { - return ServiceExtensionResponse.error( - int.parse(parameters['code']), parameters['details']); - }); - }; - - context['sendLog'] = (String message) { - log(message, name: 'testLogCategory'); - }; - - context['throwUncaughtException'] = () { - scheduleMicrotask(() => throw Exception('UncaughtException')); - }; - - Timer.periodic(const Duration(seconds: 1), (_) { - printCount(); // Breakpoint: callPrintCount - }); - - Timer.periodic(const Duration(seconds: 1), (_) { - asyncCall(); - }); - - Timer.periodic(const Duration(seconds: 1), (_) { - throwsException(); - }); - - // Register one up front before the proxy connects, the isolate should still - // recognize this as an available extension. - registerExtension('ext.hello_world.existing', (_, __) => null); - - window.console.debug('Page Ready'); -} - -var count = 0; - -// An easy location to add a breakpoint. -void printCount() { - print('The count is ${++count}'); // Breakpoint: inPrintCount - doSomething(); -} - -void asyncCall() async { - var now = DateTime.now(); - - await Future.delayed(Duration.zero); - - var then = DateTime.now(); // Breakpoint: asyncCall - // ignore: unused_local_variable - var diff = then.difference(now); -} - -void throwsException() { - try { - throw Exception('new exception'); - } catch (e) { - // ignore - } -} - -String helloString(String response) => response; - -bool helloBool(bool response) => response; - -num helloNum(num response) => response; - -MyTestClass createObject(String message) => MyTestClass(message: message); - -String messageFor(MyTestClass instance) => instance.message; - -String messagesCombined(MyTestClass a, MyTestClass b) => a.message + b.message; - -class MyTestClass { - final String message; - - String notFinal; - - static final String staticMessage = 'static'; - - static String staticHello() => 'static hello'; - - MyTestClass({this.message = 'world'}); - - String hello() => message; -} diff --git a/fixtures/_test/example/hello_world/part.dart b/fixtures/_test/example/hello_world/part.dart deleted file mode 100644 index 68a383f74..000000000 --- a/fixtures/_test/example/hello_world/part.dart +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) 2019, 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. - -// ignore: illegal_language_version_override -// @dart=2.9 - -part of 'main.dart'; - -var blah = 'blah'; - -void doSomething() { - print(blah); -} diff --git a/fixtures/_test/example/scopes/main.dart b/fixtures/_test/example/scopes/main.dart deleted file mode 100644 index 6474febd0..000000000 --- a/fixtures/_test/example/scopes/main.dart +++ /dev/null @@ -1,166 +0,0 @@ -// Copyright (c) 2019, 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. - -/// An example with more complicated scope -import 'dart:async'; -import 'dart:collection'; - -final libraryPublicFinal = MyTestClass(); - -final _libraryPrivateFinal = 1; -Object? libraryNull; -var libraryPublic = ['library', 'public', 'variable']; -var notAList = NotReallyAList(); - -var _libraryPrivate = ['library', 'private', 'variable']; - -var identityMap = {}; - -var map = {}; - -void staticFunction(int formal) { - print(formal); // Breakpoint: staticFunction -} - -void main() async { - print('Initial print from scopes app'); - var local = 'local in main'; - var intLocalInMain = 42; - var testClass = MyTestClass(); - Object? localThatsNull; - identityMap['a'] = 1; - identityMap['b'] = 2; - map['a'] = [1, 2, 3]; - map['b'] = 'something'; - notAList.add(7); - - String nestedFunction(T parameter, Object aClass) { - var another = int.tryParse('$parameter'); - return '$local: parameter, $another'; // Breakpoint: nestedFunction - } - - dynamic nestedWithClosure(String banana) { - return () => '$local + $banana'; - } - - Timer.periodic(const Duration(seconds: 1), (Timer t) { - var ticks = t.tick; - // ignore: unused_local_variable, prefer_typing_uninitialized_variables - var closureLocal; - libraryPublicFinal.printCount(); - staticFunction(1); - print('ticking... $ticks (the answer is $intLocalInMain)'); - print(nestedFunction('$ticks ${testClass.message}', Timer)); - print(localThatsNull); - print(libraryNull); - var localList = libraryPublic; - print(localList); - localList.add('abc'); - var f = testClass.methodWithVariables(); - print(f('parameter')); - var num = '1234'.someExtensionMethod(); - print('$num'); - }); - - print(_libraryPrivateFinal); - print(_libraryPrivate); - print(nestedFunction(_libraryPrivate.first, Object)); - print(nestedWithClosure(_libraryPrivate.first)()); -} - -String libraryFunction(String arg) { - print('calling a library function with $arg'); - var concat = 'some constant plus $arg plus whatever'; - print(concat); - return concat; -} - -abstract class MyAbstractClass { - String abstractField = 'abstract-field-value'; -} - -class MyTestClass extends MyAbstractClass { - final String message; - - String? notFinal; - - MyTestClass({this.message = 'world'}) { - myselfField = this; - tornOff = toString; - } - - String hello() => message; - - String Function(String) methodWithVariables() { - print('Test class is of type $T'); - var local = '$message + something'; - print(local); - return (String parameter) { - // Be sure to use a field from this, so it isn't entirely optimized away. - var closureLocalInsideMethod = '$message/$local/$parameter'; - print(closureLocalInsideMethod); - return closureLocalInsideMethod; // Breakpoint: nestedClosure - }; - } - - //ignore: avoid_returning_this - MyTestClass get myselfGetter => this; - - late final MyTestClass myselfField; - - var count = 0; - - // An easy location to add a breakpoint. - void printCount() { - print('The count is ${++count}'); - libraryFunction('abc'); // Breakpoint: printMethod - } - - final _privateField = 'a private field'; - - // ignore: unused_element - String privateMethod(String s) => '$s : $_privateField'; - - @override - String toString() => 'A test class with message $message'; - - bool equals(Object other) { - if (other is MyTestClass) return message == other.hello(); - return false; - } - - Function closure = someFunction; - - late final String Function() tornOff; -} - -Function? someFunction() => null; - -// ignore: unused_element -int _libraryPrivateFunction(int a, int b) => a + b; - -class NotReallyAList extends ListBase { - final List _internal; - - NotReallyAList() : _internal = []; - - @override - Object? operator [](x) => _internal[x]; - - @override - operator []=(int x, Object? y) => _internal[x] = y; - - @override - int get length => _internal.length; - - @override - set length(x) => _internal.length = x; -} - -extension NumberParsing on String { - int someExtensionMethod() { - var ret = int.parse(this); - return ret; // Breakpoint: extension - } -} diff --git a/fixtures/_test/example/scopes/scopes.html b/fixtures/_test/example/scopes/scopes.html deleted file mode 100644 index d93440a94..000000000 --- a/fixtures/_test/example/scopes/scopes.html +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/fixtures/_test/lib/deferred_library.dart b/fixtures/_test/lib/deferred_library.dart deleted file mode 100644 index e151c3e3f..000000000 --- a/fixtures/_test/lib/deferred_library.dart +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) 2022, 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. - -// ignore: illegal_language_version_override -// @dart=2.9 - -/// A library that we can import. -library test_deferred_library; - -void deferredPrintLocal() { - print('hello from deferred library'); // Breakpoint: DeferredPrintLocal -} diff --git a/fixtures/_test/lib/library.dart b/fixtures/_test/lib/library.dart deleted file mode 100644 index f680d5413..000000000 --- a/fixtures/_test/lib/library.dart +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) 2019, 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. - -// ignore: illegal_language_version_override -// @dart=2.9 - -/// A library that we can import. -library test_library; - -int aVariable = 3; - -String concatenate(String a, String b) { - return '$a$b'; // Breakpoint: Concatenate -} diff --git a/fixtures/_test/pubspec.yaml b/fixtures/_test/pubspec.yaml deleted file mode 100644 index 296935c42..000000000 --- a/fixtures/_test/pubspec.yaml +++ /dev/null @@ -1,24 +0,0 @@ -# This code is for testing that the debugger works with weak null-safety -# so we should not migrate it to null-safety. -# TODO(elliette): Delete this directory post Dart 3.0 (when we no longer -# support weak null-safety). -name: _test -version: 1.0.0 -description: >- - A fake package used for testing weak null-safety. -publish_to: none - -environment: - sdk: ^3.2.0-36.0.dev - -dependencies: - intl: ^0.17.0 - path: ^1.6.1 - -dev_dependencies: - build_runner: '>=1.6.2 <3.0.0' - build_web_compilers: - git: - url: https://github.com/dart-lang/build.git - ref: legacy_force_opt_out - path: build_web_compilers diff --git a/fixtures/_testCircular1/lib/library1.dart b/fixtures/_testCircular1/lib/library1.dart deleted file mode 100644 index 00b05e18e..000000000 --- a/fixtures/_testCircular1/lib/library1.dart +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2019, 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. - -// ignore: illegal_language_version_override -// @dart=2.9 - -/// A library that we can import. -library _test_circular1; - -import 'package:_test_circular2/library2.dart'; - -String concatenate(String a, String b) { - return '$a$b'; // Breakpoint: Concatenate -} - -void printGlobal() { - print(globalValue); -} diff --git a/fixtures/_testCircular1/pubspec.yaml b/fixtures/_testCircular1/pubspec.yaml deleted file mode 100644 index c6b0dd504..000000000 --- a/fixtures/_testCircular1/pubspec.yaml +++ /dev/null @@ -1,26 +0,0 @@ -# This code is for testing that the debugger works with weak null-safety -# so we should not migrate it to null-safety. -# TODO(elliette): Delete this directory post Dart 3.0 (when we no longer -# support weak null-safety). -name: _test_circular1 -version: 1.0.0 -description: >- - A fake package used for testing weak null-safety with circular dependency. -publish_to: none - -environment: - sdk: ^3.2.0-36.0.dev - -dependencies: - intl: ^0.17.0 - path: ^1.6.1 - _test_circular2: - path: ../_testCircular2 - -dev_dependencies: - build_runner: ^2.0.0 - build_web_compilers: - git: - url: https://github.com/dart-lang/build.git - ref: legacy_force_opt_out - path: build_web_compilers diff --git a/fixtures/_testCircular2/lib/library2.dart b/fixtures/_testCircular2/lib/library2.dart deleted file mode 100644 index 3580c7447..000000000 --- a/fixtures/_testCircular2/lib/library2.dart +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) 2019, 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. - -// ignore: illegal_language_version_override -// @dart=2.9 - -import 'package:_test_circular1/library1.dart'; - -int globalValue = 0; - -void testCircularDependencies() { - print(concatenate('a', 'b')); // Breakpoint: testCircularDependencies -} diff --git a/fixtures/_testCircular2/pubspec.yaml b/fixtures/_testCircular2/pubspec.yaml deleted file mode 100644 index fca9f9a9c..000000000 --- a/fixtures/_testCircular2/pubspec.yaml +++ /dev/null @@ -1,24 +0,0 @@ -# This code is for testing that the debugger works with weak null-safety -# so we should not migrate it to null-safety. -# TODO(elliette): Delete this directory post Dart 3.0 (when we no longer -# support weak null-safety). -name: _test_circular2 -version: 1.0.0 -description: >- - A fake package used for testing imports with weak null-safety with circular dependency. -publish_to: none - -environment: - sdk: ^3.2.0-36.0.dev - -dependencies: - _test_circular1: - path: ../_testCircular1 - -dev_dependencies: - build_runner: ^2.0.0 - build_web_compilers: - git: - url: https://github.com/dart-lang/build.git - ref: legacy_force_opt_out - path: build_web_compilers diff --git a/fixtures/_testCircular2/web/base_index.html b/fixtures/_testCircular2/web/base_index.html deleted file mode 100644 index affdbcb5c..000000000 --- a/fixtures/_testCircular2/web/base_index.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/fixtures/_testCircular2/web/index.html b/fixtures/_testCircular2/web/index.html deleted file mode 100644 index d93440a94..000000000 --- a/fixtures/_testCircular2/web/index.html +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/fixtures/_testCircular2/web/main.dart b/fixtures/_testCircular2/web/main.dart deleted file mode 100644 index 9c26c2fe4..000000000 --- a/fixtures/_testCircular2/web/main.dart +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2019, 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. - -// ignore: illegal_language_version_override -// @dart=2.9 - -import 'dart:async'; -import 'dart:core'; -import 'dart:html'; - -import 'package:_test_circular1/library1.dart'; -import 'package:_test_circular2/library2.dart'; - -void main() { - // For setting breakpoints. - Timer.periodic(const Duration(seconds: 1), (_) { - testCircularDependencies(); - }); - - document.body.appendText(concatenate('Program', ' is running!')); -} diff --git a/fixtures/_testPackage/lib/src/test_part.dart b/fixtures/_testPackage/lib/src/test_part.dart deleted file mode 100644 index eb5f575e2..000000000 --- a/fixtures/_testPackage/lib/src/test_part.dart +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2021, 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. - -// ignore: illegal_language_version_override -// @dart=2.9 - -part of '../test_library.dart'; - -int testPartLibraryValue = 4; - -int testLibraryPartFunction(int formal) { - return formal; // Breakpoint: testLibraryPartFunction -} - -class TestLibraryPartClass { - final int field; - final int _field; - - TestLibraryPartClass(this.field, this._field) { - print('Constructor'); // Breakpoint: testLibraryPartClassConstructor - } - - @override - String toString() => 'field: $field, _field: $_field'; -} diff --git a/fixtures/_testPackage/lib/src/version.dart b/fixtures/_testPackage/lib/src/version.dart deleted file mode 100644 index 526cd53d4..000000000 --- a/fixtures/_testPackage/lib/src/version.dart +++ /dev/null @@ -1,2 +0,0 @@ -// Generated code. Do not modify. -const packageVersion = '1.0.0'; diff --git a/fixtures/_testPackage/lib/test_library.dart b/fixtures/_testPackage/lib/test_library.dart deleted file mode 100644 index f8f85a105..000000000 --- a/fixtures/_testPackage/lib/test_library.dart +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) 2019, 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. - -// ignore: illegal_language_version_override -// @dart=2.9 - -part 'src/test_part.dart'; - -int testLibraryValue = 3; - -int testLibraryFunction(int formal) { - return formal; // Breakpoint: testLibraryFunction -} - -class TestLibraryClass { - final int field; - final int _field; - TestLibraryClass(this.field, this._field) { - print('Constructor'); // Breakpoint: testLibraryClassConstructor - } - - @override - String toString() => 'field: $field, _field: $_field'; -} diff --git a/fixtures/_testPackage/pubspec.yaml b/fixtures/_testPackage/pubspec.yaml deleted file mode 100644 index a087d6083..000000000 --- a/fixtures/_testPackage/pubspec.yaml +++ /dev/null @@ -1,24 +0,0 @@ -# This code is for testing that the debugger works with weak null-safety -# so we should not migrate it to null-safety. -# TODO(elliette): Delete this directory post Dart 3.0 (when we no longer -# support weak null-safety). -name: _test_package -version: 1.0.0 -description: >- - A fake package used for testing imports with weak null-safety. Imports _test. -publish_to: none - -environment: - sdk: ^3.2.0-36.0.dev - -dependencies: - _test: - path: ../_test - -dev_dependencies: - build_runner: ^2.0.0 - build_web_compilers: - git: - url: https://github.com/dart-lang/build.git - ref: legacy_force_opt_out - path: build_web_compilers diff --git a/fixtures/_testPackage/web/base_index.html b/fixtures/_testPackage/web/base_index.html deleted file mode 100644 index affdbcb5c..000000000 --- a/fixtures/_testPackage/web/base_index.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/fixtures/_testPackage/web/index.html b/fixtures/_testPackage/web/index.html deleted file mode 100644 index d93440a94..000000000 --- a/fixtures/_testPackage/web/index.html +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/fixtures/_testPackage/web/main.dart b/fixtures/_testPackage/web/main.dart deleted file mode 100644 index b52882d62..000000000 --- a/fixtures/_testPackage/web/main.dart +++ /dev/null @@ -1,238 +0,0 @@ -// Copyright (c) 2019, 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. - -// ignore: illegal_language_version_override -// @dart=2.9 - -import 'dart:async'; -import 'dart:convert'; -import 'dart:core'; -import 'dart:developer'; -import 'dart:html'; - -import 'package:_test/deferred_library.dart' deferred as d; -import 'package:_test/library.dart'; -import 'package:_test_package/test_library.dart'; - -extension NumberParsing on String { - int parseInt() { - var ret = int.parse(this); - return ret; // Breakpoint: extension - } -} - -void main() { - var count = 0; - // For setting breakpoints. - Timer.periodic(const Duration(seconds: 1), (_) { - print('Count is: ${++count}'); - print(testLibraryValue); - print(testPartLibraryValue); - }); - - // for evaluation - var extensionId = 0; - Timer.periodic(const Duration(seconds: 1), (_) { - printLocal(); - printFieldFromLibraryClass(); // Breakpoint: callPrintFieldFromLibraryClass - printFieldFromLibraryPartClass(); - printFieldMain(); - printGlobal(); - printFromTestLibrary(); - printFromTestLibraryPart(); - printFromTestPackage(); - printCallExtension(); - printLoopVariable(); - printObjectMultiLine(); // Breakpoint: callPrintObjectMultiLine - printNestedObjectsMultiLine(); // Breakpoint: callPrintEnclosingFunctionMultiLine - printStream(); // Breakpoint: callPrintStream - printList(); - printMap(); - printSet(); - printFrame2(); - printLargeScope(); - // For testing evaluation in async JS frames. - registerUserExtension(extensionId++); - }); - - document.body.appendText(concatenate('Program', ' is running!')); -} - -void registerUserExtension(int id) async { - registerExtension('ext.extension$id', (_, __) async { - print('Hello World from extension$id'); - return ServiceExtensionResponse.result(json.encode({'success': true})); - }); -} - -void printLocal() { - var local = 42; - print('Local is: $local'); // Breakpoint: printLocal -} - -void printFieldFromLibraryClass() { - var instance = TestLibraryClass(1, 2); // Breakpoint: createLibraryObject - print('$instance'); // Breakpoint: printFieldFromLibraryClass -} - -void printFieldFromLibraryPartClass() { - var instance = TestLibraryPartClass(1, 2); - print('$instance'); // Breakpoint: printFieldFromLibraryPartClass -} - -void printFieldMain() { - var instance = MainClass(2, 1); - print('$instance'); // Breakpoint: printFieldMain -} - -void printGlobal() { - print(testLibraryValue); // Breakpoint: printGlobal -} - -void printFromTestPackage() { - print(concatenate('Hello', ' World')); -} - -void printFromTestLibrary() { - var local = 23; - print(testLibraryFunction(local)); -} - -void printFromTestLibraryPart() { - var local = 23; - print(testLibraryPartFunction(local)); -} - -void printCallExtension() { - var local = '23'; - print(local.parseInt()); -} - -void printLoopVariable() { - var list = ['1']; - for (var item in list) { - print(item); // Breakpoint: printLoopVariable - } -} - -Future printDeferred() async { - d.deferredPrintLocal(); -} - -void printNestedObjectsMultiLine() { - printEnclosingObject(// Breakpoint: printEnclosingFunctionMultiLine - EnclosingClass(// Breakpoint: printEnclosingObjectMultiLine - EnclosedClass(0) // Breakpoint: printNestedObjectMultiLine - )); -} - -void printObjectMultiLine() { - print(// Breakpoint: printMultiLine - // Breakpoint: Do not remove, will break callstack tests! - createObject() // Breakpoint: printObjectMultiLine - ..initialize()); -} - -void printEnclosingObject(EnclosingClass o) { - print(o); // Breakpoint: printEnclosingObject -} - -void printStream() { - var controller = StreamController(); - var stream = controller.stream.asBroadcastStream(); - var subscription = stream.listen(print); - controller.sink.add(0); - subscription.cancel(); // Breakpoint: printStream -} - -void printList() { - final list = [0, 1, 2]; - print(list); // Breakpoint: printList -} - -void printMap() { - final map = {'a': 1, 'b': 2, 'c': 3}; - print(map); // Breakpoint: printMap -} - -void printSet() { - final mySet = {1, 4, 5, 7}; - print(mySet); // Breakpoint: printSet -} - -ClassWithMethod createObject() { - return ClassWithMethod(0); // Breakpoint: createObjectWithMethod -} - -void printFrame2() { - final local2 = 2; - print(local2); - printFrame1(); -} - -void printFrame1() { - final local1 = 1; - print(local1); // Breakpoint: printFrame1 -} - -void printLargeScope() { - var t0 = 0; - var t1 = 1; - var t2 = 2; - var t3 = 3; - var t4 = 4; - var t5 = 5; - var t6 = 6; - var t7 = 7; - var t8 = 8; - var t9 = 9; - var t10 = 10; - var t11 = 11; - var t12 = 12; - var t13 = 13; - var t14 = 14; - var t15 = 15; - var t16 = 16; - var t17 = 17; - var t18 = 18; - var t19 = 19; - - print('$t0 $t1, $t2, $t3, $t4, $t5, $t6, $t7, $t8, $t9, $t10, ' - '$t11, $t12, $t13, $t14, $t15, $t16, $t17, $t18, $t19'); // Breakpoint: printLargeScope -} - -class MainClass { - final int field; - final int _field; - MainClass(this.field, this._field); // Breakpoint: newMainClass - - @override - String toString() => '$field, $_field'; // Breakpoint: toStringMainClass -} - -class EnclosedClass { - final int _field; - EnclosedClass(this._field); // Breakpoint: newEnclosedClass - - @override - String toString() => '$_field'; -} - -class ClassWithMethod { - final int _field; - ClassWithMethod(this._field); - - void initialize() {} - - @override - String toString() => '$_field'; -} - -class EnclosingClass { - final EnclosedClass _field; - EnclosingClass(this._field); // Breakpoint: newEnclosingClass - - @override - String toString() => '$_field'; -} diff --git a/fixtures/_webdevSmoke/pubspec.yaml b/fixtures/_webdevSmoke/pubspec.yaml deleted file mode 100644 index bb2384603..000000000 --- a/fixtures/_webdevSmoke/pubspec.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# This code is for testing that the debugger works with weak null-safety -# so we should not migrate it to null-safety. -# TODO(elliette): Delete this directory post Dart 3.0 (when we no longer -# support weak null-safety). -name: _webdev_smoke -description: - A test fixture for webdev testing with weak null-safety. - -publish_to: none - -# The versions in this pubspec should match the requirements -# defined by webdev. That is the SDK constraint should be the -# same as defined by webdev/pubspec.yaml and the build_runner -# and build_web_compilers constraint should match those defined -# in pubspec.dart. -environment: - sdk: ^3.2.0-36.0.dev - -dev_dependencies: - build_runner: '>=1.6.2 <3.0.0' - build_web_compilers: - git: - url: https://github.com/dart-lang/build.git - ref: legacy_force_opt_out - path: build_web_compilers diff --git a/fixtures/_webdevSmoke/web/index.html b/fixtures/_webdevSmoke/web/index.html deleted file mode 100644 index 7b6980130..000000000 --- a/fixtures/_webdevSmoke/web/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - webdev example - - - - - - diff --git a/fixtures/_webdevSmoke/web/main.dart b/fixtures/_webdevSmoke/web/main.dart deleted file mode 100644 index d4b08de5c..000000000 --- a/fixtures/_webdevSmoke/web/main.dart +++ /dev/null @@ -1,26 +0,0 @@ -// 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. - -// ignore: illegal_language_version_override -// @dart = 2.9 - -import 'dart:async'; -import 'dart:convert'; -import 'dart:developer'; -import 'dart:html'; - -void main() { - print('Initial Print'); - - registerExtension('ext.print', (_, __) async { - print('Hello World'); - return ServiceExtensionResponse.result(json.encode({'success': true})); - }); - document.body.append(SpanElement()..text = 'Hello World!!'); - - var count = 0; - Timer.periodic(const Duration(seconds: 1), (_) { - print('Counter is: ${++count}'); // Breakpoint: printCounter - }); -} diff --git a/fixtures/_webdevSmoke/web/scopes.html b/fixtures/_webdevSmoke/web/scopes.html deleted file mode 100644 index 6c3307394..000000000 --- a/fixtures/_webdevSmoke/web/scopes.html +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/fixtures/_webdevSmoke/web/scopes_main.dart b/fixtures/_webdevSmoke/web/scopes_main.dart deleted file mode 100644 index 5f3dfffd3..000000000 --- a/fixtures/_webdevSmoke/web/scopes_main.dart +++ /dev/null @@ -1,155 +0,0 @@ -// 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. - -// ignore: illegal_language_version_override -// @dart = 2.9 - -/// An example with more complicated scope -import 'dart:async'; -import 'dart:collection'; - -final libraryPublicFinal = MyTestClass(); - -final _libraryPrivateFinal = 1; -Object libraryNull; -var libraryPublic = ['library', 'public', 'variable']; -var notAList = NotReallyAList(); - -var _libraryPrivate = ['library', 'private', 'variable']; - -var identityMap = {}; - -var map = {}; - -void staticFunction(int formal) { - print(formal); // Breakpoint: staticFunction -} - -void main() async { - print('Initial print from scopes app'); - var local = 'local in main'; - var intLocalInMain = 42; - var testClass = MyTestClass(); - Object localThatsNull; - identityMap['a'] = 1; - identityMap['b'] = 2; - map['a'] = [1, 2, 3]; - map['b'] = 'something'; - notAList.add(7); - - String nestedFunction(T parameter, Object aClass) { - var another = int.tryParse('$parameter'); - return '$local: parameter, $another'; // Breakpoint: nestedFunction - } - - dynamic nestedWithClosure(String banana) { - return () => '$local + $banana'; - } - - Timer.periodic(const Duration(seconds: 1), (Timer t) { - var ticks = t.tick; - // ignore: unused_local_variable, prefer_typing_uninitialized_variables - var closureLocal; - libraryPublicFinal.printCount(); - staticFunction(1); - print('ticking... $ticks (the answer is $intLocalInMain)'); - print(nestedFunction('$ticks ${testClass.message}', Timer)); - print(localThatsNull); - print(libraryNull); - var localList = libraryPublic; - print(localList); - localList.add('abc'); - var f = testClass.methodWithVariables(); - print(f('parameter')); - }); - - print(_libraryPrivateFinal); - print(_libraryPrivate); - print(nestedFunction(_libraryPrivate.first, Object)); - print(nestedWithClosure(_libraryPrivate.first)()); -} - -String libraryFunction(String arg) { - print('calling a library function with $arg'); - var concat = 'some constant plus $arg plus whatever'; - print(concat); - return concat; -} - -class MyTestClass { - final String message; - - String notFinal; - - MyTestClass({this.message = 'world'}) { - myselfField = this; - tornOff = toString; - } - - String hello() => message; - - String Function(String) methodWithVariables() { - var local = '$message + something'; - print(local); - return (String parameter) { - // Be sure to use a field from this, so it isn't entirely optimized away. - var closureLocalInsideMethod = '$message/$local/$parameter'; - print(closureLocalInsideMethod); - return closureLocalInsideMethod; // Breakpoint: nestedClosure - }; - } - - //ignore: avoid_returning_this - MyTestClass get myselfGetter => this; - - MyTestClass myselfField; - - var count = 0; - - // An easy location to add a breakpoint. - void printCount() { - print('The count is ${++count}'); - libraryFunction('abc'); // Breakpoint: printMethod - } - - final _privateField = 'a private field'; - - // ignore: unused_element - String privateMethod(String s) => '$s : $_privateField'; - - @override - String toString() => 'A test class with message $message'; - - bool equals(Object other) { - if (other is MyTestClass) return message == other.hello(); - return false; - } - - Function closure = someFunction; - - String Function() tornOff; -} - -Function someFunction() => null; - -// ignore: unused_element -int _libraryPrivateFunction(int a, int b) => a + b; - -class NotReallyAList extends ListBase { - final List _internal; - - NotReallyAList() : _internal = []; - - @override - Object operator [](x) => _internal[x]; - - @override - operator []=(x, y) => _internal[x] = y; - - @override - int get length => _internal.length; - - @override - set length(x) => _internal.length = x; -} diff --git a/frontend_server_client/test/frontend_server_client_test.dart b/frontend_server_client/test/frontend_server_client_test.dart index 95ecf81e9..4011c3ef3 100644 --- a/frontend_server_client/test/frontend_server_client_test.dart +++ b/frontend_server_client/test/frontend_server_client_test.dart @@ -241,7 +241,6 @@ String get message => p.join('hello', 'world'); await d.dir('a', [ d.dir('bin', [ d.file('nnbd.dart', ''' -// @dart=2.10 // Compile time error if nnbd is enabled int x; diff --git a/tool/release.dart b/tool/release.dart index f90927c12..25b7aa9d2 100644 --- a/tool/release.dart +++ b/tool/release.dart @@ -126,7 +126,8 @@ Future runRelease({ final newVersion = await _updateDwdsPin('webdev'); _logInfo('Add pinned DWDS info to CHANGELOG.'); final changelog = File('../webdev/CHANGELOG.md'); - _addNewLine(changelog, + _addNewLine( + changelog, newLine: '- Update `dwds` constraint to `${newVersion ?? 'TODO'}`.', insertAt: 2, ); diff --git a/webdev/test/e2e_test.dart b/webdev/test/e2e_test.dart index 2ffb8b584..7d339a6cb 100644 --- a/webdev/test/e2e_test.dart +++ b/webdev/test/e2e_test.dart @@ -38,22 +38,14 @@ void main() { final debug = false; final testRunner = TestRunner(); - late String exampleDirectory; late String soundExampleDirectory; setUpAll(() async { configureLogWriter(debug); await testRunner.setUpAll(); - exampleDirectory = - p.absolute(p.join(p.current, '..', 'fixtures', '_webdevSmoke')); soundExampleDirectory = p.absolute(p.join(p.current, '..', 'fixtures', '_webdevSoundSmoke')); var process = await TestProcess.start(dartPath, ['pub', 'upgrade'], - workingDirectory: exampleDirectory, environment: getPubEnvironment()); - - await process.shouldExit(0); - - process = await TestProcess.start(dartPath, ['pub', 'upgrade'], workingDirectory: soundExampleDirectory, environment: getPubEnvironment()); @@ -167,26 +159,6 @@ void main() { await d.file('main.ddc.js', isNotEmpty).validate(); }); - - test('and --null-safety=unsound', () async { - var args = [ - 'build', - '-o', - 'web:${d.sandbox}', - '--no-release', - '--null-safety=unsound' - ]; - - var process = - await testRunner.runWebDev(args, workingDirectory: exampleDirectory); - - var expectedItems = ['Succeeded']; - - await checkProcessStdout(process, expectedItems); - await process.shouldExit(0); - - await d.file('main.unsound.ddc.js', isNotEmpty).validate(); - }); }); group('should build with --output=NONE', () { @@ -279,316 +251,301 @@ void main() { setUp(() async { configureLogWriter(debug); }); + group('and --enable-expression-evaluation:', () { + setUp(() async { + configureLogWriter(debug); + }); + test('evaluateInFrame', () async { + var openPort = await findUnusedPort(); + // running daemon command that starts dwds without keyboard input + var args = [ + 'daemon', + 'web:$openPort', + '--enable-expression-evaluation', + '--null-safety=sound', + '--verbose', + ]; + var process = await testRunner.runWebDev(args, + workingDirectory: soundExampleDirectory); + VmService? vmService; - for (var soundNullSafety in [false, true]) { - var nullSafetyOption = soundNullSafety ? 'sound' : 'unsound'; - group('--null-safety=$nullSafetyOption', () { - setUp(() async { - configureLogWriter(debug); - }); - group('and --enable-expression-evaluation:', () { - setUp(() async { - configureLogWriter(debug); - }); - test('evaluateInFrame', () async { - var openPort = await findUnusedPort(); - // running daemon command that starts dwds without keyboard input - var args = [ - 'daemon', - 'web:$openPort', - '--enable-expression-evaluation', - '--null-safety=$nullSafetyOption', - '--verbose', - ]; - var process = await testRunner.runWebDev(args, - workingDirectory: - soundNullSafety ? soundExampleDirectory : exampleDirectory); - VmService? vmService; - - process.stdoutStream().listen(Logger.root.fine); - process.stderrStream().listen(Logger.root.warning); - - try { - // Wait for debug service Uri - String? wsUri; - await expectLater(process.stdout, emitsThrough((message) { - wsUri = getDebugServiceUri(message as String); - return wsUri != null; - })); - Logger.root.fine('vm service uri: $wsUri'); - expect(wsUri, isNotNull); - - vmService = await vmServiceConnectUri(wsUri!); - var vm = await vmService.getVM(); - var isolateId = vm.isolates!.first.id!; - var scripts = await vmService.getScripts(isolateId); - - await vmService.streamListen('Debug'); - var stream = vmService.onEvent('Debug'); - - var mainScript = scripts.scripts! - .firstWhere((each) => each.uri!.contains('main.dart')); - - var bpLine = await findBreakpointLine( - vmService, 'printCounter', isolateId, mainScript); - - var bp = await vmService.addBreakpointWithScriptUri( - isolateId, mainScript.uri!, bpLine); - expect(bp, isNotNull); - - await stream.firstWhere( - (Event event) => event.kind == EventKind.kPauseBreakpoint); - - final isNullSafetyEnabled = - '() { const sound = !([] is List); return sound; } ()'; - final result = await vmService.evaluateInFrame( - isolateId, 0, isNullSafetyEnabled); - - expect( - result, - const TypeMatcher().having( - (instance) => instance.valueAsString, - 'valueAsString', - '$soundNullSafety')); - } finally { - await vmService?.dispose(); - await exitWebdev(process); - await process.shouldExit(); - } - }, timeout: const Timeout.factor(2)); - - test('evaluate', () async { - var openPort = await findUnusedPort(); - // running daemon command that starts dwds without keyboard input - var args = [ - 'daemon', - 'web:$openPort', - '--enable-expression-evaluation', - '--verbose', - ]; - var process = await testRunner.runWebDev(args, - workingDirectory: - soundNullSafety ? soundExampleDirectory : exampleDirectory); - - process.stdoutStream().listen(Logger.root.fine); - process.stderrStream().listen(Logger.root.warning); - - VmService? vmService; - - try { - // Wait for debug service Uri - String? wsUri; - await expectLater(process.stdout, emitsThrough((message) { - wsUri = getDebugServiceUri(message as String); - return wsUri != null; - })); - expect(wsUri, isNotNull); - - vmService = await vmServiceConnectUri(wsUri!); - var vm = await vmService.getVM(); - var isolateId = vm.isolates!.first.id!; - var isolate = await vmService.getIsolate(isolateId); - var libraryId = isolate.rootLib!.id!; - - await vmService.streamListen('Debug'); - - var result = await vmService.evaluate(isolateId, libraryId, - '(document?.body?.children?.first as SpanElement)?.text'); - - expect( - result, - const TypeMatcher().having( - (instance) => instance.valueAsString, - 'valueAsString', - 'Hello World!!')); - - result = await vmService.evaluate( - isolateId, libraryId, 'main.toString()'); - - expect( - result, - const TypeMatcher().having( - (instance) => instance.valueAsString, - 'valueAsString', - contains('Hello World!!'))); - } finally { - await vmService?.dispose(); - await exitWebdev(process); - await process.shouldExit(); - } - }, timeout: const Timeout.factor(2)); - - test('evaluate and get objects', () async { - var openPort = await findUnusedPort(); - // running daemon command that starts dwds without keyboard input - var args = [ - 'daemon', - 'web:$openPort', - '--enable-expression-evaluation', - '--verbose', - ]; - var process = await testRunner.runWebDev(args, - workingDirectory: - soundNullSafety ? soundExampleDirectory : exampleDirectory); - - process.stdoutStream().listen(Logger.root.fine); - process.stderrStream().listen(Logger.root.warning); - - VmService? vmService; - - try { - // Wait for debug service Uri - String? wsUri; - await expectLater(process.stdout, emitsThrough((message) { - wsUri = getDebugServiceUri(message as String); - return wsUri != null; - })); - expect(wsUri, isNotNull); - - vmService = await vmServiceConnectUri(wsUri!); - var vm = await vmService.getVM(); - var isolateId = vm.isolates!.first.id!; - var isolate = await vmService.getIsolate(isolateId); - var libraryId = isolate.rootLib!.id!; - - await vmService.streamListen('Debug'); - - final result = await vmService.evaluate( - isolateId, libraryId, '[true, false]'); - expect( - result, - const TypeMatcher().having( - (instance) => instance.classRef?.name, - 'class name', - dartSdkIsAtLeast('3.3.0-242.0.dev') - ? 'JSArray' - : 'List')); - - final instanceRef = result as InstanceRef; - final list = - await vmService.getObject(isolateId, instanceRef.id!); - expect( - list, - const TypeMatcher().having( - (instance) => instance.classRef?.name, - 'class name', - dartSdkIsAtLeast('3.3.0-242.0.dev') - ? 'JSArray' - : 'List')); - - final elements = (list as Instance).elements; - expect(elements, [ - const TypeMatcher().having( - (instance) => instance.valueAsString, 'value', 'true'), - const TypeMatcher().having( - (instance) => instance.valueAsString, 'value', 'false'), - ]); - } finally { - await vmService?.dispose(); - await exitWebdev(process); - await process.shouldExit(); - } - }, timeout: const Timeout.factor(2)); - }); + process.stdoutStream().listen(Logger.root.fine); + process.stderrStream().listen(Logger.root.warning); - group('and --no-enable-expression-evaluation:', () { - test('evaluateInFrame', () async { - var openPort = await findUnusedPort(); - var args = [ - 'daemon', - 'web:$openPort', - '--no-enable-expression-evaluation', - '--verbose', - ]; - var process = await testRunner.runWebDev(args, - workingDirectory: - soundNullSafety ? soundExampleDirectory : exampleDirectory); - VmService? vmService; - - try { - // Wait for debug service Uri - String? wsUri; - await expectLater(process.stdout, emitsThrough((message) { - wsUri = getDebugServiceUri(message as String); - return wsUri != null; - })); - expect(wsUri, isNotNull); - - vmService = await vmServiceConnectUri(wsUri!); - var vm = await vmService.getVM(); - var isolateId = vm.isolates!.first.id!; - var scripts = await vmService.getScripts(isolateId); - - await vmService.streamListen('Debug'); - var stream = vmService.onEvent('Debug'); - - var mainScript = scripts.scripts! - .firstWhere((each) => each.uri!.contains('main.dart')); - - var bpLine = await findBreakpointLine( - vmService, 'printCounter', isolateId, mainScript); - - var bp = await vmService.addBreakpointWithScriptUri( - isolateId, mainScript.uri!, bpLine); - expect(bp, isNotNull); - - var event = await stream.firstWhere( - (Event event) => event.kind == EventKind.kPauseBreakpoint); - - expect( - () => vmService!.evaluateInFrame( - isolateId, event.topFrame!.index!, 'true'), - throwsRPCError); - } finally { - await vmService?.dispose(); - await exitWebdev(process); - await process.shouldExit(); - } - }); - - test('evaluate', () async { - var openPort = await findUnusedPort(); - // running daemon command that starts dwds without keyboard input - var args = [ - 'daemon', - 'web:$openPort', - '--no-enable-expression-evaluation', - '--verbose', - ]; - var process = await testRunner.runWebDev(args, - workingDirectory: - soundNullSafety ? soundExampleDirectory : exampleDirectory); - VmService? vmService; - - try { - // Wait for debug service Uri - String? wsUri; - await expectLater(process.stdout, emitsThrough((message) { - wsUri = getDebugServiceUri(message as String); - return wsUri != null; - })); - expect(wsUri, isNotNull); - - vmService = await vmServiceConnectUri(wsUri!); - var vm = await vmService.getVM(); - var isolateId = vm.isolates!.first.id!; - var isolate = await vmService.getIsolate(isolateId); - var libraryId = isolate.rootLib!.id!; - - await vmService.streamListen('Debug'); - - expect( - () => vmService! - .evaluate(isolateId, libraryId, 'main.toString()'), - throwsRPCError); - } finally { - await vmService?.dispose(); - await exitWebdev(process); - await process.shouldExit(); - } - }, timeout: const Timeout.factor(2)); - }); + try { + // Wait for debug service Uri + String? wsUri; + await expectLater(process.stdout, emitsThrough((message) { + wsUri = getDebugServiceUri(message as String); + return wsUri != null; + })); + Logger.root.fine('vm service uri: $wsUri'); + expect(wsUri, isNotNull); + + vmService = await vmServiceConnectUri(wsUri!); + var vm = await vmService.getVM(); + var isolateId = vm.isolates!.first.id!; + var scripts = await vmService.getScripts(isolateId); + + await vmService.streamListen('Debug'); + var stream = vmService.onEvent('Debug'); + + var mainScript = scripts.scripts! + .firstWhere((each) => each.uri!.contains('main.dart')); + + var bpLine = await findBreakpointLine( + vmService, 'printCounter', isolateId, mainScript); + + var bp = await vmService.addBreakpointWithScriptUri( + isolateId, mainScript.uri!, bpLine); + expect(bp, isNotNull); + + await stream.firstWhere( + (Event event) => event.kind == EventKind.kPauseBreakpoint); + + final isNullSafetyEnabled = + '() { const sound = !([] is List); return sound; } ()'; + final result = await vmService.evaluateInFrame( + isolateId, 0, isNullSafetyEnabled); + + expect( + result, + const TypeMatcher().having( + (instance) => instance.valueAsString, + 'valueAsString', + 'true')); + } finally { + await vmService?.dispose(); + await exitWebdev(process); + await process.shouldExit(); + } + }, timeout: const Timeout.factor(2)); + + test('evaluate', () async { + var openPort = await findUnusedPort(); + // running daemon command that starts dwds without keyboard input + var args = [ + 'daemon', + 'web:$openPort', + '--enable-expression-evaluation', + '--verbose', + ]; + var process = await testRunner.runWebDev(args, + workingDirectory: soundExampleDirectory); + + process.stdoutStream().listen(Logger.root.fine); + process.stderrStream().listen(Logger.root.warning); + + VmService? vmService; + + try { + // Wait for debug service Uri + String? wsUri; + await expectLater(process.stdout, emitsThrough((message) { + wsUri = getDebugServiceUri(message as String); + return wsUri != null; + })); + expect(wsUri, isNotNull); + + vmService = await vmServiceConnectUri(wsUri!); + var vm = await vmService.getVM(); + var isolateId = vm.isolates!.first.id!; + var isolate = await vmService.getIsolate(isolateId); + var libraryId = isolate.rootLib!.id!; + + await vmService.streamListen('Debug'); + + var result = await vmService.evaluate(isolateId, libraryId, + '(document?.body?.children?.first as SpanElement)?.text'); + + expect( + result, + const TypeMatcher().having( + (instance) => instance.valueAsString, + 'valueAsString', + 'Hello World!!')); + + result = + await vmService.evaluate(isolateId, libraryId, 'main.toString()'); + + expect( + result, + const TypeMatcher().having( + (instance) => instance.valueAsString, + 'valueAsString', + contains('Hello World!!'))); + } finally { + await vmService?.dispose(); + await exitWebdev(process); + await process.shouldExit(); + } + }, timeout: const Timeout.factor(2)); + + test('evaluate and get objects', () async { + var openPort = await findUnusedPort(); + // running daemon command that starts dwds without keyboard input + var args = [ + 'daemon', + 'web:$openPort', + '--enable-expression-evaluation', + '--verbose', + ]; + var process = await testRunner.runWebDev(args, + workingDirectory: soundExampleDirectory); + + process.stdoutStream().listen(Logger.root.fine); + process.stderrStream().listen(Logger.root.warning); + + VmService? vmService; + + try { + // Wait for debug service Uri + String? wsUri; + await expectLater(process.stdout, emitsThrough((message) { + wsUri = getDebugServiceUri(message as String); + return wsUri != null; + })); + expect(wsUri, isNotNull); + + vmService = await vmServiceConnectUri(wsUri!); + var vm = await vmService.getVM(); + var isolateId = vm.isolates!.first.id!; + var isolate = await vmService.getIsolate(isolateId); + var libraryId = isolate.rootLib!.id!; + + await vmService.streamListen('Debug'); + + final result = + await vmService.evaluate(isolateId, libraryId, '[true, false]'); + expect( + result, + const TypeMatcher().having( + (instance) => instance.classRef?.name, + 'class name', + dartSdkIsAtLeast('3.3.0-242.0.dev') + ? 'JSArray' + : 'List')); + + final instanceRef = result as InstanceRef; + final list = await vmService.getObject(isolateId, instanceRef.id!); + expect( + list, + const TypeMatcher().having( + (instance) => instance.classRef?.name, + 'class name', + dartSdkIsAtLeast('3.3.0-242.0.dev') + ? 'JSArray' + : 'List')); + + final elements = (list as Instance).elements; + expect(elements, [ + const TypeMatcher() + .having((instance) => instance.valueAsString, 'value', 'true'), + const TypeMatcher() + .having((instance) => instance.valueAsString, 'value', 'false'), + ]); + } finally { + await vmService?.dispose(); + await exitWebdev(process); + await process.shouldExit(); + } + }, timeout: const Timeout.factor(2)); + }); + + group('and --no-enable-expression-evaluation:', () { + test('evaluateInFrame', () async { + var openPort = await findUnusedPort(); + var args = [ + 'daemon', + 'web:$openPort', + '--no-enable-expression-evaluation', + '--verbose', + ]; + var process = await testRunner.runWebDev(args, + workingDirectory: soundExampleDirectory); + VmService? vmService; + + try { + // Wait for debug service Uri + String? wsUri; + await expectLater(process.stdout, emitsThrough((message) { + wsUri = getDebugServiceUri(message as String); + return wsUri != null; + })); + expect(wsUri, isNotNull); + + vmService = await vmServiceConnectUri(wsUri!); + var vm = await vmService.getVM(); + var isolateId = vm.isolates!.first.id!; + var scripts = await vmService.getScripts(isolateId); + + await vmService.streamListen('Debug'); + var stream = vmService.onEvent('Debug'); + + var mainScript = scripts.scripts! + .firstWhere((each) => each.uri!.contains('main.dart')); + + var bpLine = await findBreakpointLine( + vmService, 'printCounter', isolateId, mainScript); + + var bp = await vmService.addBreakpointWithScriptUri( + isolateId, mainScript.uri!, bpLine); + expect(bp, isNotNull); + + var event = await stream.firstWhere( + (Event event) => event.kind == EventKind.kPauseBreakpoint); + + expect( + () => vmService! + .evaluateInFrame(isolateId, event.topFrame!.index!, 'true'), + throwsRPCError); + } finally { + await vmService?.dispose(); + await exitWebdev(process); + await process.shouldExit(); + } }); - } + + test('evaluate', () async { + var openPort = await findUnusedPort(); + // running daemon command that starts dwds without keyboard input + var args = [ + 'daemon', + 'web:$openPort', + '--no-enable-expression-evaluation', + '--verbose', + ]; + var process = await testRunner.runWebDev(args, + workingDirectory: soundExampleDirectory); + VmService? vmService; + + try { + // Wait for debug service Uri + String? wsUri; + await expectLater(process.stdout, emitsThrough((message) { + wsUri = getDebugServiceUri(message as String); + return wsUri != null; + })); + expect(wsUri, isNotNull); + + vmService = await vmServiceConnectUri(wsUri!); + var vm = await vmService.getVM(); + var isolateId = vm.isolates!.first.id!; + var isolate = await vmService.getIsolate(isolateId); + var libraryId = isolate.rootLib!.id!; + + await vmService.streamListen('Debug'); + + expect( + () => + vmService!.evaluate(isolateId, libraryId, 'main.toString()'), + throwsRPCError); + } finally { + await vmService?.dispose(); + await exitWebdev(process); + await process.shouldExit(); + } + }, timeout: const Timeout.factor(2)); + }); }); }