unmarshal: validate date (#622)
This commit is contained in:
@@ -353,6 +353,22 @@ func TestUnmarshal(t *testing.T) {
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "local leap-day date into interface",
|
||||
input: `a = 2020-02-29`,
|
||||
gen: func() test {
|
||||
type doc struct {
|
||||
A interface{}
|
||||
}
|
||||
|
||||
return test{
|
||||
target: &doc{},
|
||||
expected: &doc{
|
||||
A: toml.LocalDate{2020, 2, 29},
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "local-time with nano second",
|
||||
input: `a = 12:08:05.666666666`,
|
||||
@@ -2091,6 +2107,16 @@ world'`,
|
||||
desc: "multiline basic string with unfinished escape sequence after the first escape code",
|
||||
data: "a = \"\"\"\\t\\",
|
||||
},
|
||||
{
|
||||
desc: `impossible date-day`,
|
||||
data: `A = 2021-03-40T23:59:00`,
|
||||
msg: `impossible date`,
|
||||
},
|
||||
{
|
||||
desc: `leap day in non-leap year`,
|
||||
data: `A = 2021-02-29T23:59:00`,
|
||||
msg: `impossible date`,
|
||||
},
|
||||
}
|
||||
|
||||
for _, e := range examples {
|
||||
|
||||
Reference in New Issue
Block a user