General cleanup (#25)
* Re-enable Windows tests
* Update analysis options
* Remove deprecated member access
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8973425..8b892ad 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+#### 3.0.1
+
+* General cleanup
+
#### 3.0.0
* Cleanup getExecutablePath() to better respect the platform
diff --git a/analysis_options.yaml b/analysis_options.yaml
index 9f8e801..d235544 100644
--- a/analysis_options.yaml
+++ b/analysis_options.yaml
@@ -1,9 +1,11 @@
analyzer:
language:
- enableStrictCallChecks: true
enableSuperMixins: true
- strong-mode: true
+ strong-mode:
+ implicit-dynamic: false
errors:
+ missing_required_param: warning
+ missing_return: warning
# Allow having TODOs in the code
todo: ignore
@@ -60,7 +62,7 @@
- type_annotate_public_apis
- type_init_formals
- unawaited_futures
- - unnecessary_brace_in_string_interp
+ - unnecessary_brace_in_string_interps
- unnecessary_getters_setters
# === pub rules ===
diff --git a/lib/src/interface/common.dart b/lib/src/interface/common.dart
index c115332..26fcf74 100644
--- a/lib/src/interface/common.dart
+++ b/lib/src/interface/common.dart
@@ -4,7 +4,7 @@
import 'package:file/file.dart';
import 'package:file/local.dart';
-import 'package:path/path.dart' show Context, Style;
+import 'package:path/path.dart' show Context;
import 'package:platform/platform.dart';
const Map<String, String> _osToPathStyle = const <String, String>{
diff --git a/lib/src/record_replay/replay_process_manager.dart b/lib/src/record_replay/replay_process_manager.dart
index 0390ec0..1e157ab 100644
--- a/lib/src/record_replay/replay_process_manager.dart
+++ b/lib/src/record_replay/replay_process_manager.dart
@@ -61,7 +61,7 @@
/// start listening.
static Future<ReplayProcessManager> create(
Directory location, {
- Duration streamDelay: Duration.ZERO,
+ Duration streamDelay: Duration.zero,
}) async {
assert(streamDelay != null);
diff --git a/pubspec.yaml b/pubspec.yaml
index a70deb8..5c737d0 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
name: process
-version: 3.0.0
+version: 3.0.1
authors:
- Todd Volkert <tvolkert@google.com>
- Michael Goderbauer <goderbauer@google.com>
diff --git a/test/record_test.dart b/test/record_test.dart
index a94984d..a8cbaa2 100644
--- a/test/record_test.dart
+++ b/test/record_test.dart
@@ -143,7 +143,7 @@
_Recording(this.dir);
List<Map<String, dynamic>> get manifest {
- return JSON.decoder.convert(_getFileContent('MANIFEST.txt', UTF8));
+ return json.decoder.convert(_getFileContent('MANIFEST.txt', utf8));
}
dynamic stdoutForEntryAt(int index) =>
diff --git a/test/src/interface/common_test.dart b/test/src/interface/common_test.dart
index ba2bc5d..77480e5 100644
--- a/test/src/interface/common_test.dart
+++ b/test/src/interface/common_test.dart
@@ -4,7 +4,6 @@
import 'package:file/file.dart';
import 'package:file/memory.dart';
-import 'package:path/path.dart' as p;
import 'package:platform/platform.dart';
import 'package:process/src/interface/common.dart';
import 'package:test/test.dart';
@@ -14,13 +13,15 @@
FileSystem fs;
Directory workingDir, dir1, dir2, dir3;
- setUp(() {
- fs = new MemoryFileSystem();
- workingDir = fs.systemTempDirectory.createTempSync('work_dir_');
- dir1 = fs.systemTempDirectory.createTempSync('dir1_');
- dir2 = fs.systemTempDirectory.createTempSync('dir2_');
- dir3 = fs.systemTempDirectory.createTempSync('dir3_');
- });
+ void initialize(FileSystemStyle style) {
+ setUp(() {
+ fs = new MemoryFileSystem(style: style);
+ workingDir = fs.systemTempDirectory.createTempSync('work_dir_');
+ dir1 = fs.systemTempDirectory.createTempSync('dir1_');
+ dir2 = fs.systemTempDirectory.createTempSync('dir2_');
+ dir3 = fs.systemTempDirectory.createTempSync('dir3_');
+ });
+ }
tearDown(() {
<Directory>[workingDir, dir1, dir2, dir3]
@@ -30,6 +31,8 @@
group('on windows', () {
Platform platform;
+ initialize(FileSystemStyle.windows);
+
setUp(() {
platform = new FakePlatform(
operatingSystem: 'windows',
@@ -41,7 +44,7 @@
});
test('absolute', () {
- String command = p.join(dir3.path, 'bla.exe');
+ String command = fs.path.join(dir3.path, 'bla.exe');
String expectedPath = command;
fs.file(command).createSync();
@@ -53,7 +56,7 @@
);
_expectSamePath(executablePath, expectedPath);
- command = p.withoutExtension(command);
+ command = fs.path.withoutExtension(command);
executablePath = getExecutablePath(
command,
workingDir.path,
@@ -65,7 +68,7 @@
test('in path', () {
String command = 'bla.exe';
- String expectedPath = p.join(dir2.path, command);
+ String expectedPath = fs.path.join(dir2.path, command);
fs.file(expectedPath).createSync();
String executablePath = getExecutablePath(
@@ -76,7 +79,7 @@
);
_expectSamePath(executablePath, expectedPath);
- command = p.withoutExtension(command);
+ command = fs.path.withoutExtension(command);
executablePath = getExecutablePath(
command,
workingDir.path,
@@ -88,8 +91,8 @@
test('in path multiple times', () {
String command = 'bla.exe';
- String expectedPath = p.join(dir1.path, command);
- String wrongPath = p.join(dir2.path, command);
+ String expectedPath = fs.path.join(dir1.path, command);
+ String wrongPath = fs.path.join(dir2.path, command);
fs.file(expectedPath).createSync();
fs.file(wrongPath).createSync();
@@ -101,7 +104,7 @@
);
_expectSamePath(executablePath, expectedPath);
- command = p.withoutExtension(command);
+ command = fs.path.withoutExtension(command);
executablePath = getExecutablePath(
command,
workingDir.path,
@@ -112,8 +115,8 @@
});
test('in subdir of work dir', () {
- String command = p.join('.', 'foo', 'bla.exe');
- String expectedPath = p.join(workingDir.path, command);
+ String command = fs.path.join('.', 'foo', 'bla.exe');
+ String expectedPath = fs.path.join(workingDir.path, command);
fs.file(expectedPath).createSync(recursive: true);
String executablePath = getExecutablePath(
@@ -124,7 +127,7 @@
);
_expectSamePath(executablePath, expectedPath);
- command = p.withoutExtension(command);
+ command = fs.path.withoutExtension(command);
executablePath = getExecutablePath(
command,
workingDir.path,
@@ -135,9 +138,9 @@
});
test('in work dir', () {
- String command = p.join('.', 'bla.exe');
- String expectedPath = p.join(workingDir.path, command);
- String wrongPath = p.join(dir2.path, command);
+ String command = fs.path.join('.', 'bla.exe');
+ String expectedPath = fs.path.join(workingDir.path, command);
+ String wrongPath = fs.path.join(dir2.path, command);
fs.file(expectedPath).createSync();
fs.file(wrongPath).createSync();
@@ -149,7 +152,7 @@
);
_expectSamePath(executablePath, expectedPath);
- command = p.withoutExtension(command);
+ command = fs.path.withoutExtension(command);
executablePath = getExecutablePath(
command,
workingDir.path,
@@ -161,9 +164,9 @@
test('with multiple extensions', () {
String command = 'foo';
- String expectedPath = p.join(dir1.path, '$command.exe');
- String wrongPath1 = p.join(dir1.path, '$command.bat');
- String wrongPath2 = p.join(dir2.path, '$command.exe');
+ String expectedPath = fs.path.join(dir1.path, '$command.exe');
+ String wrongPath1 = fs.path.join(dir1.path, '$command.bat');
+ String wrongPath2 = fs.path.join(dir2.path, '$command.exe');
fs.file(expectedPath).createSync();
fs.file(wrongPath1).createSync();
fs.file(wrongPath2).createSync();
@@ -188,11 +191,13 @@
);
expect(executablePath, isNull);
});
- }, skip: 'https://github.com/google/file.dart/issues/68');
+ });
group('on Linux', () {
Platform platform;
+ initialize(FileSystemStyle.posix);
+
setUp(() {
platform = new FakePlatform(
operatingSystem: 'linux',
@@ -200,9 +205,9 @@
});
test('absolute', () {
- String command = p.join(dir3.path, 'bla');
+ String command = fs.path.join(dir3.path, 'bla');
String expectedPath = command;
- String wrongPath = p.join(dir3.path, 'bla.bat');
+ String wrongPath = fs.path.join(dir3.path, 'bla.bat');
fs.file(command).createSync();
fs.file(wrongPath).createSync();
@@ -217,8 +222,8 @@
test('in path multiple times', () {
String command = 'xxx';
- String expectedPath = p.join(dir1.path, command);
- String wrongPath = p.join(dir2.path, command);
+ String expectedPath = fs.path.join(dir1.path, command);
+ String wrongPath = fs.path.join(dir2.path, command);
fs.file(expectedPath).createSync();
fs.file(wrongPath).createSync();
diff --git a/test/utils.dart b/test/utils.dart
index b09aed3..cadbf4e 100644
--- a/test/utils.dart
+++ b/test/utils.dart
@@ -8,7 +8,7 @@
/// Decodes a UTF8-encoded byte array into a list of Strings, where each list
/// entry represents a line of text.
List<String> decode(List<int> data) =>
- const LineSplitter().convert(UTF8.decode(data));
+ const LineSplitter().convert(utf8.decode(data));
/// Consumes and returns an entire stream of bytes.
Future<List<int>> consume(Stream<List<int>> stream) =>