(t *testing.T)
| 203 | } |
| 204 | |
| 205 | func 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 := ` |
| 214 | this 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 | |
| 232 | func TestDetectLanguage(t *testing.T) { |
| 233 | tests := []struct { |
nothing calls this directly
no test coverage detected