Skip to content

Commit cb75ab5

Browse files
authored
Glob escape testBuilder asset paths. (#4059)
1 parent b689183 commit cb75ab5

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

build_test/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 3.1.1-wip
2+
3+
- Bug fix: stop parsing `testBuilder` asset paths as globs.
4+
15
## 3.1.0
26

37
- Add `inputsTrackedFor` and `resolverEntrypointsTrackedFor` to

build_test/lib/src/test_builder.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import 'package:build_resolvers/build_resolvers.dart';
1111
import 'package:build_runner_core/build_runner_core.dart';
1212
// ignore: implementation_imports
1313
import 'package:build_runner_core/src/generate/build_series.dart';
14+
import 'package:glob/glob.dart';
1415
import 'package:logging/logging.dart';
1516
import 'package:package_config/package_config.dart';
1617
import 'package:test/test.dart';
@@ -312,7 +313,7 @@ Future<TestBuilderResult> testBuilders(
312313
r'web/$web$',
313314
...inputIds
314315
.where((id) => id.package == package)
315-
.map((id) => id.path),
316+
.map((id) => Glob.quote(id.path)),
316317
],
317318
},
318319
},

build_test/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: build_test
22
description: Utilities for writing unit tests of Builders.
3-
version: 3.1.0
3+
version: 3.1.1-wip
44
repository: https://github.com/dart-lang/build/tree/master/build_test
55
resolution: workspace
66

build_test/test/test_builder_test.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,18 @@ Future<void> main() async {
356356
outputs: {'a|foo.out': 'new input'},
357357
);
358358
});
359+
360+
test('input paths are not parsed as globs', () {
361+
return testBuilder(
362+
TestBuilder(
363+
buildExtensions: {
364+
'.in': ['.out'],
365+
},
366+
),
367+
{'a|[.in': 'input'},
368+
outputs: {'a|[.out': 'input'},
369+
);
370+
});
359371
}
360372

361373
/// Concatenates the contents of multiple text files into a single output.

0 commit comments

Comments
 (0)