Skip to content

Commit

Permalink
fix: windows test
Browse files Browse the repository at this point in the history
  • Loading branch information
noahmmcgivern committed Dec 5, 2023
1 parent af4bfd3 commit 1b7f9f6
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
workflow_call:
secrets:
DOCKER_PASSWORD:
required: true

permissions:
contents: write
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@ name: Testing

on:
push:
branches:
- "master"
pull_request:
branches:
- "!master"
branches: [master]

env:
CARGO_TERM_COLOR: always
Expand Down
25 changes: 25 additions & 0 deletions src/bin/duroc_hog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,31 @@ mod tests {
assert!(!text.contains("output_file.txt"));
}

#[test]
#[cfg(target_os = "windows")]
fn does_not_scan_output_file_windows() {
let temp_dir = TempDir::new().unwrap();

write_temp_file(
&temp_dir,
"insecure-file.txt",
"My email is [email protected]",
);

let cmd_args = ["-o", "output_file.txt", "."];

run_command_in_dir(&temp_dir, "duroc_hog", &cmd_args).unwrap();

run_command_in_dir(&temp_dir, "duroc_hog", &cmd_args).unwrap();

let text = read_temp_file(&temp_dir, "output_file.txt");

println!("{}", text);

assert!(text.contains("\"path\":\".\\\\insecure-file.txt\""));
assert!(!text.contains("output_file.txt"));
}

#[test]
fn allowlist_json_file_prevents_output() {
let temp_dir = TempDir::new().unwrap();
Expand Down

0 comments on commit 1b7f9f6

Please sign in to comment.