mirror of
https://github.com/eiblog/eiblog.git
synced 2026-02-13 01:42:27 +08:00
20 lines
279 B
Go
20 lines
279 B
Go
package jsonutil
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func Test(t *testing.T) {
|
|
|
|
var ret struct {
|
|
Id string `json:"id"`
|
|
}
|
|
err := Unmarshal(`{"id": "123"}`, &ret)
|
|
if err != nil {
|
|
t.Fatal("Unmarshal failed:", err)
|
|
}
|
|
if ret.Id != "123" {
|
|
t.Fatal("Unmarshal uncorrect:", ret.Id)
|
|
}
|
|
}
|