(t *testing.T)
| 87 | } |
| 88 | |
| 89 | func TestJSONOutput(t *testing.T) { |
| 90 | output, err := runCodemap("--json", ".") |
| 91 | if err != nil { |
| 92 | t.Fatalf("JSON output failed: %v", err) |
| 93 | } |
| 94 | |
| 95 | // Should be valid JSON |
| 96 | var project scanner.Project |
| 97 | if err := json.Unmarshal([]byte(output), &project); err != nil { |
| 98 | t.Errorf("Output should be valid JSON: %v", err) |
| 99 | } |
| 100 | |
| 101 | // Verify structure |
| 102 | if project.Root == "" { |
| 103 | t.Error("JSON should have root field") |
| 104 | } |
| 105 | if project.Mode != "tree" { |
| 106 | t.Errorf("Expected mode 'tree', got %q", project.Mode) |
| 107 | } |
| 108 | if len(project.Files) == 0 { |
| 109 | t.Error("JSON should have files") |
| 110 | } |
| 111 | |
| 112 | // Verify file info structure |
| 113 | for _, f := range project.Files { |
| 114 | if f.Path == "" { |
| 115 | t.Error("File path should not be empty") |
| 116 | } |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | func TestSubdirectoryPath(t *testing.T) { |
| 121 | // Test scanning a subdirectory |
nothing calls this directly
no test coverage detected