Skip to content

Commit

Permalink
Test for macOS issue
Browse files Browse the repository at this point in the history
  • Loading branch information
benhoyt committed Sep 14, 2024
1 parent 180afd0 commit c3b5259
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions interp/interp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2860,3 +2860,21 @@ func BenchmarkCSVOutputWriter(b *testing.B) {
func normalizeNewlines(s string) string {
return strings.Replace(s, "\r\n", "\n", -1)
}

func TestFmtNegativeUnsigned1(t *testing.T) {
n := -42.0
result := fmt.Sprintf("%d %o %x %X", uint64(n), uint64(n), uint64(n), uint64(n))
expected := "18446744073709551574 1777777777777777777726 ffffffffffffffd6 FFFFFFFFFFFFFFD6"
if result != expected {
t.Errorf("got %q, want %q", result, expected)
}
}

func TestFmtNegativeUnsigned2(t *testing.T) {
n := int64(-42.0)
result := fmt.Sprintf("%d %o %x %X", uint64(n), uint64(n), uint64(n), uint64(n))
expected := "18446744073709551574 1777777777777777777726 ffffffffffffffd6 FFFFFFFFFFFFFFD6"
if result != expected {
t.Errorf("got %q, want %q", result, expected)
}
}

0 comments on commit c3b5259

Please sign in to comment.