Skip to content

Commit

Permalink
Cross tests pretty set printing (#1908)
Browse files Browse the repository at this point in the history
This PR adds sets to the pretty printing - they'd print PANIC otherwise.
  • Loading branch information
VenelinMartinov authored May 1, 2024
1 parent 49a6bff commit 875f071
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkg/tests/cross-tests/pretty.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,17 @@ func (s prettyValueWrapper) GoString() string {
fmt.Fprintf(&buf, ",")
}
fmt.Fprintf(&buf, "\n%s})", indent)
case v.Type().Is(tftypes.Set{}):
fmt.Fprintf(&buf, `tftypes.NewValue(%s, []tftypes.Value{`, tL)
var els []tftypes.Value
err := v.As(&els)
contract.AssertNoErrorf(err, "this cast should always succeed")
for _, el := range els {
fmt.Fprintf(&buf, "\n. %s", indent)
walk(level+1, el)
fmt.Fprintf(&buf, ",")
}
fmt.Fprintf(&buf, "\n%s})", indent)
case v.Type().Is(tftypes.Number):
var n big.Float
err := v.As(&n)
Expand Down

0 comments on commit 875f071

Please sign in to comment.