Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Commit 5a0bc19

Browse files
authored
add test validating current behavior of packageOf, run CI on windows (#137)
- validates the behavior of https://github.com/dart-lang/package_config/issues/136 today (but does not change it) - removes build_runner deps for testing, there is no need to use it for such a small package - fixes a bug in discovery_test.dart that was probably landed due to inability to run tests
1 parent 3e7d93c commit 5a0bc19

File tree

4 files changed

+22
-7
lines changed

4 files changed

+22
-7
lines changed

.github/workflows/test-package.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ jobs:
4545
strategy:
4646
fail-fast: false
4747
matrix:
48-
# Add macos-latest and/or windows-latest if relevant for this package.
49-
os: [ubuntu-latest]
48+
os: [ubuntu-latest, windows-latest]
5049
sdk: [3.2, dev]
5150
steps:
5251
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
@@ -57,5 +56,5 @@ jobs:
5756
name: Install dependencies
5857
run: dart pub get
5958
- name: Run tests
60-
run: dart run build_runner test -- -p chrome,vm
59+
run: dart test -p chrome,vm
6160
if: always() && steps.install.outcome == 'success'

pubspec.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,5 @@ dependencies:
1010
path: ^1.8.0
1111

1212
dev_dependencies:
13-
build_runner: ^2.0.0
14-
build_test: ^2.1.2
15-
build_web_compilers: ^4.0.0
1613
dart_flutter_team_lints: ^2.0.0
1714
test: ^1.16.0

test/discovery_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ void main() {
5959
fileTest('package_config.json', {
6060
'.packages': 'invalid .packages file',
6161
'script.dart': 'main(){}',
62-
'packages': {'shouldNotBeFound': <Never>{}},
62+
'packages': {'shouldNotBeFound': <Never, Never>{}},
6363
'.dart_tool': {
6464
'package_config.json': packageConfigFile,
6565
}

test/parse_test.dart

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,25 @@ void main() {
301301
Uri.parse('package:qux/diz'));
302302
});
303303

304+
test('packageOf is case sensitive on windows', () {
305+
var configBytes = utf8.encode(json.encode({
306+
'configVersion': 2,
307+
'packages': [
308+
{'name': 'foo', 'rootUri': 'file:///C:/Foo/', 'packageUri': 'lib/'},
309+
]
310+
}));
311+
var config = parsePackageConfigBytes(
312+
// ignore: unnecessary_cast
313+
configBytes as Uint8List,
314+
Uri.parse('file:///C:/tmp/.dart_tool/file.dart'),
315+
throwError);
316+
expect(config.version, 2);
317+
expect(
318+
config.packageOf(Uri.parse('file:///C:/foo/lala/lala.dart')), null);
319+
expect(config.packageOf(Uri.parse('file:///C:/Foo/lala/lala.dart'))!.name,
320+
'foo');
321+
});
322+
304323
group('invalid', () {
305324
void testThrows(String name, String source) {
306325
test(name, () {

0 commit comments

Comments
 (0)