OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | |
2 // for details. All rights reserved. Use of this source code is governed by a | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 import '../descriptor.dart' as d; | 1 import '../descriptor.dart' as d; |
6 import '../test_pub.dart'; | 2 import '../test_pub.dart'; |
7 | |
8 const SCRIPT = """ | 3 const SCRIPT = """ |
9 import 'dart:io'; | 4 import 'dart:io'; |
10 | 5 |
11 main() { | 6 main() { |
12 print("started"); | 7 print("started"); |
13 var line1 = stdin.readLineSync(); | 8 var line1 = stdin.readLineSync(); |
14 print("between"); | 9 print("between"); |
15 var line2 = stdin.readLineSync(); | 10 var line2 = stdin.readLineSync(); |
16 print(line1); | 11 print(line1); |
17 print(line2); | 12 print(line2); |
18 } | 13 } |
19 """; | 14 """; |
20 | |
21 main() { | 15 main() { |
22 initConfig(); | 16 initConfig(); |
23 integration('the spawned application can read from stdin', () { | 17 integration('the spawned application can read from stdin', () { |
24 d.dir(appPath, [ | 18 d.dir( |
25 d.appPubspec(), | 19 appPath, |
26 d.dir("bin", [ | 20 [d.appPubspec(), d.dir("bin", [d.file("script.dart", SCRIPT)])]).create(
); |
27 d.file("script.dart", SCRIPT) | |
28 ]) | |
29 ]).create(); | |
30 | |
31 var pub = pubRun(args: ["script"]); | 21 var pub = pubRun(args: ["script"]); |
32 | |
33 pub.stdout.expect("started"); | 22 pub.stdout.expect("started"); |
34 pub.writeLine("first"); | 23 pub.writeLine("first"); |
35 pub.stdout.expect("between"); | 24 pub.stdout.expect("between"); |
36 pub.writeLine("second"); | 25 pub.writeLine("second"); |
37 pub.stdout.expect("first"); | 26 pub.stdout.expect("first"); |
38 pub.stdout.expect("second"); | 27 pub.stdout.expect("second"); |
39 pub.shouldExit(0); | 28 pub.shouldExit(0); |
40 }); | 29 }); |
41 } | 30 } |
OLD | NEW |