Skip to content

Commit e9727d9

Browse files
authored
Fix path-matching expression in validators (#4116)
1 parent dce232e commit e9727d9

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

lib/src/validator.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ abstract class Validator {
219219
return files
220220
.where(
221221
recursive
222-
? (file) => p.canonicalize(file).startsWith(base)
222+
? (file) => p.isWithin(base, p.canonicalize(file))
223223
: (file) => p.canonicalize(p.dirname(file)) == base,
224224
)
225225
.toList();

test/validator/strict_dependencies_test.dart

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,25 @@ void main() {
5555
await expectValidationDeprecated(strictDeps);
5656
});
5757

58+
// Regression test of https://github.com/dart-lang/pub/issues/4115 .
59+
test('imports a dev_dependency in bindings_generator/', () async {
60+
await d.dir(appPath, [
61+
d.libPubspec(
62+
'test_pkg',
63+
'1.0.0',
64+
devDeps: {'silly_monkey': '^1.2.3'},
65+
sdk: '>=1.8.0 <2.0.0',
66+
),
67+
d.dir('bindings_generator', [
68+
d.file('library.dart', r'''
69+
export 'package:silly_monkey/silly_monkey.dart';
70+
'''),
71+
]),
72+
]).create();
73+
74+
await expectValidationDeprecated(strictDeps);
75+
});
76+
5877
test('declares an "import" as a dependency in bin/', () async {
5978
await d.dir(appPath, [
6079
d.libPubspec(

0 commit comments

Comments
 (0)