MCPcopy Create free account
hub / github.com/astercloud/aster / TestRuntime_SyntaxError

Function TestRuntime_SyntaxError

pkg/tools/bridge/runtime_test.go:205–230  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

203}
204
205func TestRuntime_SyntaxError(t *testing.T) {
206 runtime := NewPythonRuntime(nil)
207
208 if !runtime.IsAvailable() {
209 t.Skip("Python not available")
210 }
211
212 ctx := context.Background()
213 code := `
214this is not valid python
215`
216
217 result, err := runtime.Execute(ctx, code, nil)
218 if err != nil {
219 t.Fatalf("Execute returned error: %v", err)
220 }
221
222 // 应该失败
223 if result.Success {
224 t.Error("expected syntax error failure")
225 }
226
227 if result.ExitCode == 0 {
228 t.Error("expected non-zero exit code")
229 }
230}
231
232func TestDetectLanguage(t *testing.T) {
233 tests := []struct {

Callers

nothing calls this directly

Calls 4

IsAvailableMethod · 0.95
ExecuteMethod · 0.95
NewPythonRuntimeFunction · 0.85
ErrorMethod · 0.65

Tested by

no test coverage detected