19 lines
403 B
Go
19 lines
403 B
Go
package host
|
|
|
|
import (
|
|
"errors"
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
)
|
|
|
|
func TestRevealRejectsMissingFileAndDirectory(t *testing.T) {
|
|
dir := t.TempDir()
|
|
if err := RevealFile(filepath.Join(dir, "missing.zip")); !errors.Is(err, os.ErrNotExist) {
|
|
t.Fatalf("RevealFile(missing) = %v, want file not found", err)
|
|
}
|
|
if err := RevealFile(dir); err == nil {
|
|
t.Fatal("RevealFile accepted a directory")
|
|
}
|
|
}
|