archiver/Globbing_windows_test.go

22 lines
504 B
Go
Raw Normal View History

2024-09-26 11:33:03 +02:00
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")
}
2024-09-26 11:53:37 +02:00
2024-09-26 11:33:03 +02:00
func assertThat[E comparable](t *testing.T, actual E, expected E) {
t.Helper()
if actual != expected {
t.Errorf("actual %v, expected %v", actual, expected)
}
}