mirror of
https://git.sr.ht/~eliasnaur/gio-cmd
synced 2026-07-07 10:25:33 +00:00
gogio: load Android assets from module root
This commit is contained in:
@@ -83,6 +83,34 @@ func TestCopyTreeCopiesNestedResources(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestModuleRootForDirFindsOwningModule(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
root := t.TempDir()
|
||||
writeTestFile(t, filepath.Join(root, "go.mod"), "module example.invalid/crew\n")
|
||||
dir := filepath.Join(root, "cmd", "keepassgo")
|
||||
if err := os.MkdirAll(dir, 0o755); err != nil {
|
||||
t.Fatalf("MkdirAll(%q) error = %v", dir, err)
|
||||
}
|
||||
|
||||
if got := moduleRootForDir(dir); got != root {
|
||||
t.Fatalf("moduleRootForDir(%q) = %q, want %q", dir, got, root)
|
||||
}
|
||||
}
|
||||
|
||||
func TestModuleRootForDirFallsBackToInputDir(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
dir := filepath.Join(t.TempDir(), "cmd", "keepassgo")
|
||||
if err := os.MkdirAll(dir, 0o755); err != nil {
|
||||
t.Fatalf("MkdirAll(%q) error = %v", dir, err)
|
||||
}
|
||||
|
||||
if got := moduleRootForDir(dir); got != dir {
|
||||
t.Fatalf("moduleRootForDir(%q) = %q, want %q", dir, got, dir)
|
||||
}
|
||||
}
|
||||
|
||||
func writeTestFile(t *testing.T, path, contents string) {
|
||||
t.Helper()
|
||||
if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user