diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-03-05 18:37:55 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-03-05 18:37:55 +0900 |
| commit | 75970a5650808feaaee2fb4d77aad14756349755 (patch) | |
| tree | 0ddea581884e259704471d953d0bedd65b648a38 | |
| parent | 572c99825d878b0ad562f85ef2f6fafbd298d78e (diff) | |
internal/rosa: check name uniqueness
This should prevent adding packages with nonunique names.
Signed-off-by: Ophestra <cat@gensokyo.uk>
| -rw-r--r-- | internal/rosa/all_test.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/internal/rosa/all_test.go b/internal/rosa/all_test.go index 08d2d2cb..407dc178 100644 --- a/internal/rosa/all_test.go +++ b/internal/rosa/all_test.go @@ -51,3 +51,16 @@ func TestResolveNameUnexported(t *testing.T) { }) } } + +func TestUnique(t *testing.T) { + t.Parallel() + + names := make(map[string]struct{}) + for i := range rosa.PresetEnd { + name := rosa.GetMetadata(rosa.PArtifact(i)).Name + if _, ok := names[name]; ok { + t.Fatalf("name %s is not unique", name) + } + names[name] = struct{}{} + } +} |
