summary refs log tree commit diff stats
path: root/lib/pure/sugar.nim
diff options
context:
space:
mode:
authorflywind <43030857+xflywind@users.noreply.github.com>2020-11-05 20:11:22 +0800
committerGitHub <noreply@github.com>2020-11-05 13:11:22 +0100
commitcae92f670a00ca1a343667dfeb5dfef208086f21 (patch)
treeb68d0ba931c1c61e800141729fce7ae6d066c3fb /lib/pure/sugar.nim
parentdfa2f011d7e7856074729d3d809d2848b9b897c1 (diff)
downloadNim-cae92f670a00ca1a343667dfeb5dfef208086f21.tar.gz
change non-working example to runnableExamples (#15841)
Diffstat (limited to 'lib/pure/sugar.nim')
-rw-r--r--lib/pure/sugar.nim12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/pure/sugar.nim b/lib/pure/sugar.nim
index dd44c731d..d0f85ad17 100644
--- a/lib/pure/sugar.nim
+++ b/lib/pure/sugar.nim
@@ -57,13 +57,11 @@ proc createProcType(p, b: NimNode): NimNode {.compileTime.} =
 
 macro `=>`*(p, b: untyped): untyped =
   ## Syntax sugar for anonymous procedures.
-  ##
-  ## .. code-block:: nim
-  ##
-  ##   proc passTwoAndTwo(f: (int, int) -> int): int =
-  ##     f(2, 2)
-  ##
-  ##   passTwoAndTwo((x, y) => x + y) # 4
+  runnableExamples:
+    proc passTwoAndTwo(f: (int, int) -> int): int =
+      f(2, 2)
+  
+    doAssert passTwoAndTwo((x, y) => x + y) == 4
 
   var
     params = @[ident"auto"]