Skip to content

Commit 14e9100

Browse files
committed
cargo-ui tests: check that <dir>/src exists before processing test
1 parent fcc3ed2 commit 14e9100

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tests/compile-test.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,15 @@ fn run_ui_cargo(config: &mut compiletest::Config) {
181181
}
182182

183183
let src_path = case.path().join("src");
184-
env::set_current_dir(&src_path)?;
185184

185+
// When switching between branches, if the previous branch had a test
186+
// that the current branch does not have, the directory is not removed
187+
// because an ignored Cargo.lock file exists.
188+
if !src_path.exists() {
189+
continue;
190+
}
191+
192+
env::set_current_dir(&src_path)?;
186193
for file in fs::read_dir(&src_path)? {
187194
let file = file?;
188195
if file.file_type()?.is_dir() {

0 commit comments

Comments
 (0)