Skip to content

Commit 9084e1d

Browse files
authored
[record_use] Update test data to package: URIs and cleanup dart2js tests (dart-lang#3077)
1 parent 4689b4b commit 9084e1d

61 files changed

Lines changed: 394 additions & 1190 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎pkgs/record_use/test/semantic_equality_golden_test.dart‎

Lines changed: 0 additions & 85 deletions
This file was deleted.

‎pkgs/record_use/test/test_data.dart‎

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,13 @@
55
import 'package:pub_semver/pub_semver.dart';
66
import 'package:record_use/record_use_internal.dart';
77

8-
final callId = Identifier(
9-
importUri: Uri.parse(
10-
'file://lib/_internal/js_runtime/lib/js_helper.dart',
11-
).toString(),
8+
const callId = Identifier(
9+
importUri: 'package:js_runtime/js_helper.dart',
1210
scope: 'MyClass',
1311
name: 'get:loadDeferredLibrary',
1412
);
15-
final instanceId = Identifier(
16-
importUri: Uri.parse(
17-
'file://lib/_internal/js_runtime/lib/js_helper.dart',
18-
).toString(),
13+
const instanceId = Identifier(
14+
importUri: 'package:js_runtime/js_helper.dart',
1915
name: 'MyAnnotation',
2016
);
2117

@@ -198,7 +194,7 @@ const recordedUsesJson = '''{
198194
"recordings": [
199195
{
200196
"identifier": {
201-
"uri": "file://lib/_internal/js_runtime/lib/js_helper.dart",
197+
"uri": "package:js_runtime/js_helper.dart",
202198
"scope": "MyClass",
203199
"name": "get:loadDeferredLibrary"
204200
},
@@ -233,7 +229,7 @@ const recordedUsesJson = '''{
233229
},
234230
{
235231
"identifier": {
236-
"uri": "file://lib/_internal/js_runtime/lib/js_helper.dart",
232+
"uri": "package:js_runtime/js_helper.dart",
237233
"name": "MyAnnotation"
238234
},
239235
"instances": [
@@ -278,7 +274,7 @@ const recordedUsesJson2 = '''{
278274
"recordings": [
279275
{
280276
"identifier": {
281-
"uri": "file://lib/_internal/js_runtime/lib/js_helper.dart",
277+
"uri": "package:js_runtime/js_helper.dart",
282278
"scope": "MyClass",
283279
"name": "get:loadDeferredLibrary"
284280
},

‎pkgs/record_use/test/usage_test.dart‎

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@ void main() {
1616
jsonDecode(recordedUsesJson) as Map<String, Object?>,
1717
)
1818
.constArgumentsFor(
19-
Identifier(
20-
importUri: Uri.parse(
21-
'file://lib/_internal/js_runtime/lib/js_helper.dart',
22-
).toString(),
19+
const Identifier(
20+
importUri: 'package:js_runtime/js_helper.dart',
2321
scope: 'MyClass',
2422
name: 'get:loadDeferredLibrary',
2523
),
@@ -35,10 +33,8 @@ void main() {
3533
jsonDecode(recordedUsesJson) as Map<String, Object?>,
3634
)
3735
.constantsOf(
38-
Identifier(
39-
importUri: Uri.parse(
40-
'file://lib/_internal/js_runtime/lib/js_helper.dart',
41-
).toString(),
36+
const Identifier(
37+
importUri: 'package:js_runtime/js_helper.dart',
4238
name: 'MyAnnotation',
4339
),
4440
)
@@ -58,10 +54,8 @@ void main() {
5854
jsonDecode(recordedUsesJson) as Map<String, Object?>,
5955
)
6056
.constArgumentsFor(
61-
Identifier(
62-
importUri: Uri.parse(
63-
'file://lib/_internal/js_runtime/lib/js_helper.dart',
64-
).toString(),
57+
const Identifier(
58+
importUri: 'package:js_runtime/js_helper.dart',
6559
scope: 'MyClass',
6660
name: 'get:loadDeferredLibrary',
6761
),
@@ -95,10 +89,8 @@ void main() {
9589
jsonDecode(recordedUsesJson) as Map<String, Object?>,
9690
)
9791
.constantsOf(
98-
Identifier(
99-
importUri: Uri.parse(
100-
'file://lib/_internal/js_runtime/lib/js_helper.dart',
101-
).toString(),
92+
const Identifier(
93+
importUri: 'package:js_runtime/js_helper.dart',
10294
name: 'MyAnnotation',
10395
),
10496
)
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"$schema": "../../doc/schema/record_use.schema.json",
3+
"constants": [
4+
{
5+
"type": "int",
6+
"value": 99
7+
}
8+
],
9+
"metadata": {
10+
"comment": "Recorded usages of objects tagged with a `RecordUse` annotation",
11+
"version": "0.4.0"
12+
},
13+
"recordings": [
14+
{
15+
"calls": [
16+
{
17+
"loading_unit": "1",
18+
"positional": [
19+
0
20+
],
21+
"type": "with_arguments"
22+
}
23+
],
24+
"identifier": {
25+
"name": "someStaticMethod2",
26+
"scope": "SomeClass",
27+
"uri": "package:record_use_test/basic.dart"
28+
}
29+
}
30+
]
31+
}

‎pkgs/record_use/test_data/json/complex.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"identifier": {
2929
"name": "generate",
3030
"scope": "OtherClass",
31-
"uri": "complex.dart"
31+
"uri": "package:record_use_test/complex.dart"
3232
}
3333
}
3434
]
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"$schema": "../../doc/schema/record_use.schema.json",
3+
"constants": [
4+
{
5+
"type": "int",
6+
"value": 14
7+
},
8+
{
9+
"type": "instance",
10+
"value": {
11+
"i": 0
12+
}
13+
}
14+
],
15+
"metadata": {
16+
"comment": "Recorded usages of objects tagged with a `RecordUse` annotation",
17+
"version": "0.4.0"
18+
},
19+
"recordings": [
20+
{
21+
"calls": [
22+
{
23+
"loading_unit": "1",
24+
"positional": [
25+
1
26+
],
27+
"type": "with_arguments"
28+
}
29+
],
30+
"identifier": {
31+
"name": "someStaticMethod2",
32+
"uri": "package:record_use_test/const_argument_instance.dart"
33+
}
34+
}
35+
]
36+
}

‎pkgs/record_use/test_data/json/constructor_invocation.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
{
2323
"identifier": {
2424
"name": "MyClass",
25-
"uri": "package:test/test.dart"
25+
"uri": "package:record_use_test/test.dart"
2626
},
2727
"instances": [
2828
{
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"$schema": "../../doc/schema/record_use.schema.json",
3+
"constants": [
4+
{
5+
"type": "int",
6+
"value": 1
7+
},
8+
{
9+
"type": "string",
10+
"value": "b"
11+
},
12+
{
13+
"type": "instance",
14+
"value": {
15+
"index": 0,
16+
"_name": 1
17+
}
18+
}
19+
],
20+
"metadata": {
21+
"comment": "Recorded usages of objects tagged with a `RecordUse` annotation",
22+
"version": "0.4.0"
23+
},
24+
"recordings": [
25+
{
26+
"calls": [
27+
{
28+
"loading_unit": "1",
29+
"positional": [
30+
2
31+
],
32+
"type": "with_arguments"
33+
}
34+
],
35+
"identifier": {
36+
"name": "doSomething",
37+
"uri": "package:record_use_test/enum_const_arg.dart"
38+
}
39+
}
40+
]
41+
}

‎pkgs/record_use/test_data/json/extension.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
],
2424
"identifier": {
2525
"name": "_extension#0|callWithArgs",
26-
"uri": "extension.dart"
26+
"uri": "package:record_use_test/extension.dart"
2727
}
2828
}
2929
]

‎pkgs/record_use/test_data/json/instance_class.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
{
2121
"identifier": {
2222
"name": "MyClass",
23-
"uri": "instance_class.dart"
23+
"uri": "package:record_use_test/instance_class.dart"
2424
},
2525
"instances": [
2626
{

0 commit comments

Comments
 (0)