Skip to content
This repository was archived by the owner on Jan 3, 2025. It is now read-only.

fix travis #15

Merged
merged 1 commit into from
Apr 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
43 changes: 43 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -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
24 changes: 12 additions & 12 deletions lib/test_process.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ class TestProcess {
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,
Expand All @@ -101,7 +101,7 @@ class TestProcess {
}

encoding ??= utf8;
return new TestProcess(process, description,
return TestProcess(process, description,
encoding: encoding, forwardStdio: forwardStdio);
}

Expand All @@ -113,20 +113,20 @@ class TestProcess {
/// 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.
Expand Down Expand Up @@ -165,9 +165,9 @@ class TestProcess {

// 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:");
Expand Down Expand Up @@ -205,7 +205,7 @@ class TestProcess {
/// Throws an [UnsupportedError] on Windows.
void signal(ProcessSignal signal) {
if (Platform.isWindows) {
throw new UnsupportedError(
throw UnsupportedError(
"TestProcess.signal() isn't supported on Windows.");
}

Expand Down
5 changes: 3 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -15,4 +15,5 @@ dependencies:
test: '>=0.12.42 <2.0.0'

dev_dependencies:
pedantic: ^1.0.0
test_descriptor: ^1.0.0
8 changes: 4 additions & 4 deletions test/test_process_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import 'package:test/test.dart';
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()", () {
Expand Down Expand Up @@ -106,14 +106,14 @@ void main() {
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';
Expand All @@ -127,5 +127,5 @@ Future<TestProcess> startDartProcess(String script) {
}
''');

return TestProcess.start(Platform.executable, ['--checked', dartPath]);
return TestProcess.start(Platform.executable, ['--enable-asserts', dartPath]);
}