Enable travis-ci (dart-lang/test_process#7) * Add analysis_options and .travis.yml * dartfmt
diff --git a/pkgs/test_process/.travis.yml b/pkgs/test_process/.travis.yml new file mode 100644 index 0000000..a0653e3 --- /dev/null +++ b/pkgs/test_process/.travis.yml
@@ -0,0 +1,25 @@ +language: dart + +dart: + - dev + - stable + +dart_task: + - test + +# Only run one instance of the formatter and the analyzer, rather than running +# them against each Dart version. +matrix: + include: + - dart: dev + dart_task: dartfmt + - dart: dev + dart_task: dartanalyzer + +# Only building master means that we don't run two builds for each pull request. +branches: + only: [master] + +cache: + directories: + - $HOME/.pub-cache
diff --git a/pkgs/test_process/analysis_options.yaml b/pkgs/test_process/analysis_options.yaml new file mode 100644 index 0000000..a10d4c5 --- /dev/null +++ b/pkgs/test_process/analysis_options.yaml
@@ -0,0 +1,2 @@ +analyzer: + strong-mode: true
diff --git a/pkgs/test_process/lib/test_process.dart b/pkgs/test_process/lib/test_process.dart index 3584ab5..dcb1d85 100644 --- a/pkgs/test_process/lib/test_process.dart +++ b/pkgs/test_process/lib/test_process.dart
@@ -79,8 +79,7 @@ /// printed to the console as they appear. This is only intended to be set /// temporarily to help when debugging test failures. static Future<TestProcess> start( - String executable, - Iterable<String> arguments, + String executable, Iterable<String> arguments, {String workingDirectory, Map<String, String> environment, bool includeParentEnvironment: true, @@ -102,8 +101,8 @@ } encoding ??= UTF8; - return new TestProcess( - process, description, encoding: encoding, forwardStdio: forwardStdio); + return new TestProcess(process, description, + encoding: encoding, forwardStdio: forwardStdio); } /// Creates a [TestProcess] for [process]. @@ -113,13 +112,15 @@ /// /// This is protected, which means it should only be called by subclasses. @protected - TestProcess(Process process, this.description, {Encoding encoding, - bool forwardStdio: false}) + TestProcess(Process process, this.description, + {Encoding encoding, bool forwardStdio: false}) : _process = process, _stdoutSplitter = new StreamSplitter(process.stdout - .transform(encoding.decoder).transform(const LineSplitter())), + .transform(encoding.decoder) + .transform(const LineSplitter())), _stderrSplitter = new StreamSplitter(process.stderr - .transform(encoding.decoder).transform(const LineSplitter())) { + .transform(encoding.decoder) + .transform(const LineSplitter())) { addTearDown(_tearDown); expect(_process.exitCode.then((_) => _logOutput()), completes, reason: "Process `$description` never exited.");
diff --git a/pkgs/test_process/test/test_process_test.dart b/pkgs/test_process/test/test_process_test.dart index 81d27e1..dd97a6b 100644 --- a/pkgs/test_process/test/test_process_test.dart +++ b/pkgs/test_process/test/test_process_test.dart
@@ -49,18 +49,15 @@ print("\nworld"); '''); - expect(process.stdout, - emitsInOrder(['hello', '', 'world', emitsDone])); + expect(process.stdout, emitsInOrder(['hello', '', 'world', emitsDone])); expect(process.stderr, emitsInOrder(['hi', emitsDone])); await process.shouldExit(0); }); test("close when the process exits", () async { var process = await startDartProcess(''); - expect(expectLater(process.stdout, emits('hello')), - throwsTestFailure); - expect(expectLater(process.stderr, emits('world')), - throwsTestFailure); + expect(expectLater(process.stdout, emits('hello')), throwsTestFailure); + expect(expectLater(process.stderr, emits('world')), throwsTestFailure); await process.shouldExit(0); }); }); @@ -73,19 +70,19 @@ print("\nworld"); '''); - expect(process.stdoutStream(), - emitsInOrder(['hello', '', 'world', emitsDone])); - expect(process.stdoutStream(), - emitsInOrder(['hello', '', 'world', emitsDone])); + expect(process.stdoutStream(), + emitsInOrder(['hello', '', 'world', emitsDone])); + expect(process.stdoutStream(), + emitsInOrder(['hello', '', 'world', emitsDone])); - expect(process.stderrStream(), emitsInOrder(['hi', emitsDone])); - expect(process.stderrStream(), emitsInOrder(['hi', emitsDone])); + expect(process.stderrStream(), emitsInOrder(['hi', emitsDone])); + expect(process.stderrStream(), emitsInOrder(['hi', emitsDone])); - await process.shouldExit(0); + await process.shouldExit(0); - expect(process.stdoutStream(), - emitsInOrder(['hello', '', 'world', emitsDone])); - expect(process.stderrStream(), emitsInOrder(['hi', emitsDone])); + expect(process.stdoutStream(), + emitsInOrder(['hello', '', 'world', emitsDone])); + expect(process.stderrStream(), emitsInOrder(['hi', emitsDone])); }); test("stdin writes to the process", () async {