File tree Expand file tree Collapse file tree 1 file changed +42
-1
lines changed
src/test/kotlin/org/rustSlowTests/cargo/runconfig Expand file tree Collapse file tree 1 file changed +42
-1
lines changed Original file line number Diff line number Diff line change @@ -132,7 +132,7 @@ class RunConfigurationTest : RunConfigurationTestBase() {
132
132
check(""" { "type": "test", "event": "started", "name": "tests::bar" }""" in result.stdout)
133
133
}
134
134
135
- fun `test redirect input` () {
135
+ fun `test redirect input (absolute path) ` () {
136
136
fileTree {
137
137
toml(" Cargo.toml" , """
138
138
[package]
@@ -173,4 +173,45 @@ class RunConfigurationTest : RunConfigurationTestBase() {
173
173
check(" 2. bbb" in stdout)
174
174
check(" 3. ccc" !in stdout)
175
175
}
176
+
177
+ fun `test redirect input (relative path)` () {
178
+ fileTree {
179
+ toml(" Cargo.toml" , """
180
+ [package]
181
+ name = "hello"
182
+ version = "0.1.0"
183
+ authors = []
184
+ """ )
185
+
186
+ dir(" src" ) {
187
+ rust(" main.rs" , """
188
+ use std::io::{self, BufRead};
189
+
190
+ fn main() {
191
+ let stdin = io::stdin();
192
+ let mut iter = stdin.lock().lines();
193
+ println!("{}", iter.next().unwrap().unwrap());
194
+ println!("{}", iter.next().unwrap().unwrap()); }
195
+ """ )
196
+ }
197
+
198
+ file(" in.txt" , """
199
+ 1. aaa
200
+ 2. bbb
201
+ 3. ccc
202
+ """ )
203
+ }.create()
204
+
205
+ val configuration = createConfiguration()
206
+ .apply {
207
+ isRedirectInput = true
208
+ redirectInputPath = " in.txt"
209
+ }
210
+
211
+ val result = executeAndGetOutput(configuration)
212
+ val stdout = result.stdout
213
+ check(" 1. aaa" in stdout)
214
+ check(" 2. bbb" in stdout)
215
+ check(" 3. ccc" !in stdout)
216
+ }
176
217
}
You can’t perform that action at this time.
0 commit comments