(t *testing.T)
| 86 | } |
| 87 | |
| 88 | func TestStringBetween(t *testing.T) { |
| 89 | tree := NewFileTree() |
| 90 | _, _, err := tree.AddPath("/etc/nginx/nginx.conf", FileInfo{}) |
| 91 | if err != nil { |
| 92 | t.Errorf("could not setup test: %v", err) |
| 93 | } |
| 94 | _, _, err = tree.AddPath("/etc/nginx/public", FileInfo{}) |
| 95 | if err != nil { |
| 96 | t.Errorf("could not setup test: %v", err) |
| 97 | } |
| 98 | _, _, err = tree.AddPath("/var/run/systemd", FileInfo{}) |
| 99 | if err != nil { |
| 100 | t.Errorf("could not setup test: %v", err) |
| 101 | } |
| 102 | _, _, err = tree.AddPath("/var/run/bashful", FileInfo{}) |
| 103 | if err != nil { |
| 104 | t.Errorf("could not setup test: %v", err) |
| 105 | } |
| 106 | _, _, err = tree.AddPath("/tmp", FileInfo{}) |
| 107 | if err != nil { |
| 108 | t.Errorf("could not setup test: %v", err) |
| 109 | } |
| 110 | _, _, err = tree.AddPath("/tmp/nonsense", FileInfo{}) |
| 111 | if err != nil { |
| 112 | t.Errorf("could not setup test: %v", err) |
| 113 | } |
| 114 | |
| 115 | expected := |
| 116 | `│ └── public |
| 117 | ├── tmp |
| 118 | │ └── nonsense |
| 119 | ` |
| 120 | actual := tree.StringBetween(3, 5, false) |
| 121 | |
| 122 | if expected != actual { |
| 123 | t.Errorf("Expected tree string:\n--->%s<---\nGot:\n--->%s<---", expected, actual) |
| 124 | } |
| 125 | |
| 126 | } |
| 127 | |
| 128 | func TestRejectPurelyRelativePath(t *testing.T) { |
| 129 | tree := NewFileTree() |
nothing calls this directly
no test coverage detected