Skip to content

Commit bae64a8

Browse files
Revert "fix: remove redundant TestStringify_Floats to resolve conflict"
1 parent fc88d9e commit bae64a8

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

github/strings_test.go

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,6 @@ func TestStringify_Primitives(t *testing.T) {
120120
// String Optimization
121121
{"hello", `"hello"`},
122122
{"", `""`},
123-
124-
// Struct with float
125-
{struct{ F float32 }{1.1}, "{F:1.1}"},
126123
}
127124

128125
for i, tt := range tests {
@@ -232,3 +229,23 @@ func TestString(t *testing.T) {
232229
}
233230
}
234231
}
232+
233+
func TestStringify_Floats(t *testing.T) {
234+
t.Parallel()
235+
tests := []struct {
236+
in any
237+
out string
238+
}{
239+
{float32(1.1), "1.1"},
240+
{float64(1.1), "1.1"},
241+
{float32(1.0000001), "1.0000001"},
242+
{struct{ F float32 }{1.1}, "{F:1.1}"},
243+
}
244+
245+
for i, tt := range tests {
246+
s := Stringify(tt.in)
247+
if s != tt.out {
248+
t.Errorf("%v. Stringify(%v) = %q, want %q", i, tt.in, s, tt.out)
249+
}
250+
}
251+
}

0 commit comments

Comments
 (0)