(t *testing.T)
| 54 | } |
| 55 | |
| 56 | func TestBuildTreeStructureDeepNesting(t *testing.T) { |
| 57 | files := []scanner.FileInfo{ |
| 58 | {Path: "a/b/c/d/e/file.go", Size: 100}, |
| 59 | } |
| 60 | |
| 61 | root := buildTreeStructure(files) |
| 62 | |
| 63 | // Navigate to the file |
| 64 | current := root |
| 65 | for _, dir := range []string{"a", "b", "c", "d", "e"} { |
| 66 | child, ok := current.children[dir] |
| 67 | if !ok { |
| 68 | t.Errorf("Expected directory %s", dir) |
| 69 | return |
| 70 | } |
| 71 | if child.isFile { |
| 72 | t.Errorf("%s should be a directory", dir) |
| 73 | } |
| 74 | current = child |
| 75 | } |
| 76 | |
| 77 | // Check file exists |
| 78 | if file, ok := current.children["file.go"]; !ok { |
| 79 | t.Error("Expected file.go") |
| 80 | } else if !file.isFile { |
| 81 | t.Error("file.go should be a file") |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | func TestFormatSize(t *testing.T) { |
| 86 | tests := []struct { |
nothing calls this directly
no test coverage detected