summary refs log tree commit diff stats
path: root/tests/stdlib/tjsonmacro_reject.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/stdlib/tjsonmacro_reject.nim')
-rw-r--r--tests/stdlib/tjsonmacro_reject.nim18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/stdlib/tjsonmacro_reject.nim b/tests/stdlib/tjsonmacro_reject.nim
new file mode 100644
index 000000000..00506449f
--- /dev/null
+++ b/tests/stdlib/tjsonmacro_reject.nim
@@ -0,0 +1,18 @@
+discard """
+  file: "tjsonmacro_reject.nim"
+  line: 11
+  errormsg: "Use a named tuple instead of: (string, float)"
+"""
+
+import json
+
+type
+  Car = object
+    engine: (string, float)
+    model: string
+
+let j = """
+  {"engine": {"name": "V8", "capacity": 5.5}, model: "Skyline"}
+"""
+let parsed = parseJson(j)
+echo(to(parsed, Car))
\ No newline at end of file