Skip to content

Commit 3903fc2

Browse files
authored
Tests: Use strconv to cast float to string for comparison (#408) (#409)
1 parent 6cbe91f commit 3903fc2

File tree

1 file changed

+1
-1
lines changed
  • internal/build/cmd/generate/commands/gentests

1 file changed

+1
-1
lines changed

internal/build/cmd/generate/commands/gentests/model.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ default:
667667
var specialCase string
668668
if strings.HasSuffix(key, "from") || strings.HasSuffix(key, "to") {
669669
specialCase = `else if floatValue, err := actual.(encjson.Number).Float64(); err == nil {
670-
actual = fmt.Sprintf("%d", int(floatValue))
670+
actual = strconv.FormatFloat(floatValue, 'f', -1, 64)
671671
} `
672672
}
673673

0 commit comments

Comments
 (0)