()
| 56 | /// the sandbox before the command runs. |
| 57 | #[tokio::test] |
| 58 | async fn create_with_multiple_uploads() { |
| 59 | let tmpdir = tempfile::tempdir().expect("create tmpdir"); |
| 60 | |
| 61 | let dir_a = tmpdir.path().join("alpha"); |
| 62 | let dir_b = tmpdir.path().join("beta"); |
| 63 | fs::create_dir_all(&dir_a).expect("create alpha"); |
| 64 | fs::create_dir_all(&dir_b).expect("create beta"); |
| 65 | fs::write(dir_a.join("a.txt"), "content-alpha").expect("write a.txt"); |
| 66 | fs::write(dir_b.join("b.txt"), "content-beta").expect("write b.txt"); |
| 67 | |
| 68 | let spec_a = dir_a.to_str().expect("alpha path is UTF-8"); |
| 69 | let spec_b = dir_b.to_str().expect("beta path is UTF-8"); |
| 70 | |
| 71 | let mut guard = SandboxGuard::create_with_uploads( |
| 72 | &[(spec_a, "/sandbox/alpha"), (spec_b, "/sandbox/beta")], |
| 73 | &["sh", "-c", "cat /sandbox/alpha/alpha/a.txt /sandbox/beta/beta/b.txt"], |
| 74 | ) |
| 75 | .await |
| 76 | .expect("sandbox create with multiple --upload flags"); |
| 77 | |
| 78 | let clean = strip_ansi(&guard.create_output); |
| 79 | assert!( |
| 80 | clean.contains("content-alpha"), |
| 81 | "expected alpha content in output:\n{clean}" |
| 82 | ); |
| 83 | assert!( |
| 84 | clean.contains("content-beta"), |
| 85 | "expected beta content in output:\n{clean}" |
| 86 | ); |
| 87 | |
| 88 | guard.cleanup().await; |
| 89 | } |
| 90 | |
| 91 | /// `--upload` with a single file (not a directory) should work. |
| 92 | #[tokio::test] |
nothing calls this directly
no test coverage detected