gitea源码

vendor_test.go 906B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright 2021 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package analyze
  4. import (
  5. "testing"
  6. "github.com/stretchr/testify/assert"
  7. )
  8. func TestIsVendor(t *testing.T) {
  9. tests := []struct {
  10. path string
  11. want bool
  12. }{
  13. {"cache/", true},
  14. {"random/cache/", true},
  15. {"cache", false},
  16. {"dependencies/", true},
  17. {"Dependencies/", true},
  18. {"dependency/", false},
  19. {"dist/", true},
  20. {"dist", false},
  21. {"random/dist/", true},
  22. {"random/dist", false},
  23. {"deps/", true},
  24. {"configure", true},
  25. {"a/configure", true},
  26. {"config.guess", true},
  27. {"config.guess/", false},
  28. {".vscode/", true},
  29. {"doc/_build/", true},
  30. {"a/docs/_build/", true},
  31. {"a/dasdocs/_build-vsdoc.js", true},
  32. {"a/dasdocs/_build-vsdoc.j", false},
  33. }
  34. for _, tt := range tests {
  35. t.Run(tt.path, func(t *testing.T) {
  36. got := IsVendor(tt.path)
  37. assert.Equal(t, tt.want, got)
  38. })
  39. }
  40. }