giteabot backport / giteabot (push) Canceled after 0s
giteabot / giteabot (push) Canceled after 0s
release-nightly / nightly-binary (push) Canceled after 0s
release-nightly / nightly-container (push) Canceled after 0s
cache-seeder / gobuild (push) Canceled after 0s
cache-seeder / lint (bindata, lint-backend) (push) Canceled after 0s
release-nightly-snapcraft / build-and-publish (push) Canceled after 0s
Includes direct password setup links in registration emails. Assisted-by: Codex:GPT-5
54 lines
1.2 KiB
Go
54 lines
1.2 KiB
Go
// Copyright 2021 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package analyze
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestIsVendor(t *testing.T) {
|
|
tests := []struct {
|
|
path string
|
|
want bool
|
|
}{
|
|
// Original go-enry test cases
|
|
{"cache/", true},
|
|
{"random/cache/", true},
|
|
{"cache", false},
|
|
{"dependencies/", true},
|
|
{"Dependencies/", true},
|
|
{"dependency/", false},
|
|
{"dist/", true},
|
|
{"dist", false},
|
|
{"random/dist/", true},
|
|
{"random/dist", false},
|
|
{"deps/", true},
|
|
{"configure", true},
|
|
{"a/configure", true},
|
|
{"config.guess", true},
|
|
{"config.guess/", false},
|
|
{".vscode/", true},
|
|
{"doc/_build/", true},
|
|
{"a/docs/_build/", true},
|
|
{"a/dasdocs/_build-vsdoc.js", true},
|
|
{"a/dasdocs/_build-vsdoc.j", false},
|
|
|
|
// Override: Git/GitHub/Gitea-related paths should NOT be detected as vendored
|
|
{".gitignore", false},
|
|
{".gitattributes", false},
|
|
{".gitmodules", false},
|
|
{"src/.gitignore", false},
|
|
{".github/workflows/ci.yml", false},
|
|
{".gitea/workflows/ci.yml", false},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.path, func(t *testing.T) {
|
|
got := IsVendor(tt.path)
|
|
assert.Equal(t, tt.want, got)
|
|
})
|
|
}
|
|
}
|