From ed80f21533ebd219e9ec746915194cfffb7721ea Mon Sep 17 00:00:00 2001 From: Joel Natividad <1980690+jqnatividad@users.noreply.github.com> Date: Sun, 13 Oct 2024 07:30:57 -0400 Subject: [PATCH] `test`: enable clipboard test --- tests/test_clipboard.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/test_clipboard.rs b/tests/test_clipboard.rs index 7f75f6a06..faa12ca76 100644 --- a/tests/test_clipboard.rs +++ b/tests/test_clipboard.rs @@ -1,14 +1,12 @@ use crate::workdir::Workdir; +use arboard::Clipboard; -// Assume a user has qsv stats output in their clipboard. -// This test compares the stats output of fruits.csv to the clipboard output. #[test] -#[ignore = "Requires clipboard to test."] +// #[ignore = "Requires clipboard to test."] fn clipboard_success() { let wrk = Workdir::new("stats_clipboard_equality"); - let mut clipboard_cmd = wrk.command("clipboard"); - let clipboard_output: String = wrk.stdout(&mut clipboard_cmd); + // This test compares the stats output of fruits.csv to the clipboard output. #[cfg(not(windows))] let expected = "field,type,is_ascii,sum,min,max,range,min_length,max_length,mean,sem,stddev,\ variance,cv,nullcount,max_precision,sparsity\nfruit,String,true,,apple,\ @@ -20,5 +18,11 @@ fn clipboard_success() { strawberry,,5,10,,,,,,0,,0\r\nprice,Float,,7,1.5,3.0,1.5,4,4,2.3333,0.36,0.\ 6236,0.3889,26.7261,0,1,0"; + let mut clipboard = Clipboard::new().unwrap(); + clipboard.set_text(expected).unwrap(); + + let mut clipboard_cmd = wrk.command("clipboard"); + let clipboard_output: String = wrk.stdout(&mut clipboard_cmd); + assert_eq!(clipboard_output, expected); }