use -r:off for runnableExamples that should compile but not run (#17203)
* use -r:off for runnableExamples that should compile but not run * use -r:off in other RT disabled tests
This commit is contained in:
parent
aef55a7a88
commit
dd6b0f81ef
5 changed files with 38 additions and 42 deletions
|
|
@ -13,8 +13,7 @@
|
||||||
## is used. This suffices because Windows' console already provides the
|
## is used. This suffices because Windows' console already provides the
|
||||||
## wanted functionality.
|
## wanted functionality.
|
||||||
|
|
||||||
runnableExamples:
|
runnableExamples("-r:off"):
|
||||||
if false:
|
|
||||||
echo readLineFromStdin("Is Nim awesome? (Y/n): ")
|
echo readLineFromStdin("Is Nim awesome? (Y/n): ")
|
||||||
var line: string
|
var line: string
|
||||||
while true:
|
while true:
|
||||||
|
|
|
||||||
|
|
@ -14,13 +14,11 @@
|
||||||
## application in production you should use a reverse proxy (for example nginx)
|
## application in production you should use a reverse proxy (for example nginx)
|
||||||
## instead of allowing users to connect directly to this server.
|
## instead of allowing users to connect directly to this server.
|
||||||
|
|
||||||
runnableExamples:
|
runnableExamples("-r:off"):
|
||||||
# This example will create an HTTP server on port 8080. The server will
|
# This example will create an HTTP server on port 8080. The server will
|
||||||
# respond to all requests with a `200 OK` response code and "Hello World"
|
# respond to all requests with a `200 OK` response code and "Hello World"
|
||||||
# as the response body. Run locally with:
|
# as the response body.
|
||||||
# `nim doc --doccmd:-d:nimAsyncHttpServerEnableTest --lib:lib lib/pure/asynchttpserver.nim`
|
|
||||||
import std/asyncdispatch
|
import std/asyncdispatch
|
||||||
if defined(nimAsyncHttpServerEnableTest):
|
|
||||||
proc main {.async.} =
|
proc main {.async.} =
|
||||||
const port = 8080
|
const port = 8080
|
||||||
var server = newAsyncHttpServer()
|
var server = newAsyncHttpServer()
|
||||||
|
|
|
||||||
|
|
@ -100,8 +100,8 @@ proc genOid*(): Oid =
|
||||||
## Generates a new OID.
|
## Generates a new OID.
|
||||||
runnableExamples:
|
runnableExamples:
|
||||||
doAssert ($genOid()).len == 24
|
doAssert ($genOid()).len == 24
|
||||||
if false: doAssert $genOid() == "5fc7f546ddbbc84800006aaf"
|
runnableExamples("-r:off"):
|
||||||
|
echo $genOid() # for example, "5fc7f546ddbbc84800006aaf"
|
||||||
genOid(result, incr, fuzz)
|
genOid(result, incr, fuzz)
|
||||||
|
|
||||||
proc generatedTime*(oid: Oid): Time =
|
proc generatedTime*(oid: Oid): Time =
|
||||||
|
|
|
||||||
|
|
@ -168,11 +168,11 @@ macro dump*(x: untyped): untyped =
|
||||||
## See also: `dumpToString` which is more convenient and useful since
|
## See also: `dumpToString` which is more convenient and useful since
|
||||||
## it expands intermediate templates/macros, returns a string instead of
|
## it expands intermediate templates/macros, returns a string instead of
|
||||||
## calling `echo`, and works with statements and expressions.
|
## calling `echo`, and works with statements and expressions.
|
||||||
runnableExamples:
|
runnableExamples("-r:off"):
|
||||||
let
|
let
|
||||||
x = 10
|
x = 10
|
||||||
y = 20
|
y = 20
|
||||||
if false: dump(x + y) # if true would print `x + y = 30`
|
dump(x + y) # prints: `x + y = 30`
|
||||||
|
|
||||||
let s = x.toStrLit
|
let s = x.toStrLit
|
||||||
result = quote do:
|
result = quote do:
|
||||||
|
|
|
||||||
|
|
@ -58,8 +58,7 @@ when defined nimExperimentalLinenoiseExtra:
|
||||||
## line editing API that allows returning the line entered and an indicator
|
## line editing API that allows returning the line entered and an indicator
|
||||||
## of which control key was entered, allowing user to distinguish between
|
## of which control key was entered, allowing user to distinguish between
|
||||||
## for example ctrl-C vs ctrl-D.
|
## for example ctrl-C vs ctrl-D.
|
||||||
runnableExamples("-d:nimExperimentalLinenoiseExtra"):
|
runnableExamples("-d:nimExperimentalLinenoiseExtra -r:off"):
|
||||||
if false:
|
|
||||||
var ret: ReadLineResult
|
var ret: ReadLineResult
|
||||||
while true:
|
while true:
|
||||||
readLineStatus("name: ", ret) # ctrl-D will exit, ctrl-C will go to next prompt
|
readLineStatus("name: ", ret) # ctrl-D will exit, ctrl-C will go to next prompt
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue