summaryrefslogtreecommitdiff
path: root/spew/format_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'spew/format_test.go')
-rw-r--r--spew/format_test.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/spew/format_test.go b/spew/format_test.go
index b151513..80c5ef9 100644
--- a/spew/format_test.go
+++ b/spew/format_test.go
@@ -1472,3 +1472,12 @@ func TestFormatter(t *testing.T) {
}
}
}
+
+func TestPrintSortedKeys(t *testing.T) {
+ cfg := spew.ConfigState{SortKeys: true}
+ s := cfg.Sprint(map[int]string{1: "1", 3: "3", 2: "2"})
+ expected := "map[1:1 2:2 3:3]"
+ if s != expected {
+ t.Errorf("Sorted keys mismatch:\n %v %v", s, expected)
+ }
+}