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

Function TestRunCommand

runner/engine_test.go:124–149  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

122}
123
124func TestRunCommand(t *testing.T) {
125 if runtime.GOOS == "windows" {
126 t.Skip("requires touch")
127 }
128
129 // generate a random port
130 port, f := GetPort()
131 f()
132 t.Logf("port: %d", port)
133 tmpDir := initTestEnv(t, port)
134 // change dir to tmpDir
135 chdir(t, tmpDir)
136 engine, err := NewEngine("", nil, true)
137 if err != nil {
138 t.Fatalf("Should not be fail: %s.", err)
139 }
140 err = engine.runCommand("touch test.txt")
141 if err != nil {
142 t.Fatalf("Should not be fail: %s.", err)
143 }
144 if _, err := os.Stat("./test.txt"); err != nil {
145 if os.IsNotExist(err) {
146 t.Fatalf("Should not be fail: %s.", err)
147 }
148 }
149}
150
151func TestRunPreCmd(t *testing.T) {
152 // generate a random port

Callers

nothing calls this directly

Calls 5

runCommandMethod · 0.95
GetPortFunction · 0.85
initTestEnvFunction · 0.85
chdirFunction · 0.85
NewEngineFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…