精简后的项目:仅保留 api/ui 源码、文档、构建依赖
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package test_utils
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestPathFromAPIRoot(t *testing.T) {
|
||||
tests := []struct {
|
||||
paths []string
|
||||
want string
|
||||
}{
|
||||
{[]string{"server.go"}, "/api/server.go"},
|
||||
{[]string{"scanner", "..", "server.go"}, "/api/server.go"},
|
||||
{[]string{"scanner", "scanner_test.go"}, "/api/scanner/scanner_test.go"},
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
if got, want := PathFromAPIRoot(tc.paths...), tc.want; !strings.HasSuffix(got, want) {
|
||||
t.Fatalf("PathFromAPIRoot(%v) = %q, want a suffix: %q", tc.paths, got, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user