Why: Allow consumers to download an immutable module revision without nested source checkouts or local path replacements. Evidence: SELF package tests and the prior canonical-path rejection are recorded in the Dev dependency-workspace task card; remote consumption is replayed against the committed candidate. Impact: Change the module identity and its Go imports while preserving API behavior. Existing historical submodule revisions remain buildable. Refs: Versioned dependencies U1/U3; feature/dependency-workspace
51 lines
1.4 KiB
Go
51 lines
1.4 KiB
Go
package cli
|
|
|
|
import (
|
|
"bytes"
|
|
"strings"
|
|
"testing"
|
|
|
|
"git-ssh.u1680832.nyat.app/weichen/Error-Code-System.git/domains"
|
|
"git-ssh.u1680832.nyat.app/weichen/Error-Code-System.git/errcode"
|
|
)
|
|
|
|
func TestCLIListShowValidate(t *testing.T) {
|
|
reg := errcode.NewRegistry()
|
|
domains.RegisterAll(reg)
|
|
prev := errcode.Default
|
|
errcode.Default = reg
|
|
t.Cleanup(func() { errcode.Default = prev })
|
|
|
|
var out, errBuf bytes.Buffer
|
|
if code := Run([]string{"list", "--domain", "sys"}, &out, &errBuf); code != 0 {
|
|
t.Fatal(errBuf.String())
|
|
}
|
|
if !strings.Contains(out.String(), "sys.internal") || strings.Contains(out.String(), "agent.") {
|
|
t.Fatalf("list:\n%s", out.String())
|
|
}
|
|
|
|
out.Reset()
|
|
if code := Run([]string{"show", "TIMEOUT"}, &out, &errBuf); code != 0 {
|
|
t.Fatal(errBuf.String())
|
|
}
|
|
if !strings.Contains(out.String(), string(errcode.AgentTimeout)) {
|
|
t.Fatalf("show:\n%s", out.String())
|
|
}
|
|
|
|
out.Reset()
|
|
if code := Run([]string{"validate", "nope"}, &out, &errBuf); code != 1 {
|
|
t.Fatalf("validate exit %d %s", code, out.String())
|
|
}
|
|
if !strings.Contains(out.String(), "known=false") || !strings.Contains(out.String(), string(errcode.SysUnknownCode)) {
|
|
t.Fatalf("validate:\n%s", out.String())
|
|
}
|
|
|
|
out.Reset()
|
|
if code := Run([]string{"search", "角色"}, &out, &errBuf); code != 0 {
|
|
t.Fatal(errBuf.String())
|
|
}
|
|
if !strings.Contains(out.String(), string(errcode.SquadRoleNotFound)) {
|
|
t.Fatalf("search:\n%s", out.String())
|
|
}
|
|
}
|