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
diff --git a/.github/workflows/test-package.yml b/.github/workflows/test-package.yml
index 2e47591..1768fc8 100644
--- a/.github/workflows/test-package.yml
+++ b/.github/workflows/test-package.yml
@@ -45,8 +45,7 @@
strategy:
fail-fast: false
matrix:
- # Add macos-latest and/or windows-latest if relevant for this package.
- os: [ubuntu-latest]
+ os: [ubuntu-latest, windows-latest]
sdk: [3.2, dev]
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
@@ -57,5 +56,5 @@
name: Install dependencies
run: dart pub get
- name: Run tests
- run: dart run build_runner test -- -p chrome,vm
+ run: dart test -p chrome,vm
if: always() && steps.install.outcome == 'success'
diff --git a/pubspec.yaml b/pubspec.yaml
index b713079..6ac7f54 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -10,8 +10,5 @@
path: ^1.8.0
dev_dependencies:
- build_runner: ^2.0.0
- build_test: ^2.1.2
- build_web_compilers: ^4.0.0
dart_flutter_team_lints: ^2.0.0
test: ^1.16.0
diff --git a/test/discovery_test.dart b/test/discovery_test.dart
index ee77559..2ca337a 100644
--- a/test/discovery_test.dart
+++ b/test/discovery_test.dart
@@ -59,7 +59,7 @@
fileTest('package_config.json', {
'.packages': 'invalid .packages file',
'script.dart': 'main(){}',
- 'packages': {'shouldNotBeFound': <Never>{}},
+ 'packages': {'shouldNotBeFound': <Never, Never>{}},
'.dart_tool': {
'package_config.json': packageConfigFile,
}
diff --git a/test/parse_test.dart b/test/parse_test.dart
index 402fe8c..a92b9bf 100644
--- a/test/parse_test.dart
+++ b/test/parse_test.dart
@@ -301,6 +301,25 @@
Uri.parse('package:qux/diz'));
});
+ test('packageOf is case sensitive on windows', () {
+ var configBytes = utf8.encode(json.encode({
+ 'configVersion': 2,
+ 'packages': [
+ {'name': 'foo', 'rootUri': 'file:///C:/Foo/', 'packageUri': 'lib/'},
+ ]
+ }));
+ var config = parsePackageConfigBytes(
+ // ignore: unnecessary_cast
+ configBytes as Uint8List,
+ Uri.parse('file:///C:/tmp/.dart_tool/file.dart'),
+ throwError);
+ expect(config.version, 2);
+ expect(
+ config.packageOf(Uri.parse('file:///C:/foo/lala/lala.dart')), null);
+ expect(config.packageOf(Uri.parse('file:///C:/Foo/lala/lala.dart'))!.name,
+ 'foo');
+ });
+
group('invalid', () {
void testThrows(String name, String source) {
test(name, () {