Skip to content

Commit

Permalink
test(decode): Add cases for leap-day
Browse files Browse the repository at this point in the history
Resolves: part of pelletier#613
  • Loading branch information
jidicula committed Oct 16, 2021
1 parent 2119fde commit 700fbd8
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions unmarshaler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,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`,
Expand Down Expand Up @@ -2010,9 +2026,14 @@ world'`,
data: `A = non`,
},
{
desc: `invalid local date`,
desc: `impossible date-day`,
data: `A = 2021-03-40T23:59:00`,
msg: `invalid local date`,
msg: `impossible date`,
},
{
desc: `leap day in non-leap year`,
data: `A = 2021-02-29T23:59:00`,
msg: `impossible date`,
},
}

Expand Down

0 comments on commit 700fbd8

Please sign in to comment.