Skip to content

Update tests that are incompatible with 3.0.0 #1817

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 36 commits into from
Dec 14, 2022
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
80f0130
Fix first test
elliette Dec 9, 2022
3b78175
Fix another test
elliette Dec 9, 2022
78ddf72
Tried to fix third test
elliette Dec 9, 2022
106fb39
Trying to fix test again
elliette Dec 9, 2022
a2e26f8
Trying to fix more tests
elliette Dec 9, 2022
c18a336
More fixes
elliette Dec 9, 2022
35f440e
Fix another test - skipping in null-safety due to https://github.com/…
elliette Dec 9, 2022
d344798
Format
elliette Dec 9, 2022
225fe4c
Fix another test
elliette Dec 9, 2022
c82d501
Frontend server and sound null-safety are incompatible
elliette Dec 9, 2022
056d882
Format
elliette Dec 9, 2022
8f60853
Fix analyze error
elliette Dec 9, 2022
a956aa3
Fix a few more tests
elliette Dec 9, 2022
1d75011
fix analyzer errors
elliette Dec 9, 2022
3785481
Update more tests
elliette Dec 10, 2022
6936bdf
fix analyzer errors
elliette Dec 10, 2022
3728c10
Fix ternary
elliette Dec 12, 2022
034d2bb
Fix more tests
elliette Dec 12, 2022
56b2c46
Fix analyze error
elliette Dec 12, 2022
db6b25f
Fix more tests
elliette Dec 12, 2022
e57b549
Format
elliette Dec 12, 2022
2ff8ca0
Fix debug extension tests
elliette Dec 12, 2022
66246b7
More fixes to debug extension test
elliette Dec 12, 2022
33c98d5
More test fixes
elliette Dec 12, 2022
ead3aa6
Remove unused import
elliette Dec 12, 2022
7f3b9ba
Update build_daemon_callstack_test
elliette Dec 13, 2022
69acf60
Update build_daemon_circular_evaluate_test
elliette Dec 13, 2022
169598c
Update frontend_server_breakpoint_test
elliette Dec 13, 2022
93160fc
Update build_daemon_evaluate_test
elliette Dec 13, 2022
bcd2882
Update frontend_server_callstack_test
elliette Dec 13, 2022
dc66516
Update frontend_server_circular_evaluation_test
elliette Dec 13, 2022
fe1b09b
Update frontend_server_evaluate_test
elliette Dec 13, 2022
7343cac
Remove all version compatibility helpers except for supportedMode
elliette Dec 13, 2022
c61d524
Revert changes to devfs
elliette Dec 13, 2022
3a5a6c4
Reference issues in chrome proxy service tests
elliette Dec 13, 2022
8012a27
Update more tests
elliette Dec 13, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dwds/test/build_daemon_breakpoint_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart';
import 'fixtures/context.dart';

final context = TestContext(
directory: p.join('..', 'fixtures', '_testPackage'),
entry: p.join('..', 'fixtures', '_testPackage', 'web', 'main.dart'),
directory: p.join('..', 'fixtures', '_testPackageSound'),
entry: p.join('..', 'fixtures', '_testPackageSound', 'web', 'main.dart'),
path: 'index.html',
pathToServe: 'web');

Expand Down
24 changes: 14 additions & 10 deletions dwds/test/build_daemon_callstack_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,24 @@ import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart';

import 'fixtures/context.dart';
import 'fixtures/logging.dart';
import 'utils/version_compatibility.dart';

class TestSetup {
static final contextUnsound = TestContext(
directory: p.join('..', 'fixtures', '_testPackage'),
entry: p.join('..', 'fixtures', '_testPackage', 'web', 'main.dart'),
path: 'index.html',
pathToServe: 'web');
directory: p.join('..', 'fixtures', '_testPackage'),
entry: p.join('..', 'fixtures', '_testPackage', 'web', 'main.dart'),
path: 'index.html',
pathToServe: 'web',
nullSafety: NullSafety.weak,
);

static final contextSound = TestContext(
directory: p.join('..', 'fixtures', '_testPackageSound'),
entry: p.join('..', 'fixtures', '_testPackageSound', 'web', 'main.dart'),
path: 'index.html',
pathToServe: 'web');
directory: p.join('..', 'fixtures', '_testPackageSound'),
entry: p.join('..', 'fixtures', '_testPackageSound', 'web', 'main.dart'),
path: 'index.html',
pathToServe: 'web',
nullSafety: NullSafety.sound,
);

TestContext context;

Expand All @@ -44,7 +49,7 @@ void main() {
// Enable verbose logging for debugging.
final debug = false;

for (var nullSafety in NullSafety.values) {
for (var nullSafety in supportedNullSafetyModes) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be able to run with weak null safety and 3.0.0 for a while (maybe a special flag is needed for the frontend?) so I suggest to run for all modes and skip the ones that are not working currently with a reference to an issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switched to using NullSafety.values (here and elsewhere) and skipping with a TODO

final soundNullSafety = nullSafety == NullSafety.sound;
final setup = soundNullSafety ? TestSetup.sound() : TestSetup.unsound();
final context = setup.context;
Expand All @@ -54,7 +59,6 @@ void main() {
setCurrentLogWriter(debug: debug);
await context.setUp(
compilationMode: CompilationMode.buildDaemon,
nullSafety: nullSafety,
enableExpressionEvaluation: true,
verboseCompiler: debug,
);
Expand Down
4 changes: 3 additions & 1 deletion dwds/test/build_daemon_circular_evaluate_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ import 'package:test/test.dart';
import 'fixtures/context.dart';
import 'evaluate_circular_common.dart';

import 'utils/version_compatibility.dart';

void main() async {
// Enable verbose logging for debugging.
final debug = false;

for (var nullSafety in NullSafety.values) {
for (var nullSafety in supportedNullSafetyModes) {
group('${nullSafety.name} null safety |', () {
testAll(
compilationMode: CompilationMode.buildDaemon,
Expand Down
3 changes: 2 additions & 1 deletion dwds/test/build_daemon_evaluate_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ import 'package:test/test.dart';

import 'fixtures/context.dart';
import 'evaluate_common.dart';
import 'utils/version_compatibility.dart';

void main() async {
// Enable verbose logging for debugging.
final debug = false;

for (var nullSafety in NullSafety.values) {
for (var nullSafety in supportedNullSafetyModes) {
group('${nullSafety.name} null safety |', () {
testAll(
compilationMode: CompilationMode.buildDaemon,
Expand Down
215 changes: 93 additions & 122 deletions dwds/test/chrome_proxy_service_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import 'package:dwds/src/services/chrome_proxy_service.dart';
import 'package:dwds/src/utilities/dart_uri.dart';
import 'package:http/http.dart' as http;
import 'package:path/path.dart' as path;
import 'package:pub_semver/pub_semver.dart' as semver;
import 'package:test/test.dart';
import 'package:vm_service/vm_service.dart';
import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart';
Expand Down Expand Up @@ -126,7 +125,7 @@ void main() {

test('addBreakpointWithScriptUri absolute file URI', () async {
final current = context.workingDirectory;
final test = path.join(path.dirname(current), '_test');
final test = path.join(path.dirname(current), '_testSound');
final scriptPath = Uri.parse(mainScript.uri!).path.substring(1);
final fullPath = path.join(test, scriptPath);
final fileUri = Uri.file(fullPath);
Expand Down Expand Up @@ -464,56 +463,47 @@ void main() {
expect(library1, equals(library2));
});

test(
'Classes',
() async {
final testClass = await service.getObject(
isolate.id!, rootLibrary!.classes!.first.id!) as Class;
expect(
testClass.functions,
unorderedEquals([
predicate(
(FuncRef f) => f.name == 'staticHello' && f.isStatic!),
predicate((FuncRef f) => f.name == 'message' && !f.isStatic!),
predicate((FuncRef f) => f.name == 'notFinal' && !f.isStatic!),
predicate((FuncRef f) => f.name == 'hello' && !f.isStatic!),
predicate((FuncRef f) => f.name == '_equals' && !f.isStatic!),
predicate((FuncRef f) => f.name == 'hashCode' && !f.isStatic!),
predicate((FuncRef f) => f.name == 'toString' && !f.isStatic!),
predicate(
(FuncRef f) => f.name == 'noSuchMethod' && !f.isStatic!),
predicate(
(FuncRef f) => f.name == 'runtimeType' && !f.isStatic!),
]));
expect(
testClass.fields,
unorderedEquals([
predicate((FieldRef f) =>
f.name == 'message' &&
f.declaredType != null &&
!f.isStatic! &&
!f.isConst! &&
f.isFinal!),
predicate((FieldRef f) =>
f.name == 'notFinal' &&
f.declaredType != null &&
!f.isStatic! &&
!f.isConst! &&
!f.isFinal!),
predicate((FieldRef f) =>
f.name == 'staticMessage' &&
f.declaredType != null &&
f.isStatic! &&
!f.isConst! &&
!f.isFinal!),
]));
},
// TODO(elliette): Remove once 2.15.0 is the stable release.
skip: semver.Version.parse(Platform.version.split(' ').first) >=
semver.Version.parse('2.15.0-268.18.beta')
? null
: 'SDK does not expose static member information.',
);
test('Classes', () async {
final testClass = await service.getObject(
isolate.id!, rootLibrary!.classes!.first.id!) as Class;
expect(
testClass.functions,
unorderedEquals([
predicate((FuncRef f) => f.name == 'staticHello' && f.isStatic!),
predicate((FuncRef f) => f.name == 'message' && !f.isStatic!),
predicate((FuncRef f) => f.name == 'notFinal' && !f.isStatic!),
predicate((FuncRef f) => f.name == 'hello' && !f.isStatic!),
predicate((FuncRef f) => f.name == '_equals' && !f.isStatic!),
predicate((FuncRef f) => f.name == 'hashCode' && !f.isStatic!),
predicate((FuncRef f) => f.name == 'toString' && !f.isStatic!),
predicate(
(FuncRef f) => f.name == 'noSuchMethod' && !f.isStatic!),
predicate((FuncRef f) => f.name == 'runtimeType' && !f.isStatic!),
]));
expect(
testClass.fields,
unorderedEquals([
predicate((FieldRef f) =>
f.name == 'message' &&
f.declaredType != null &&
!f.isStatic! &&
!f.isConst! &&
f.isFinal!),
predicate((FieldRef f) =>
f.name == 'notFinal' &&
f.declaredType != null &&
!f.isStatic! &&
!f.isConst! &&
!f.isFinal!),
predicate((FieldRef f) =>
f.name == 'staticMessage' &&
f.declaredType != null &&
f.isStatic! &&
!f.isConst! &&
!f.isFinal!),
]));
// TODO(https://github.com/dart-lang/webdev/issues/1818) Re-enable.
}, skip: true);

test('Runtime classes', () async {
final testClass = await service.getObject(
Expand Down Expand Up @@ -612,15 +602,6 @@ void main() {
expect(obj.valueAsString, '42');
});

test('null', () async {
final ref = await service.evaluate(
isolate.id!, bootstrap!.id!, 'helloNum(null)') as InstanceRef;
final obj = await service.getObject(isolate.id!, ref.id!) as Instance;
expect(obj.kind, InstanceKind.kNull);
expect(obj.classRef!.name, 'Null');
expect(obj.valueAsString, 'null');
});

test('Scripts', () async {
final scripts = await service.getScripts(isolate.id!);
assert(scripts.scripts!.isNotEmpty);
Expand Down Expand Up @@ -740,63 +721,53 @@ void main() {
expect(world.offset, 3);
});

test(
'offset/count parameters are ignored for Classes',
() async {
final testClass = await service.getObject(
isolate.id!,
rootLibrary!.classes!.first.id!,
offset: 100,
count: 100,
) as Class;
expect(
testClass.functions,
unorderedEquals([
predicate(
(FuncRef f) => f.name == 'staticHello' && f.isStatic!),
predicate((FuncRef f) => f.name == 'message' && !f.isStatic!),
predicate(
(FuncRef f) => f.name == 'notFinal' && !f.isStatic!),
predicate((FuncRef f) => f.name == 'hello' && !f.isStatic!),
predicate((FuncRef f) => f.name == '_equals' && !f.isStatic!),
predicate(
(FuncRef f) => f.name == 'hashCode' && !f.isStatic!),
predicate(
(FuncRef f) => f.name == 'toString' && !f.isStatic!),
predicate(
(FuncRef f) => f.name == 'noSuchMethod' && !f.isStatic!),
predicate(
(FuncRef f) => f.name == 'runtimeType' && !f.isStatic!),
]));
expect(
testClass.fields,
unorderedEquals([
predicate((FieldRef f) =>
f.name == 'message' &&
f.declaredType != null &&
!f.isStatic! &&
!f.isConst! &&
f.isFinal!),
predicate((FieldRef f) =>
f.name == 'notFinal' &&
f.declaredType != null &&
!f.isStatic! &&
!f.isConst! &&
!f.isFinal!),
predicate((FieldRef f) =>
f.name == 'staticMessage' &&
f.declaredType != null &&
f.isStatic! &&
!f.isConst! &&
!f.isFinal!),
]));
},
// TODO(elliette): Remove once 2.15.0 is the stable release.
skip: semver.Version.parse(Platform.version.split(' ').first) >=
semver.Version.parse('2.15.0-268.18.beta')
? null
: 'SDK does not expose static member information.',
);
test('offset/count parameters are ignored for Classes', () async {
final testClass = await service.getObject(
isolate.id!,
rootLibrary!.classes!.first.id!,
offset: 100,
count: 100,
) as Class;
expect(
testClass.functions,
unorderedEquals([
predicate(
(FuncRef f) => f.name == 'staticHello' && f.isStatic!),
predicate((FuncRef f) => f.name == 'message' && !f.isStatic!),
predicate((FuncRef f) => f.name == 'notFinal' && !f.isStatic!),
predicate((FuncRef f) => f.name == 'hello' && !f.isStatic!),
predicate((FuncRef f) => f.name == '_equals' && !f.isStatic!),
predicate((FuncRef f) => f.name == 'hashCode' && !f.isStatic!),
predicate((FuncRef f) => f.name == 'toString' && !f.isStatic!),
predicate(
(FuncRef f) => f.name == 'noSuchMethod' && !f.isStatic!),
predicate(
(FuncRef f) => f.name == 'runtimeType' && !f.isStatic!),
]));
expect(
testClass.fields,
unorderedEquals([
predicate((FieldRef f) =>
f.name == 'message' &&
f.declaredType != null &&
!f.isStatic! &&
!f.isConst! &&
f.isFinal!),
predicate((FieldRef f) =>
f.name == 'notFinal' &&
f.declaredType != null &&
!f.isStatic! &&
!f.isConst! &&
!f.isFinal!),
predicate((FieldRef f) =>
f.name == 'staticMessage' &&
f.declaredType != null &&
f.isStatic! &&
!f.isConst! &&
!f.isFinal!),
]));
// TODO(https://github.com/dart-lang/webdev/issues/1818) Re-enable.
}, skip: true);

test('offset/count parameters are ignored for bools', () async {
final ref = await service.evaluate(
Expand Down Expand Up @@ -838,7 +809,7 @@ void main() {
expect(obj.kind, InstanceKind.kNull);
expect(obj.classRef!.name, 'Null');
expect(obj.valueAsString, 'null');
});
}, skip: true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add issue reference?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, done!

});
});

Expand All @@ -860,8 +831,8 @@ void main() {

// Containts part files as well.
expect(scriptUris, contains(endsWith('part.dart')));
expect(scriptUris,
contains('package:intl/src/intl/date_format_helpers.dart'));
expect(
scriptUris, contains('package:intl/src/date_format_internal.dart'));
});

group('getSourceReport', () {
Expand Down Expand Up @@ -1368,7 +1339,7 @@ void main() {
expect(
resolvedUris.uris,
containsAll([
contains('/_test/example/hello_world/main.dart'),
contains('/_testSound/example/hello_world/main.dart'),
contains('/lib/path.dart'),
contains('/lib/src/path_set.dart'),
]));
Expand Down
14 changes: 9 additions & 5 deletions dwds/test/dart_uri_file_uri_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ import 'package:path/path.dart' as p;
import 'package:test/test.dart';

import 'fixtures/context.dart';
import 'utils/version_compatibility.dart';

final context = TestContext(
directory: p.join('..', 'fixtures', '_testPackage'),
entry: p.join('..', 'fixtures', '_testPackage', 'web', 'main.dart'),
path: 'index.html',
pathToServe: 'web');
directory: p.join('..', 'fixtures', '_testPackage'),
entry: p.join('..', 'fixtures', '_testPackage', 'web', 'main.dart'),
path: 'index.html',
pathToServe: 'web',
nullSafety: NullSafety.weak,
);

final dwdsDir = Directory.current.absolute.path;

Expand Down Expand Up @@ -84,6 +87,7 @@ void main() {
});
});
}
});
// TODO(https://github.com/dart-lang/webdev/issues/1818): Re-enable.
}, skip: !versionSupportsWeakNullSafety);
}
}
Loading