Closed navytux closed 3 months ago
(adjusted the first patch to also come with tests)
interdiff:
--- a/ogorek_test.go
+++ b/ogorek_test.go
@@ -964,6 +964,24 @@ func TestUnquoteCharEOF(t *testing.T) {
}
}
+func TestStringsFmt(t *testing.T) {
+ tvhash := []struct{
+ in interface{}
+ vhashok string
+ }{
+ {"мир", `"мир"`},
+ {Bytes("мир"), `ogórek.Bytes("мир")`},
+ {unicode("мир"), `ogórek.unicode("мир")`},
+ }
+
+ for _, tt := range tvhash {
+ vhash := fmt.Sprintf("%#v", tt.in)
+ if vhash != tt.vhashok {
+ t.Errorf("%T %q: %%#v:\nhave: %s\nwant: %s", tt.in, tt.in, vhash, tt.vhashok)
+ }
+ }
+}
+
// like io.LimitedReader but for writes
// XXX it would be good to have it in stdlib
type LimitedWriter struct {
Kamil, thanks for the approval.
I appled the patches to master myself as 1fea98e4f7aeffc5c3cb0d4cf87dd61877715b89 and 09fec8bdc113401306abc6280a8d0f3a99d9c48b. Hope it is ok.
Please see individual patches for details.