20 lines
531 B
Go
20 lines
531 B
Go
|
|
package artifacts
|
||
|
|
|
||
|
|
import (
|
||
|
|
"path/filepath"
|
||
|
|
"testing"
|
||
|
|
)
|
||
|
|
|
||
|
|
func TestProductRelativePath(t *testing.T) {
|
||
|
|
root := t.TempDir()
|
||
|
|
for _, configured := range []string{"artifacts/recap.md", filepath.Join(root, "artifacts", "recap.md")} {
|
||
|
|
got, err := ProductRelativePath(root, configured)
|
||
|
|
if err != nil || got != "artifacts/recap.md" {
|
||
|
|
t.Fatalf("%q: %q, %v", configured, got, err)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
if _, err := ProductRelativePath(root, filepath.Join(t.TempDir(), "recap.md")); err == nil {
|
||
|
|
t.Fatal("outside absolute path accepted")
|
||
|
|
}
|
||
|
|
}
|