Fix travis for latest dev SDK (#15)
enable and fix a number of lints
diff --git a/.travis.yml b/.travis.yml
index 697317e..9b68785 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,21 +1,19 @@
language: dart
dart:
+ - 2.0.0
- dev
dart_task:
- - dartfmt
- - dartanalyzer
- test
+ - dartanalyzer
- # Only run one instance of the formatter and the analyzer, rather than running
+# Only run one instance of the formatter and the analyzer, rather than running
# them against each Dart version.
matrix:
- exclude:
- - dart: stable
+ include:
+ - dart: dev
dart_task: dartfmt
- - dart: stable
- dart_task: dartanalyzer
# Only building master means that we don't run two builds for each pull request.
branches:
diff --git a/analysis_options.yaml b/analysis_options.yaml
new file mode 100644
index 0000000..0711aca
--- /dev/null
+++ b/analysis_options.yaml
@@ -0,0 +1,43 @@
+include: package:pedantic/analysis_options.yaml
+analyzer:
+ strong-mode:
+ implicit-casts: false
+linter:
+ rules:
+ - avoid_empty_else
+ - avoid_init_to_null
+ - avoid_null_checks_in_equality_operators
+ - avoid_unused_constructor_parameters
+ - await_only_futures
+ - camel_case_types
+ - cancel_subscriptions
+ - constant_identifier_names
+ - control_flow_in_finally
+ - directives_ordering
+ - empty_catches
+ - empty_constructor_bodies
+ - empty_statements
+ - hash_and_equals
+ - implementation_imports
+ - iterable_contains_unrelated_type
+ - library_names
+ - library_prefixes
+ - list_remove_unrelated_type
+ - non_constant_identifier_names
+ - overridden_fields
+ - package_api_docs
+ - package_names
+ - package_prefixed_library_names
+ - prefer_equal_for_default_values
+ - prefer_final_fields
+ - prefer_generic_function_type_aliases
+ - prefer_is_not_empty
+ - slash_for_doc_comments
+ - test_types_in_equals
+ - throw_in_finally
+ - type_init_formals
+ - unnecessary_brace_in_string_interps
+ - unnecessary_const
+ - unnecessary_new
+ - unrelated_type_equality_checks
+ - valid_regexps
diff --git a/lib/test_process.dart b/lib/test_process.dart
index cf99b09..733648c 100644
--- a/lib/test_process.dart
+++ b/lib/test_process.dart
@@ -82,11 +82,11 @@
String executable, Iterable<String> arguments,
{String workingDirectory,
Map<String, String> environment,
- bool includeParentEnvironment: true,
- bool runInShell: false,
+ bool includeParentEnvironment = true,
+ bool runInShell = false,
String description,
Encoding encoding,
- bool forwardStdio: false}) async {
+ bool forwardStdio = false}) async {
var process = await Process.start(executable, arguments.toList(),
workingDirectory: workingDirectory,
environment: environment,
@@ -101,7 +101,7 @@
}
encoding ??= utf8;
- return new TestProcess(process, description,
+ return TestProcess(process, description,
encoding: encoding, forwardStdio: forwardStdio);
}
@@ -113,20 +113,20 @@
/// This is protected, which means it should only be called by subclasses.
@protected
TestProcess(Process process, this.description,
- {Encoding encoding, bool forwardStdio: false})
+ {Encoding encoding, bool forwardStdio = false})
: _process = process,
- _stdoutSplitter = new StreamSplitter(process.stdout
+ _stdoutSplitter = StreamSplitter(process.stdout
.transform(encoding.decoder)
.transform(const LineSplitter())),
- _stderrSplitter = new StreamSplitter(process.stderr
+ _stderrSplitter = StreamSplitter(process.stderr
.transform(encoding.decoder)
.transform(const LineSplitter())) {
addTearDown(_tearDown);
expect(_process.exitCode.then((_) => _logOutput()), completes,
reason: "Process `$description` never exited.");
- _stdout = new StreamQueue(stdoutStream());
- _stderr = new StreamQueue(stderrStream());
+ _stdout = StreamQueue(stdoutStream());
+ _stderr = StreamQueue(stderrStream());
// Listen eagerly so that the lines are interleaved properly between the two
// streams.
@@ -165,9 +165,9 @@
// Wait a timer tick to ensure that all available lines have been flushed to
// [_log].
- await new Future.delayed(Duration.zero);
+ await Future.delayed(Duration.zero);
- var buffer = new StringBuffer();
+ var buffer = StringBuffer();
buffer.write("Process `$description` ");
if (exitCodeOrNull == null) {
buffer.writeln("was killed with SIGKILL in a tear-down. Output:");
@@ -205,7 +205,7 @@
/// Throws an [UnsupportedError] on Windows.
void signal(ProcessSignal signal) {
if (Platform.isWindows) {
- throw new UnsupportedError(
+ throw UnsupportedError(
"TestProcess.signal() isn't supported on Windows.");
}
diff --git a/pubspec.yaml b/pubspec.yaml
index 80f4d31..3b8296e 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,12 +1,12 @@
name: test_process
-version: 1.0.4
+version: 1.0.5-dev
description: A package for testing subprocesses.
author: Dart Team <misc@dartlang.org>
homepage: https://github.com/dart-lang/test_process
environment:
- sdk: '>=2.0.0-dev.55.0 <3.0.0'
+ sdk: '>=2.0.0 <3.0.0'
dependencies:
async: '>=1.12.0 <3.0.0'
@@ -15,4 +15,5 @@
test: '>=0.12.42 <2.0.0'
dev_dependencies:
+ pedantic: ^1.0.0
test_descriptor: ^1.0.0
diff --git a/test/test_process_test.dart b/test/test_process_test.dart
index 08d8693..85b3424 100644
--- a/test/test_process_test.dart
+++ b/test/test_process_test.dart
@@ -11,7 +11,7 @@
import 'package:test_descriptor/test_descriptor.dart' as d;
import 'package:test_process/test_process.dart';
-final throwsTestFailure = throwsA(new TypeMatcher<TestFailure>());
+final throwsTestFailure = throwsA(TypeMatcher<TestFailure>());
void main() {
group("shouldExit()", () {
@@ -106,14 +106,14 @@
await expectLater(process.stdout, emits('ready'));
process.signal(ProcessSignal.sighup);
await expectLater(process.stdout, emits('HUP'));
- process.kill();
+ await process.kill();
}, testOn: "!windows");
}
/// Starts a Dart process running [script] in a main method.
Future<TestProcess> startDartProcess(String script) {
var dartPath = p.join(d.sandbox, 'test.dart');
- new File(dartPath).writeAsStringSync('''
+ File(dartPath).writeAsStringSync('''
import 'dart:async';
import 'dart:convert';
import 'dart:io';
@@ -127,5 +127,5 @@
}
''');
- return TestProcess.start(Platform.executable, ['--checked', dartPath]);
+ return TestProcess.start(Platform.executable, ['--enable-asserts', dartPath]);
}