mirror of
https://github.com/eiblog/eiblog.git
synced 2026-03-01 00:34:58 +08:00
avatar img use cache
This commit is contained in:
+11
@@ -968,6 +968,17 @@ func (s *S) TestUnmarshalSliceOnPreset(c *C) {
|
||||
c.Assert(v.A, DeepEquals, []int{2})
|
||||
}
|
||||
|
||||
func (s *S) TestUnmarshalStrict(c *C) {
|
||||
v := struct{ A, B int }{}
|
||||
|
||||
err := yaml.UnmarshalStrict([]byte("a: 1\nb: 2"), &v)
|
||||
c.Check(err, IsNil)
|
||||
err = yaml.Unmarshal([]byte("a: 1\nb: 2\nc: 3"), &v)
|
||||
c.Check(err, IsNil)
|
||||
err = yaml.UnmarshalStrict([]byte("a: 1\nb: 2\nc: 3"), &v)
|
||||
c.Check(err, ErrorMatches, "yaml: unmarshal errors:\n line 1: field c not found in struct struct { A int; B int }")
|
||||
}
|
||||
|
||||
//var data []byte
|
||||
//func init() {
|
||||
// var err error
|
||||
|
||||
Reference in New Issue
Block a user