| 407 | 407 | | assert_eq!(encoded("a"), "YQA="); |
| 408 | 408 | | } |
| 409 | 409 | | |
| 410 | + | /// Runs the script as administrator, through Windows' prompt, with |
| 411 | + | /// nothing to do: the prompt shows, and its answer comes back. |
| 412 | + | /// `cargo test -- --ignored as_administrator --nocapture`, and say Yes. |
| 413 | + | #[test] |
| 414 | + | #[ignore] |
| 415 | + | fn as_administrator_with_nothing_to_do_it_is_done() { |
| 416 | + | let dir = std::env::temp_dir().join(format!("g1t-setup-admin-{}", std::process::id())); |
| 417 | + | std::fs::create_dir_all(&dir).unwrap(); |
| 418 | + | let (log, marker) = (dir.join("setup.log"), dir.join(RESTART_FILE)); |
| 419 | + | let outcome = run_elevated(&script(&Plan::default(), &log, &marker), 0); |
| 420 | + | let said = std::fs::read_to_string(&log).unwrap_or_default(); |
| 421 | + | println!("{outcome:?}\n{said}"); |
| 422 | + | assert_eq!(outcome, Outcome::Done, "{said}"); |
| 423 | + | assert_eq!(said.trim(), "g1t setup: Done."); |
| 424 | + | assert!(!marker.exists()); |
| 425 | + | let _ = std::fs::remove_dir_all(&dir); |
| 426 | + | } |
| 427 | + | |
| 410 | 428 | | /// Runs the script's WSL step as this user with `--version`, which |
| 411 | 429 | | /// changes nothing: wsl.exe started hidden, what it said logged line by |
| 412 | 430 | | /// line, and its exit code read. `cargo test -- --ignored the_wsl_step --nocapture`. |