From abcd9fd2e8120caf6e4588dabe0f22ae0cce07d3 Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Wed, 30 Jan 2019 22:19:16 -0800 Subject: fixup #10466 to use runnableExamples (#10510) --- lib/pure/json.nim | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/lib/pure/json.nim b/lib/pure/json.nim index 4a3d5b432..176da1d9d 100644 --- a/lib/pure/json.nim +++ b/lib/pure/json.nim @@ -710,23 +710,20 @@ proc pretty*(node: JsonNode, indent = 2): string = ## on multiple lines. ## ## Similar to prettyprint in Python. - ## - ## **Examples:** - ## - ## .. code-block:: Nim - ## let j = %* {"name": "Isaac", "books": ["Robot Dreams"], - ## "details": {"age":35, "pi":3.1415}} - ## echo pretty(j) - ## # { - ## # "name": "Isaac", - ## # "books": [ - ## # "Robot Dreams" - ## # ], - ## # "details": { - ## # "age": 35, - ## # "pi": 3.1415 - ## # } - ## # } + runnableExamples: + let j = %* {"name": "Isaac", "books": ["Robot Dreams"], + "details": {"age":35, "pi":3.1415}} + doAssert pretty(j) == """ +{ + "name": "Isaac", + "books": [ + "Robot Dreams" + ], + "details": { + "age": 35, + "pi": 3.1415 + } +}""" result = "" toPretty(result, node, indent) -- cgit 1.4.1-2-gfad0