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.

vendor_test.go 982B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright 2021 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package analyze
  5. import "testing"
  6. func TestIsVendor(t *testing.T) {
  7. tests := []struct {
  8. path string
  9. want bool
  10. }{
  11. {"cache/", true},
  12. {"random/cache/", true},
  13. {"cache", false},
  14. {"dependencies/", true},
  15. {"Dependencies/", true},
  16. {"dependency/", false},
  17. {"dist/", true},
  18. {"dist", false},
  19. {"random/dist/", true},
  20. {"random/dist", false},
  21. {"deps/", true},
  22. {"configure", true},
  23. {"a/configure", true},
  24. {"config.guess", true},
  25. {"config.guess/", false},
  26. {".vscode/", true},
  27. {"doc/_build/", true},
  28. {"a/docs/_build/", true},
  29. {"a/dasdocs/_build-vsdoc.js", true},
  30. {"a/dasdocs/_build-vsdoc.j", false},
  31. }
  32. for _, tt := range tests {
  33. t.Run(tt.path, func(t *testing.T) {
  34. if got := IsVendor(tt.path); got != tt.want {
  35. t.Errorf("IsVendor() = %v, want %v", got, tt.want)
  36. }
  37. })
  38. }
  39. }