1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
Description: Fix TestFloat and TestMixed with stretchr/testify v1.9.0
golang.org/stretchr/testify v1.9.0 breaks float comparisons with
EqualValues (see https://github.com/stretchr/testify/issues/1576)
and leads to the following test errors in go-arg:
.
--- FAIL: TestFloat (0.00s)
parse_test.go:115:
Error Trace: /home/foka/debian/go-team/alexflint/golang-github-alexflint-go-arg/parse_test.go:115
Error: Not equal:
expected: float64(3.4)
actual : float32(3.4)
Test: TestFloat
--- FAIL: TestMixed (0.00s)
parse_test.go:172:
Error Trace: /home/foka/debian/go-team/alexflint/golang-github-alexflint-go-arg/parse_test.go:172
Error: Not equal:
expected: float64(1.2)
actual : float32(1.2)
Test: TestMixed
FAIL
FAIL github.com/alexflint/go-arg 0.013s
FAIL
.
Switching from float32 to float64 fixes the tests whether stretchr/testify
v1.9.0 or an older version is used.
Author: Anthony Fok <foka@debian.org>
Origin: vendor
Forwarded: no
Last-Update: 2024-05-02
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/parse_test.go
+++ b/parse_test.go
@@ -220,8 +220,8 @@
func TestFloat(t *testing.T) {
var args struct {
- Foo float32
- Ptr *float32
+ Foo float64
+ Ptr *float64
}
err := parse("--foo 3.4 --ptr 3.5", &args)
require.NoError(t, err)
@@ -273,7 +273,7 @@
Bar int
Baz uint `arg:"positional"`
Ham bool
- Spam float32
+ Spam float64
}
args.Bar = 3
err := parse("123 -spam=1.2 -ham -f xyz", &args)
|