MCPcopy
hub / github.com/air-verse/air / TestEntrypointPreservesArgs

Function TestEntrypointPreservesArgs

runner/config_test.go:228–252  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

226}
227
228func TestEntrypointPreservesArgs(t *testing.T) {
229 t.Parallel()
230 root := t.TempDir()
231 cfg := defaultConfig()
232 cfg.Root = root
233 cfg.Build.Entrypoint = entrypoint{"./tmp/main", "server", ":8080"}
234
235 if err := cfg.preprocess(nil); err != nil {
236 t.Fatalf("preprocess error %v", err)
237 }
238
239 wantBin := filepath.Join(root, "tmp", "main")
240 // expandPath resolves symlinks; t.TempDir() may return a symlinked path on some OSs
241 if resolved, err := filepath.EvalSymlinks(root); err == nil {
242 wantBin = filepath.Join(resolved, "tmp", "main")
243 }
244 if cfg.Build.Entrypoint.binary() != wantBin {
245 t.Fatalf("entrypoint binary is %s, want %s", cfg.Build.Entrypoint.binary(), wantBin)
246 }
247
248 wantArgs := []string{"server", ":8080"}
249 if got := cfg.Build.Entrypoint.args(); !reflect.DeepEqual(got, wantArgs) {
250 t.Fatalf("entrypoint args mismatch, got %v want %v", got, wantArgs)
251 }
252}
253
254func TestConfigWithRuntimeArgs(t *testing.T) {
255 runtimeArg := "-flag=value"

Callers

nothing calls this directly

Calls 4

defaultConfigFunction · 0.85
preprocessMethod · 0.80
binaryMethod · 0.80
argsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…