Index: tests/lib/convert/json_toEncodable_reviver_test.dart |
diff --git a/tests/lib/convert/json_toEncodable_reviver_test.dart b/tests/lib/convert/json_toEncodable_reviver_test.dart |
index 58438875832ba8af0ec99feb114e2914d174648b..77ff1d4ac53ff2e3c98ce76b660461cfebabd7ad 100644 |
--- a/tests/lib/convert/json_toEncodable_reviver_test.dart |
+++ b/tests/lib/convert/json_toEncodable_reviver_test.dart |
@@ -38,4 +38,18 @@ main() { |
var a = extendedJson.decode(extendedJson.encode(new A(499))); |
Expect.isTrue(a is A); |
Expect.equals(499, a.x); |
+ |
+ testInvalidMap(); |
+} |
+ |
+ |
+void testInvalidMap() { |
+ var map = {"a" : 42, "b": 42, 37: 42}; // Non-string key. |
+ var enc = new JsonEncoder((_) => "fixed"); |
+ var res = enc.convert(map); |
+ Expect.equals('"fixed"', res); |
+ |
+ enc = new JsonEncoder.withIndent(" ", (_) => "fixed"); |
+ res = enc.convert(map); |
+ Expect.equals('"fixed"', res); |
} |