Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make pass_env_vars runs on Windows #133

Merged
merged 1 commit into from
Dec 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions tests/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,6 @@ fn log_file() {
}

/// Pass pre-commit environment variables to the hook.
#[cfg(unix)]
#[test]
fn pass_env_vars() {
let context = TestContext::new();
Expand All @@ -635,21 +634,21 @@ fn pass_env_vars() {
- id: env-vars
name: Pass environment
language: system
entry: sh -c "echo $PRE_COMMIT > env.txt"
entry: python3 -c "import os, sys; print(os.getenv('PRE_COMMIT')); sys.exit(1)"
always_run: true
"#});

cmd_snapshot!(context.filters(), context.run(), @r#"
success: true
exit_code: 0
cmd_snapshot!(context.filters(), context.run(), @r###"
success: false
exit_code: 1
----- stdout -----
Pass environment.........................................................Passed
Pass environment.........................................................Failed
- hook id: env-vars
- exit code: 1
1

----- stderr -----
"#);

let env = context.read("env.txt");
assert_eq!(env, "1\n");
"###);
}

#[test]
Expand Down
Loading