-
Notifications
You must be signed in to change notification settings - Fork 85
Implement lookupResolvedPackageUris and lookupPackageUris #1458
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
Changes from 4 commits
929d0e3
ef119fd
9f42b2d
f231083
d2bdccb
9d0183e
c00616e
62d51c2
c07b3e1
1912afe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1261,6 +1261,99 @@ void main() { | |
service.getRetainingPath(null, null, null), throwsRPCError); | ||
}); | ||
|
||
test('lookupResolvedPackageUris converts package and org-dartlang-app uris', | ||
() async { | ||
var vm = await service.getVM(); | ||
var isolateId = vm.isolates.first.id; | ||
var scriptList = await service.getScripts(isolateId); | ||
|
||
var uris = [...scriptList.scripts.map((e) => e.uri)]; | ||
annagrin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
var resolvedUris = | ||
await service.lookupResolvedPackageUris(isolateId, uris); | ||
|
||
expect( | ||
resolvedUris.uris, | ||
containsAll([ | ||
contains('/_test/example/hello_world/main.dart'), | ||
contains('/lib/path.dart'), | ||
contains('/lib/src/path_set.dart'), | ||
])); | ||
Comment on lines
+1310
to
+1314
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm a little confused why expectation needs There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. containsAll matches the array, and the nested contains match the elements. I like that our matches allow that! |
||
}); | ||
|
||
test('lookupResolvedPackageUris does not translate non-exsitent paths', | ||
annagrin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
() async { | ||
var vm = await service.getVM(); | ||
var isolateId = vm.isolates.first.id; | ||
|
||
var resolvedUris = await service.lookupResolvedPackageUris(isolateId, [ | ||
'dart:io', // dart:io is not imported | ||
'does_not_exist.dart', | ||
]); | ||
expect(resolvedUris.uris, [null, null]); | ||
}); | ||
|
||
test('lookupResolvedPackageUris translates dart uris', () async { | ||
var vm = await service.getVM(); | ||
var isolateId = vm.isolates.first.id; | ||
|
||
var resolvedUris = await service.lookupResolvedPackageUris(isolateId, [ | ||
'dart:html', | ||
'dart:async', | ||
]); | ||
|
||
expect(resolvedUris.uris, [ | ||
'org-dartlang-sdk:///sdk/lib/html/html.dart', | ||
'org-dartlang-sdk:///sdk/lib/async/async.dart', | ||
]); | ||
}, skip: 'https://github.com/dart-lang/webdev/issues/1457'); | ||
|
||
test('lookupPackageUris finds package and org-dartlang-app paths', | ||
() async { | ||
var vm = await service.getVM(); | ||
var isolateId = vm.isolates.first.id; | ||
var scriptList = await service.getScripts(isolateId); | ||
|
||
var uris = [...scriptList.scripts.map((e) => e.uri)]; | ||
annagrin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
var resolvedUris = | ||
await service.lookupResolvedPackageUris(isolateId, uris); | ||
|
||
var packageUris = await service.lookupPackageUris( | ||
isolateId, resolvedUris.uris as List<String>); | ||
expect( | ||
packageUris.uris, | ||
containsAll([ | ||
'org-dartlang-app:///example/hello_world/main.dart', | ||
'package:path/path.dart', | ||
'package:path/src/path_set.dart', | ||
])); | ||
}); | ||
|
||
test('lookupPackageUris does not translate non-exsitent paths', () async { | ||
var vm = await service.getVM(); | ||
var isolateId = vm.isolates.first.id; | ||
|
||
var resolvedUris = await service.lookupPackageUris(isolateId, [ | ||
'org-dartlang-sdk:///sdk/lib/io/io.dart', // dart:io is not imported | ||
'does_not_exist.dart', | ||
]); | ||
expect(resolvedUris.uris, [null, null]); | ||
}); | ||
|
||
test('lookupPackageUris translates dart uris', () async { | ||
var vm = await service.getVM(); | ||
var isolateId = vm.isolates.first.id; | ||
|
||
var resolvedUris = await service.lookupPackageUris(isolateId, [ | ||
'org-dartlang-sdk:///sdk/lib/html/html.dart', | ||
'org-dartlang-sdk:///sdk/lib/async/async.dart', | ||
]); | ||
|
||
expect(resolvedUris.uris, [ | ||
'dart:html', | ||
'dart:async', | ||
]); | ||
}, skip: 'https://github.com/dart-lang/webdev/issues/1457'); | ||
|
||
test('registerService', () async { | ||
await expectLater( | ||
service.registerService('ext.foo.bar', null), throwsRPCError); | ||
|
Uh oh!
There was an error while loading. Please reload this page.