archiver/Globbing_windows_test.go
2024-09-26 11:33:03 +02:00

20 lines
503 B
Go

package archiver
import (
"testing"
)
func TestGetGlobRoot(t *testing.T) {
assertThat(t, getGlobRoot("C:\\foo\\bar\\baz"), "C:\\foo\\bar\\baz")
assertThat(t, getGlobRoot("C:\\foo\\bar\\*\\baz"), "C:\\foo\\bar")
assertThat(t, getGlobRoot("C:\\foo\\bar\\*"), "C:\\foo\\bar")
assertThat(t, getGlobRoot("foo\\bar\\*"), "foo\\bar")
}
func assertThat[E comparable](t *testing.T, actual E, expected E) {
t.Helper()
if actual != expected {
t.Errorf("actual %v, expected %v", actual, expected)
}
}