返回 DeepSeek-Reasonix
env_prefix_test.go
根目录 / internal / evidence / env_prefix_test.go
1 package evidence
2
3 import "testing"
4
5 func TestEnvPrefixVerification(t *testing.T) {
6 cases := map[string]bool{
7 "go test ./internal/evidence/": true,
8 "go test ./internal/evidence/ -count=1": true,
9 "GOROOT=/x go test ./internal/evidence/": true,
10 "GOROOT=/x PATH=/y go test ./internal/evidence/": true,
11 "env GOROOT=/x go test ./internal/evidence/": true,
12 "cd /tmp && go test ./internal/evidence/": true,
13 "go test ./internal/evidence/ 2>&1 | tail -3": true,
14 "GOROOT=/x rm -rf /": false,
15 "GOROOT=/x": false,
16 "FOO=$(whoami) go test ./internal/evidence/": false,
17 "env -i go test ./internal/evidence/": false,
18 "CARGO_HOME=/y cargo test": true,
19 }
20 for c, want := range cases {
21 if got := IsVerificationCommand(c); got != want {
22 t.Errorf("IsVerificationCommand(%q) = %v, want %v", c, got, want)
23 }
24 }
25 }
26
26 lines GO