MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / TestGenerateWshCommandDecl_MultiArgs

Function TestGenerateWshCommandDecl_MultiArgs

pkg/wshrpc/wshrpcmeta_test.go:18–37  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

16}
17
18func TestGenerateWshCommandDecl_MultiArgs(t *testing.T) {
19 rtype := reflect.TypeOf((*testRpcInterfaceForDecls)(nil)).Elem()
20 method, ok := rtype.MethodByName("TwoArgCommand")
21 if !ok {
22 t.Fatalf("TwoArgCommand method not found")
23 }
24 decl := generateWshCommandDecl(method)
25 if decl.Command != "twoarg" {
26 t.Fatalf("expected command twoarg, got %q", decl.Command)
27 }
28 if len(decl.CommandDataTypes) != 2 {
29 t.Fatalf("expected 2 command data types, got %d", len(decl.CommandDataTypes))
30 }
31 if decl.CommandDataTypes[0].Kind() != reflect.String || decl.CommandDataTypes[1].Kind() != reflect.Int {
32 t.Fatalf("unexpected command data types: %#v", decl.CommandDataTypes)
33 }
34 if len(decl.GetCommandDataTypes()) != 2 {
35 t.Fatalf("expected helper to return two command data types")
36 }
37}
38
39func TestGenerateWshCommandDeclMap_TestMultiArgCommand(t *testing.T) {
40 decl := GenerateWshCommandDeclMap()["testmultiarg"]

Callers

nothing calls this directly

Calls 2

generateWshCommandDeclFunction · 0.85
GetCommandDataTypesMethod · 0.80

Tested by

no test coverage detected