mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-05-07 14:58:58 +08:00
refactor: stabilize runtime and unify config
This commit is contained in:
23
pkg/tools/arg_helpers_object_test.go
Normal file
23
pkg/tools/arg_helpers_object_test.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package tools
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestMapObjectArgReturnsEmptyMapForMissingValue(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
got := MapObjectArg(nil, "arguments")
|
||||
if got == nil || len(got) != 0 {
|
||||
t.Fatalf("expected empty map, got %#v", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMapObjectArgReturnsObjectValue(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
got := MapObjectArg(map[string]interface{}{
|
||||
"arguments": map[string]interface{}{"path": "README.md"},
|
||||
}, "arguments")
|
||||
if got["path"] != "README.md" {
|
||||
t.Fatalf("unexpected object arg: %#v", got)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user