test_util 0.1.1 test_util: ^0.1.1 copied to clipboard
Helpers and utilities for testing: running Dart processes and expecting output.
Various helpers and utilities for testing.
Usage #
import 'package:test/test.dart';
import 'package:test_util/test_util.dart';
void main() {
test('A dart program succeeds', () async {
await dartPubGet();
final result = await dartRun(
['hello.dart', 'Alexey'],
workingDirectory: 'example',
);
expect(result.stdout, 'Hello, Alexey!\n');
});
test('A dart program fails', () async {
await dartPubGet();
final result = await dartRun(
['fail.dart'],
expectedExitCode: 123,
workingDirectory: 'example',
);
expect(result.stderr, 'My error.\n');
});
}