From 700fbd8b09ad3388478190f33822ead0c4bed7b9 Mon Sep 17 00:00:00 2001 From: jidicula Date: Sat, 16 Oct 2021 14:07:07 -0400 Subject: [PATCH] test(decode): Add cases for leap-day Resolves: part of pelletier/go-toml#613 --- unmarshaler_test.go | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/unmarshaler_test.go b/unmarshaler_test.go index 09666b6b..dcd09bac 100644 --- a/unmarshaler_test.go +++ b/unmarshaler_test.go @@ -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`, @@ -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`, }, }