Skip to content

Commit

Permalink
Use TestOn
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartmorgan committed Sep 17, 2020
1 parent 7d46f63 commit 80a0b6a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions packages/path_provider/path_provider_windows/pubspec.yaml
Expand Up @@ -23,6 +23,7 @@ dev_dependencies:
flutter_test:
sdk: flutter
pedantic: ^1.8.0
test: any

environment:
sdk: ">=2.1.0 <3.0.0"
Expand Down
@@ -1,11 +1,11 @@
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@TestOn('windows')
import 'dart:ffi';
import 'dart:io';

import 'package:flutter_test/flutter_test.dart';
import 'package:path_provider_windows/path_provider_windows.dart';
import 'package:test/test.dart';

// A fake VersionInfoQuerier that just returns preset responses.
class FakeVersionInfoQuerier implements VersionInfoQuerier {
Expand All @@ -20,7 +20,7 @@ void main() {
test('getTemporaryPath', () async {
final pathProvider = PathProviderWindows();
expect(await pathProvider.getTemporaryPath(), contains(r'C:\'));
}, skip: !Platform.isWindows);
});

test('getApplicationSupportPath with no version info', () async {
final pathProvider = PathProviderWindows();
Expand All @@ -31,7 +31,7 @@ void main() {
expect(path, contains(r'AppData'));
// The last path component should be the executable name.
expect(path, endsWith(r'flutter_tester'));
}, skip: !Platform.isWindows);
});

test('getApplicationSupportPath with full version info', () async {
final pathProvider = PathProviderWindows();
Expand All @@ -41,7 +41,7 @@ void main() {
});
final path = await pathProvider.getApplicationSupportPath();
expect(path, endsWith(r'AppData\Roaming\A Company\Amazing App'));
}, skip: !Platform.isWindows);
});

test('getApplicationSupportPath with missing company', () async {
final pathProvider = PathProviderWindows();
Expand All @@ -50,7 +50,7 @@ void main() {
});
final path = await pathProvider.getApplicationSupportPath();
expect(path, endsWith(r'AppData\Roaming\Amazing App'));
}, skip: !Platform.isWindows);
});

test('getApplicationSupportPath with problematic values', () async {
final pathProvider = PathProviderWindows();
Expand All @@ -64,7 +64,7 @@ void main() {
endsWith(r'AppData\Roaming\'
r'A _Bad_ Company_ Name\'
r'A__Terrible__App__Name'));
}, skip: !Platform.isWindows);
});

test('getApplicationSupportPath with a completely invalid company', () async {
final pathProvider = PathProviderWindows();
Expand All @@ -74,19 +74,19 @@ void main() {
});
final path = await pathProvider.getApplicationSupportPath();
expect(path, endsWith(r'AppData\Roaming\Amazing App'));
}, skip: !Platform.isWindows);
});

test('getApplicationDocumentsPath', () async {
final pathProvider = PathProviderWindows();
final path = await pathProvider.getApplicationDocumentsPath();
expect(path, contains(r'C:\'));
expect(path, contains(r'Documents'));
}, skip: !Platform.isWindows);
});

test('getDownloadsPath', () async {
final pathProvider = PathProviderWindows();
final path = await pathProvider.getDownloadsPath();
expect(path, contains(r'C:\'));
expect(path, contains(r'Downloads'));
}, skip: !Platform.isWindows);
});
}

0 comments on commit 80a0b6a

Please sign in to comment.