From e24a128788f22ca66dde8273b4e0f01061a6ada0 Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Thu, 24 Aug 2023 08:49:31 -0700 Subject: [PATCH] function/stdlib: Update tests for newer Go versions Our function for parsing conventional timestamps strings currently leans on the Go standard library "time" package's parser to help produce error messages, but that does means that some of our error messages for invalid timestamps end up being a little strange, and the details of that can vary with changes to Go's time parser. In future we should probably work to entirely divorce ourselves from Go's implementation (we're already dealing with _most_ of the parsing ourselves anyway) but for now we'll just update the expected result to match the current versions of the upstream parser. --- cty/function/stdlib/datetime_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cty/function/stdlib/datetime_test.go b/cty/function/stdlib/datetime_test.go index 9324f143..a881a1fe 100644 --- a/cty/function/stdlib/datetime_test.go +++ b/cty/function/stdlib/datetime_test.go @@ -206,9 +206,9 @@ func TestFormatDate(t *testing.T) { }, { cty.StringVal(`2-12-02T00:00:00Z`), - // Go parser seems to be trying to parse "2-12" as a year here, - // producing a confusing error message. - `not a valid RFC3339 timestamp: cannot use "-02T00:00:00Z" as year`, + // Go parser seems to be trying to parse the whole thing as a year + // here, producing a confusing error message. + `not a valid RFC3339 timestamp: cannot use "2-12-02T00:00:00Z" as year`, }, { cty.StringVal(`2000-01-01T1:12:34Z`),