use std::fs;
use tempfile::NamedTempFile;
#[test]
fn cli_copies_text_file_to_mock_clipboard() {
let tmp = NamedTempFile::new().unwrap();
fs::write(tmp.path(), "hello clipboard\n").unwrap();
std::env::set_var("WSL_CLIP_TEST_CLIPBOARD_FILE", "1");
wsl_clip_core::orc_bridge_cli::run_with_args(&[
"wsl-clip",
"--no-header",
"--no-tree",
tmp.path().to_str().unwrap(),
])
.unwrap();
let out = wsl_clip_core::clipboard::read_mock_clipboard().unwrap_or_default();
assert!(out.contains("hello"));
}
#[test]
fn cli_copies_multiple_files_as_text_to_mock_clipboard() {
let f1 = NamedTempFile::new().unwrap();
let f2 = NamedTempFile::new().unwrap();
fs::write(f1.path(), "alpha\n").unwrap();
fs::write(f2.path(), "beta\n").unwrap();
std::env::set_var("WSL_CLIP_TEST_CLIPBOARD_FILE", "1");
wsl_clip_core::orc_bridge_cli::run_with_args(&[
"wsl-clip",
"--no-header",
"--no-tree",
f1.path().to_str().unwrap(),
f2.path().to_str().unwrap(),
])
.unwrap();
let out = wsl_clip_core::clipboard::read_mock_clipboard().unwrap_or_default();
assert!(out.contains("alpha"));
assert!(out.contains("beta"));
}