You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930
  1. // Copyright 2023 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package repository
  4. import (
  5. "testing"
  6. "github.com/stretchr/testify/assert"
  7. )
  8. func TestMergeCustomLabels(t *testing.T) {
  9. files := mergeCustomLabelFiles(optionFileList{
  10. all: []string{"a", "a.yaml", "a.yml"},
  11. custom: nil,
  12. })
  13. assert.EqualValues(t, []string{"a.yaml"}, files, "yaml file should win")
  14. files = mergeCustomLabelFiles(optionFileList{
  15. all: []string{"a", "a.yaml"},
  16. custom: []string{"a"},
  17. })
  18. assert.EqualValues(t, []string{"a"}, files, "custom file should win")
  19. files = mergeCustomLabelFiles(optionFileList{
  20. all: []string{"a", "a.yml", "a.yaml"},
  21. custom: []string{"a", "a.yml"},
  22. })
  23. assert.EqualValues(t, []string{"a.yml"}, files, "custom yml file should win if no yaml")
  24. }