mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-04-13 04:27:28 +08:00
24 lines
519 B
Go
24 lines
519 B
Go
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)
|
|
}
|
|
}
|