26 lines
626 B
Go
26 lines
626 B
Go
package runtimeassets
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
)
|
|
|
|
func TestFindCheckoutToolsAndMissingResources(t *testing.T) {
|
|
t.Chdir(t.TempDir())
|
|
path := filepath.Join("third_party", "scrcpy", "test-server")
|
|
if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if err := os.WriteFile(path, []byte("fixture"), 0644); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
want, _ := filepath.Abs(path)
|
|
if got := Find(filepath.Join("scrcpy", "test-server")); got != want {
|
|
t.Fatalf("got %q want %q", got, want)
|
|
}
|
|
if got := Find("nonexistent-tool"); got != "" {
|
|
t.Fatalf("unexpected resource: %s", got)
|
|
}
|
|
}
|