TestMemoryManagement tests that AST objects are properly released
(t *testing.T)
| 268 | |
| 269 | // TestMemoryManagement tests that AST objects are properly released |
| 270 | func TestMemoryManagement(t *testing.T) { |
| 271 | // This test verifies our memory management improvements don't crash |
| 272 | // Note: Actual memory leak detection would require more sophisticated tooling |
| 273 | |
| 274 | testSQL := "SELECT id, name FROM users WHERE active = true" |
| 275 | |
| 276 | t.Run("AnalyzeMemoryManagement", func(t *testing.T) { |
| 277 | // This should not crash or leak memory |
| 278 | result, err := DetectAndReadInput(testSQL) |
| 279 | if err != nil { |
| 280 | t.Fatalf("Input detection failed: %v", err) |
| 281 | } |
| 282 | |
| 283 | if result.Type != InputTypeSQL { |
| 284 | t.Errorf("Expected SQL input type, got: %v", result.Type) |
| 285 | } |
| 286 | |
| 287 | // The analyze workflow would continue here, but we're testing |
| 288 | // that the input processing doesn't cause issues |
| 289 | }) |
| 290 | |
| 291 | t.Run("ParseMemoryManagement", func(t *testing.T) { |
| 292 | // Similar test for parse command workflow |
| 293 | result, err := DetectAndReadInput(testSQL) |
| 294 | if err != nil { |
| 295 | t.Fatalf("Input detection failed: %v", err) |
| 296 | } |
| 297 | |
| 298 | if len(result.Content) == 0 { |
| 299 | t.Error("Expected non-empty content") |
| 300 | } |
| 301 | }) |
| 302 | } |
| 303 | |
| 304 | // TestSecurityLimits tests the security improvements |
| 305 | func TestSecurityLimits(t *testing.T) { |
nothing calls this directly
no test coverage detected