blob: e8ebc24310d7a4acf0766a543dfd04d4c8985470 [file] [log] [blame]
// Copyright (c) 2017, 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.
// @dart = 2.9
/// @assertion Future addStream(Stream<List<int>> stream)
/// Adds all elements of the given stream to [this].
/// @description Checks that [error] appears in [stderr] as a result of the
/// [addError] method call.
/// @author iarkh@unipro.ru
import "../../../Utils/expect.dart";
import "dart:async";
import "dart:io";
Stream<List> aStream = new Stream<List<int>>.fromIterable([[86, 73, 45]]);
run_process(IOSink sink) { sink.addStream(aStream); }
run_main(String mode) async {
String executable = Platform.resolvedExecutable;
String eScript = Platform.script.toString();
int called = 0;
await Process.run(executable, [eScript, mode]).then((ProcessResult results) {
Expect.equals("VI-", mode == "err" ? results.stderr : results.stdout);
called++;
});
Expect.equals(1, called);
}
main(List<String> args) {
if(args.length > 0)
run_process(args[0] == "err" ? stderr : stdout);
else {
run_main("out");
run_main("err");
}
}