Download this file
| 1 | //go:build testbuild |
| 2 | |
| 3 | package mac |
| 4 | |
| 5 | import ( |
| 6 | "context" |
| 7 | "io" |
| 8 | "os" |
| 9 | "path/filepath" |
| 10 | ) |
| 11 | |
| 12 | // In a test build only, ClaudeStandInEnv may name a local file that |
| 13 | // stands in for the official download (no test reaches the network). |
| 14 | // What it serves is still checked against the pin. |
| 15 | const claudeStandInBuild = true |
| 16 | |
| 17 | func claudeStandIn(getenv func(string) string) ClaudeFetch { |
| 18 | path := getenv(ClaudeStandInEnv) |
| 19 | if !filepath.IsAbs(path) { |
| 20 | return nil |
| 21 | } |
| 22 | return func(context.Context, string) (io.ReadCloser, error) { return os.Open(path) } |
| 23 | } |
| 24 | |
| 25 | // PinnedForTest is c pinned to pin (a test build's own CLI stand-in). |
| 26 | func PinnedForTest(c ClaudeCLI, pin string) ClaudeCLI { c.pin = pin; return c } |
| 27 | |