Removes testify + indirect deps from go.mod/go.sum; rewrites assert/require calls across cmd/dev/*, cmd/setup/*, devkit/* _test.go to stdlib t.Fatalf patterns. go vet clean. TestRunTestGen_Good fails pre-existing (missing cmd/dev/pkg/ env) at dev tip — unrelated to this PR. Closes tasks.lthn.sh/view.php?id=754 Co-authored-by: Codex <noreply@openai.com> Via-codex-lane: Cyclops-754 dispatch
50 lines
1.2 KiB
Go
50 lines
1.2 KiB
Go
package dev
|
|
|
|
import (
|
|
"reflect"
|
|
"testing"
|
|
|
|
"dappco.re/go/core/cli/pkg/cli"
|
|
)
|
|
|
|
func TestAddFileSyncCommand_Good(t *testing.T) {
|
|
root := &cli.Command{Use: "core"}
|
|
|
|
AddDevCommands(root)
|
|
|
|
syncCmd, _, err := root.Find([]string{"dev", "sync"})
|
|
mustNoError(t, err)
|
|
if syncCmd == nil {
|
|
t.Fatal("expected non-nil sync command")
|
|
}
|
|
|
|
yesFlag := syncCmd.Flags().Lookup("yes")
|
|
if yesFlag == nil {
|
|
t.Fatal("expected yes flag")
|
|
}
|
|
mustEqual(t, "y", yesFlag.Shorthand)
|
|
|
|
if syncCmd.Flags().Lookup("dry-run") == nil {
|
|
t.Fatal("expected dry-run flag")
|
|
}
|
|
if syncCmd.Flags().Lookup("push") == nil {
|
|
t.Fatal("expected push flag")
|
|
}
|
|
}
|
|
|
|
func TestSplitPatterns_Good(t *testing.T) {
|
|
patterns := splitPatterns("packages/core-*, apps/* ,services/*,")
|
|
want := []string{"packages/core-*", "apps/*", "services/*"}
|
|
if !reflect.DeepEqual(want, patterns) {
|
|
t.Fatalf("want %v, got %v", want, patterns)
|
|
}
|
|
}
|
|
|
|
func TestMatchGlob_Good(t *testing.T) {
|
|
mustTrue(t, matchGlob("packages/core-xyz", "packages/core-*"))
|
|
mustTrue(t, matchGlob("packages/core-xyz", "*/core-*"))
|
|
mustTrue(t, matchGlob("a-b", "a?b"))
|
|
mustTrue(t, matchGlob("foo", "foo"))
|
|
mustFalse(t, matchGlob("core-other", "packages/*"))
|
|
mustFalse(t, matchGlob("abc", "[]"))
|
|
}
|