change non-working example to runnableExamples (#15841)

This commit is contained in:
flywind
2020-11-05 20:11:22 +08:00
committed by GitHub
parent dfa2f011d7
commit cae92f670a

View File

@@ -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"]