MCPcopy Create free account
hub / github.com/cogentcore/core / TestCommand

Function TestCommand

shell/transpile_test.go:180–198  ·  view source on GitHub ↗

tests command generation

(t *testing.T)

Source from the content-addressed store, hash-verified

178
179// tests command generation
180func TestCommand(t *testing.T) {
181 // logx.UserLevel = slog.LevelDebug
182 tests := []exIn{
183 {
184 `command list {
185ls -la args...
186}`,
187 `shell.AddCommand("list", func(args ...string) {
188shell.Run("ls", "-la", "args...")
189})`},
190 }
191
192 sh := NewShell()
193 for _, test := range tests {
194 sh.TranspileCode(test.i)
195 o := sh.Code()
196 assert.Equal(t, test.e, o)
197 }
198}

Callers

nothing calls this directly

Calls 4

TranspileCodeMethod · 0.95
CodeMethod · 0.95
NewShellFunction · 0.85
EqualMethod · 0.80

Tested by

no test coverage detected