diff options
Diffstat (limited to 'tests/nimdoc')
-rw-r--r-- | tests/nimdoc/m13129.nim | 1 | ||||
-rw-r--r-- | tests/nimdoc/trunnableexamples.nim | 23 | ||||
-rw-r--r-- | tests/nimdoc/trunnableexamples2.nim | 11 |
3 files changed, 14 insertions, 21 deletions
diff --git a/tests/nimdoc/m13129.nim b/tests/nimdoc/m13129.nim index 145cae39c..34e118381 100644 --- a/tests/nimdoc/m13129.nim +++ b/tests/nimdoc/m13129.nim @@ -4,6 +4,7 @@ when defined(cpp): {.push header: "<vector>".} type Vector[T] {.importcpp: "std::vector".} = object + {.pop.} elif defined(js): proc endsWith*(s, suffix: cstring): bool {.noSideEffect,importjs: "#.endsWith(#)".} elif defined(c): diff --git a/tests/nimdoc/trunnableexamples.nim b/tests/nimdoc/trunnableexamples.nim index ac7a0e26f..57e725b2e 100644 --- a/tests/nimdoc/trunnableexamples.nim +++ b/tests/nimdoc/trunnableexamples.nim @@ -1,5 +1,5 @@ discard """ -cmd: "nim doc --doccmd:--hints:off --hints:off $file" +cmd: '''nim doc --doccmd:"-d:testFooExternal --hints:off" --hints:off $file''' action: "compile" nimoutFull: true nimout: ''' @@ -7,7 +7,6 @@ foo1 foo2 foo3 foo5 -foo6 foo7 in examplesInTemplate1 doc in outer @@ -15,16 +14,11 @@ doc in inner1 doc in inner2 foo8 foo9 +foo6 ''' joinable: false """ -#[ -pending bug #18077, use instead: -cmd: "nim doc --doccmd:'-d:testFooExternal --hints:off' --hints:off $file" -and merge trunnableexamples2 back here -]# -{.define(testFooExternal).} proc fun*() = runnableExamples: @@ -43,7 +37,7 @@ proc fun*() = proc fun*()=echo "foo5" fun() - runnableExamples: + runnableExamples("--experimental:codeReordering --warnings:off"): # `codeReordering` only allowed at top level {.experimental: "codeReordering".} proc fun1() = fun2() @@ -65,7 +59,7 @@ when true: # issue #12746 runnableExamples: try: discard - except: + except CatchableError: # just the general except will work discard @@ -196,6 +190,10 @@ runnableExamples: proc fun*()=echo "foo9" fun() +# import std/assertions by default +runnableExamples("-d:nimPreviewSlimSystem"): + doAssert true + # note: there are yet other examples where putting runnableExamples at module # scope is needed, for example when using an `include` before an `import`, etc. @@ -208,3 +206,8 @@ snippet: doAssert defined(testFooExternal) ]## + +when true: # runnableExamples with rdoccmd + runnableExamples "-d:testFoo -d:testBar": + doAssert defined(testFoo) and defined(testBar) + doAssert defined(testFooExternal) diff --git a/tests/nimdoc/trunnableexamples2.nim b/tests/nimdoc/trunnableexamples2.nim deleted file mode 100644 index 5a437744e..000000000 --- a/tests/nimdoc/trunnableexamples2.nim +++ /dev/null @@ -1,11 +0,0 @@ -discard """ -cmd: "nim doc --doccmd:-d:testFooExternal --hints:off $file" -action: "compile" -joinable: false -""" - -# pending bug #18077, merge back inside trunnableexamples.nim -when true: # runnableExamples with rdoccmd - runnableExamples "-d:testFoo -d:testBar": - doAssert defined(testFoo) and defined(testBar) - doAssert defined(testFooExternal) |