(t *testing.T)
| 53 | } |
| 54 | |
| 55 | func TestResolveShellPath(t *testing.T) { |
| 56 | tests := []struct { |
| 57 | name string |
| 58 | currentPath string |
| 59 | target string |
| 60 | want string |
| 61 | }{ |
| 62 | { |
| 63 | name: "root home shortcut", |
| 64 | currentPath: "/Movies", |
| 65 | target: "~", |
| 66 | want: "/", |
| 67 | }, |
| 68 | { |
| 69 | name: "relative child", |
| 70 | currentPath: "/Movies", |
| 71 | target: "Kids", |
| 72 | want: "/Movies/Kids", |
| 73 | }, |
| 74 | { |
| 75 | name: "relative parent", |
| 76 | currentPath: "/Movies/Kids", |
| 77 | target: "..", |
| 78 | want: "/Movies", |
| 79 | }, |
| 80 | { |
| 81 | name: "absolute path", |
| 82 | currentPath: "/Movies", |
| 83 | target: "/TV Shows/Drama", |
| 84 | want: "/TV Shows/Drama", |
| 85 | }, |
| 86 | { |
| 87 | name: "clean repeated separators", |
| 88 | currentPath: "/Movies", |
| 89 | target: "Kids//Cartoons", |
| 90 | want: "/Movies/Kids/Cartoons", |
| 91 | }, |
| 92 | { |
| 93 | name: "empty target goes root", |
| 94 | currentPath: "/Movies/Kids", |
| 95 | target: "", |
| 96 | want: "/", |
| 97 | }, |
| 98 | } |
| 99 | |
| 100 | for _, tt := range tests { |
| 101 | t.Run(tt.name, func(t *testing.T) { |
| 102 | require.Equal(t, tt.want, resolveShellPath(tt.currentPath, tt.target)) |
| 103 | }) |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | func TestSplitCompletionLine(t *testing.T) { |
| 108 | tests := []struct { |
nothing calls this directly
no test coverage detected