blob: de50a51adea7303d65f646fe6d55fedc9f9332b7 [file] [log] [blame]
// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
/// @assertion Future<T> length
/// Counts the elements in the stream.
/// @description Checks that [length] returns [1] if some line was entered.
/// @author iarkh@unipro.ru
import "../../../Utils/expect.dart";
import "dart:io";
run_process() {
stdin.length.then((int l) {
exit(l);
});
}
run_main() async {
String executable = Platform.resolvedExecutable;
String eScript = Platform.script.toString();
int called = 0;
await Process.start(
executable, [...Platform.executableArguments, eScript, "test"],
runInShell: true)
.then((Process process) async {
process.stdin.writeln("Testme");
process.stdin.close();
await process.exitCode.then((int code) async {
Expect.equals(1, code);
called++;
});
});
Expect.equals(1, called);
}
main(List<String> args) {
args.length > 0 ? run_process() : run_main();
}