Skip to content

Commit

Permalink
function/stdlib: Update tests for newer Go versions
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
apparentlymart committed Aug 24, 2023
1 parent 560dd28 commit e24a128
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cty/function/stdlib/datetime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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`),
Expand Down

0 comments on commit e24a128

Please sign in to comment.