diff --git a/console/command_executer_test.go b/console/command_executer_test.go index 1988660ee..e43f419a8 100644 --- a/console/command_executer_test.go +++ b/console/command_executer_test.go @@ -353,10 +353,27 @@ func TestCommandExecuterClientArgs(t *testing.T) { testStruct := &CommandExecuter{} testStruct.command = commands["accounts"] result := testStruct.clientArgs(testStruct.command.RpcParams(true)) - expected := []string{"Filter", "Limit", "Offset", "AccountIDs", "Tenant"} - sort.Slice(result, func(i, j int) bool { - return true - }) + expected := []string{"AccountIDs", "Filter", "Limit", "Offset", "Tenant"} + sort.Strings(result) + if !reflect.DeepEqual(expected, result) { + t.Errorf("Expected <%+v>, Received <%+v>", expected, result) + } +} + +type mockTest struct { + a int + B *bool + C struct { + } + D time.Time +} + +func TestCommandExecuterClientArgsCase(t *testing.T) { + testStruct := &CommandExecuter{} + testStruct.command = commands["accounts"] + result := testStruct.clientArgs(new(mockTest)) + expected := []string{"B", "D"} + sort.Strings(result) if !reflect.DeepEqual(expected, result) { t.Errorf("Expected <%+v>, Received <%+v>", expected, result) } diff --git a/console/parse_test.go b/console/parse_test.go index 8f427f27e..3a7ae18a7 100644 --- a/console/parse_test.go +++ b/console/parse_test.go @@ -125,11 +125,13 @@ func TestCmdParseLocalExecuteCase5(t *testing.T) { // for coverage purpose testStruct := &CmdParse{ rpcParams: &AttrParse{ - Expression: "~test_exp", - Value: "~test_value", + Expression: "~*req.Field{*duration}", + Value: "a", }, } - - testStruct.LocalExecute() - + expected := "time: invalid duration \"a\"" + received := testStruct.LocalExecute() + if !reflect.DeepEqual(received, expected) { + t.Errorf("Expected <%+v>, Received <%+v>", expected, received) + } }