(t *testing.T)
| 5 | ) |
| 6 | |
| 7 | func TestCleanEnvPath(t *testing.T) { |
| 8 | tests := []struct { |
| 9 | name string |
| 10 | inPath string |
| 11 | outPath string |
| 12 | }{ |
| 13 | { |
| 14 | name: "NoEmptyPaths", |
| 15 | inPath: "/usr/local/bin::", |
| 16 | outPath: "/usr/local/bin", |
| 17 | }, |
| 18 | { |
| 19 | name: "NoRelativePaths", |
| 20 | inPath: "/usr/local/bin:/usr/bin:../test:/bin:/usr/sbin:/sbin:.:..", |
| 21 | outPath: "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin", |
| 22 | }, |
| 23 | } |
| 24 | for _, test := range tests { |
| 25 | t.Run(test.name, func(t *testing.T) { |
| 26 | got := JoinPathLists(test.inPath) |
| 27 | if got != test.outPath { |
| 28 | t.Errorf("Got incorrect cleaned PATH.\ngot: %s\nwant: %s", got, test.outPath) |
| 29 | } |
| 30 | }) |
| 31 | } |
| 32 | } |
nothing calls this directly
no test coverage detected