Unify analysis product path identity
This commit is contained in:
19
internal/artifacts/product_path_test.go
Normal file
19
internal/artifacts/product_path_test.go
Normal file
@@ -0,0 +1,19 @@
|
||||
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")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user