Skip to content

Commit 627428b

Browse files
committed
Test for actual resolved ref in test
1 parent f114bb2 commit 627428b

File tree

1 file changed

+48
-2
lines changed

1 file changed

+48
-2
lines changed

test/get/git/tag_pattern_test.dart

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ void main() {
381381
);
382382

383383
test(
384-
'Multiple path dependencies to same package work (regression https://github.com/dart-lang/pub/issues/4706)',
384+
'multiple path dependencies to same package work (regression https://github.com/dart-lang/pub/issues/4706)',
385385
() async {
386386
await d.git('foo.git', [
387387
d.dir('one', [
@@ -407,7 +407,9 @@ void main() {
407407
]),
408408
d.dir('three', [d.libPubspec('three', '1.0.0', sdk: '^3.9.0')]),
409409
]).create();
410-
await d.git('foo.git', []).tag('1.0.0');
410+
final g = d.git('foo.git', []);
411+
await g.tag('1.0.0');
412+
final ref = await g.revParse('HEAD');
411413

412414
await d
413415
.appDir(
@@ -435,6 +437,50 @@ void main() {
435437
),
436438
environment: {'_PUB_TEST_SDK_VERSION': '3.9.0'},
437439
);
440+
final lockfile =
441+
loadYaml(
442+
File(
443+
p.join(d.sandbox, appPath, 'pubspec.lock'),
444+
).readAsStringSync(),
445+
)
446+
as Map;
447+
final packages = lockfile['packages'] as Map;
448+
final one = packages['one'];
449+
expect(one, {
450+
'dependency': 'direct main',
451+
'description': {
452+
'path': 'one',
453+
'resolved-ref': ref,
454+
'tag-pattern': '{{version}}',
455+
'url': '../foo.git',
456+
},
457+
'source': 'git',
458+
'version': '1.0.0',
459+
});
460+
final two = packages['two'];
461+
expect(two, {
462+
'dependency': 'transitive',
463+
'description': {
464+
'path': 'two',
465+
'resolved-ref': ref,
466+
'tag-pattern': '{{version}}',
467+
'url': '../foo.git',
468+
},
469+
'source': 'git',
470+
'version': '1.0.0',
471+
});
472+
final three = packages['three'];
473+
expect(three, {
474+
'dependency': 'transitive',
475+
'description': {
476+
'path': 'three',
477+
'resolved-ref': ref,
478+
'tag-pattern': '{{version}}',
479+
'url': '../foo.git',
480+
},
481+
'source': 'git',
482+
'version': '1.0.0',
483+
});
438484
},
439485
);
440486
}

0 commit comments

Comments
 (0)