(t *testing.T)
| 228 | } |
| 229 | |
| 230 | func TestIsEncryptedParent(t *testing.T) { |
| 231 | comp := rand.String(maxPathComponent) |
| 232 | cases := []struct { |
| 233 | path string |
| 234 | is bool |
| 235 | }{ |
| 236 | {"", false}, |
| 237 | {".", false}, |
| 238 | {"/", false}, |
| 239 | {"12" + encryptedDirExtension, false}, |
| 240 | {"1" + encryptedDirExtension, true}, |
| 241 | {"1" + encryptedDirExtension + "/b", false}, |
| 242 | {"1" + encryptedDirExtension + "/bc", true}, |
| 243 | {"1" + encryptedDirExtension + "/bcd", false}, |
| 244 | {"1" + encryptedDirExtension + "/bc/foo", false}, |
| 245 | {"1.12/22", false}, |
| 246 | {"1" + encryptedDirExtension + "/bc/" + comp, true}, |
| 247 | {"1" + encryptedDirExtension + "/bc/" + comp + "/" + comp, true}, |
| 248 | {"1" + encryptedDirExtension + "/bc/" + comp + "a", false}, |
| 249 | {"1" + encryptedDirExtension + "/bc/" + comp + "/a/" + comp, false}, |
| 250 | } |
| 251 | for _, tc := range cases { |
| 252 | if res := IsEncryptedParent(strings.Split(tc.path, "/")); res != tc.is { |
| 253 | t.Errorf("%v: got %v, expected %v", tc.path, res, tc.is) |
| 254 | } |
| 255 | } |
| 256 | } |
nothing calls this directly
no test coverage detected