Skip to content

Commit

Permalink
add test for glob patterns from stdin
Browse files Browse the repository at this point in the history
  • Loading branch information
jhscheer committed Apr 3, 2023
1 parent db18c8b commit c6a4661
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions tests/glob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,49 @@ fn iglob() {
)
)
}

#[test]
fn glob_stdin() {
use std::io::Write;
use std::process::{Command, Stdio};
use strip_ansi_escapes::strip as strip_ansi_escapes;

let cmd = Command::new("cargo")
.args(["run", "--", "--threads", "1", "--no-config", "-"])
.stdin(Stdio::piped())
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.spawn()
.unwrap();

let stdin = String::from("cassildas_song.md\nnemesis.txt\n");
write!(cmd.stdin.as_ref().unwrap(), "{}", stdin).unwrap();
let output = cmd.wait_with_output().unwrap();

assert_eq!(
String::from_utf8(strip_ansi_escapes(output.stdout).unwrap()).unwrap(),
indoc!(
"
erdtree (304 B)
├─ tests (304 B)
│ ├─ utils
│ └─ data (304 B)
│ ├─ dream_cycle
│ ├─ the_yellow_king (143 B)
│ │ └─ cassildas_song.md (143 B)
│ ├─ lipsum
│ └─ nemesis.txt (161 B)
├─ src
│ ├─ fs
│ └─ render
│ ├─ context
│ ├─ disk_usage
│ └─ tree
│ └─ node
└─ assets
"
)
);
assert!(output.status.success());
}

0 comments on commit c6a4661

Please sign in to comment.