diff options
Diffstat (limited to 'tests/niminaction')
14 files changed, 21 insertions, 21 deletions
diff --git a/tests/niminaction/Chapter2/explicit_discard.nim b/tests/niminaction/Chapter2/explicit_discard.nim index 3e94c335b..9a3b4407e 100644 --- a/tests/niminaction/Chapter2/explicit_discard.nim +++ b/tests/niminaction/Chapter2/explicit_discard.nim @@ -1,7 +1,7 @@ discard """ - line: 7 errormsg: "has to be discarded" + line: 7 """ proc myProc(name: string): string = "Hello " & name -myProc("Dominik") \ No newline at end of file +myProc("Dominik") diff --git a/tests/niminaction/Chapter2/no_def_eq.nim b/tests/niminaction/Chapter2/no_def_eq.nim index 77f0a7dd8..b9d62e036 100644 --- a/tests/niminaction/Chapter2/no_def_eq.nim +++ b/tests/niminaction/Chapter2/no_def_eq.nim @@ -1,6 +1,6 @@ discard """ - line: 16 errormsg: "type mismatch" + line: 16 """ type @@ -13,4 +13,4 @@ type let dog: Dog = Dog(name: "Fluffy") let cat: Cat = Cat(name: "Fluffy") -echo(dog == cat) \ No newline at end of file +echo(dog == cat) diff --git a/tests/niminaction/Chapter2/no_iterator.nim b/tests/niminaction/Chapter2/no_iterator.nim index 331d69480..555fac21a 100644 --- a/tests/niminaction/Chapter2/no_iterator.nim +++ b/tests/niminaction/Chapter2/no_iterator.nim @@ -1,7 +1,7 @@ discard """ - line: 6 errormsg: "type mismatch" + line: 6 """ for i in 5: - echo i \ No newline at end of file + echo i diff --git a/tests/niminaction/Chapter2/no_seq_type.nim b/tests/niminaction/Chapter2/no_seq_type.nim index 493be270a..f1494124b 100644 --- a/tests/niminaction/Chapter2/no_seq_type.nim +++ b/tests/niminaction/Chapter2/no_seq_type.nim @@ -1,6 +1,6 @@ discard """ - line: 6 errormsg: "cannot infer the type of the sequence" + line: 6 """ -var list = @[] \ No newline at end of file +var list = @[] diff --git a/tests/niminaction/Chapter2/resultreject.nim b/tests/niminaction/Chapter2/resultreject.nim index de59af7d9..87c84bf0a 100644 --- a/tests/niminaction/Chapter2/resultreject.nim +++ b/tests/niminaction/Chapter2/resultreject.nim @@ -1,13 +1,13 @@ discard """ - line: 27 errormsg: "has to be discarded" + line: 27 """ # Page 35. proc implicit: string = "I will be returned" - + proc discarded: string = discard "I will not be returned" @@ -16,7 +16,7 @@ proc explicit: string = proc resultVar: string = result = "I will be returned" - + proc resultVar2: string = result = "" result.add("I will be ") @@ -30,4 +30,4 @@ doAssert implicit() == "I will be returned" doAssert discarded() == nil doAssert explicit() == "I will be returned" doAssert resultVar() == "I will be returned" -doAssert resultVar2() == "I will be returned" \ No newline at end of file +doAssert resultVar2() == "I will be returned" diff --git a/tests/niminaction/Chapter3/ChatApp/src/protocol.nim b/tests/niminaction/Chapter3/ChatApp/src/protocol.nim index af515861c..4c122d4cc 100644 --- a/tests/niminaction/Chapter3/ChatApp/src/protocol.nim +++ b/tests/niminaction/Chapter3/ChatApp/src/protocol.nim @@ -37,7 +37,7 @@ proc createMessage*(username, message: string): string = "message": %message }) & "\c\l" -when isMainModule: +when true: block: let data = """{"username": "dom", "message": "hello"}""" let parsed = parseMessage(data) diff --git a/tests/niminaction/Chapter3/ChatApp/src/server.nim b/tests/niminaction/Chapter3/ChatApp/src/server.nim index 31da74d16..fbf0e5110 100644 --- a/tests/niminaction/Chapter3/ChatApp/src/server.nim +++ b/tests/niminaction/Chapter3/ChatApp/src/server.nim @@ -79,7 +79,7 @@ proc loop(server: Server, port = 7687) {.async.} = # Check whether this module has been imported as a dependency to another # module, or whether this module is the main module. -when isMainModule: +when true: # Initialise a new server. var server = newServer() echo("Server initialised!") diff --git a/tests/niminaction/Chapter6/WikipediaStats/concurrency.nim b/tests/niminaction/Chapter6/WikipediaStats/concurrency.nim index f20e21f4d..766f07fa5 100644 --- a/tests/niminaction/Chapter6/WikipediaStats/concurrency.nim +++ b/tests/niminaction/Chapter6/WikipediaStats/concurrency.nim @@ -79,5 +79,5 @@ proc readChunks(filename: string, chunksize = 1000000): Stats = file.close() -when isMainModule: +when true: echo readChunks(filename) diff --git a/tests/niminaction/Chapter6/WikipediaStats/concurrency_regex.nim b/tests/niminaction/Chapter6/WikipediaStats/concurrency_regex.nim index dbd635634..19b157926 100644 --- a/tests/niminaction/Chapter6/WikipediaStats/concurrency_regex.nim +++ b/tests/niminaction/Chapter6/WikipediaStats/concurrency_regex.nim @@ -64,5 +64,5 @@ proc readChunks(filename: string, chunksize = 1000000): Stats = file.close() -when isMainModule: +when true: echo readChunks(filename) diff --git a/tests/niminaction/Chapter6/WikipediaStats/naive.nim b/tests/niminaction/Chapter6/WikipediaStats/naive.nim index ce995efaf..687177f74 100644 --- a/tests/niminaction/Chapter6/WikipediaStats/naive.nim +++ b/tests/niminaction/Chapter6/WikipediaStats/naive.nim @@ -29,5 +29,5 @@ proc parse(filename: string): tuple[projectName, pageTitle: string, file.close() -when isMainModule: +when true: echo parse(filename) diff --git a/tests/niminaction/Chapter6/WikipediaStats/parallel_counts.nim b/tests/niminaction/Chapter6/WikipediaStats/parallel_counts.nim index 74857367a..2c4a59d83 100644 --- a/tests/niminaction/Chapter6/WikipediaStats/parallel_counts.nim +++ b/tests/niminaction/Chapter6/WikipediaStats/parallel_counts.nim @@ -70,7 +70,7 @@ proc readPageCounts(filename: string, chunkSize = 1_000_000) = echo("Most popular is: ", mostPopular) -when isMainModule: +when true: const file = "pagecounts-20160101-050000" let filename = getCurrentDir() / file readPageCounts(filename) diff --git a/tests/niminaction/Chapter6/WikipediaStats/sequential_counts.nim b/tests/niminaction/Chapter6/WikipediaStats/sequential_counts.nim index 102dd15d3..f4bae3df5 100644 --- a/tests/niminaction/Chapter6/WikipediaStats/sequential_counts.nim +++ b/tests/niminaction/Chapter6/WikipediaStats/sequential_counts.nim @@ -32,7 +32,7 @@ proc readPageCounts(filename: string) = echo("Most popular is: ", mostPopular) -when isMainModule: +when true: const file = "pagecounts-20160101-050000" let filename = getCurrentDir() / file readPageCounts(filename) diff --git a/tests/niminaction/Chapter7/Tweeter/src/views/user.nim b/tests/niminaction/Chapter7/Tweeter/src/views/user.nim index f3791b493..18f3713b3 100644 --- a/tests/niminaction/Chapter7/Tweeter/src/views/user.nim +++ b/tests/niminaction/Chapter7/Tweeter/src/views/user.nim @@ -40,7 +40,7 @@ </div> #end proc # -#when isMainModule: +#when true: # echo renderUser(User(username: "d0m96<>", following: @[])) # echo renderMessages(@[ # Message(username: "d0m96", time: getTime(), msg: "Hello World!"), diff --git a/tests/niminaction/Chapter7/Tweeter/tests/database_test.nim b/tests/niminaction/Chapter7/Tweeter/tests/database_test.nim index da69a004c..a3cab4cba 100644 --- a/tests/niminaction/Chapter7/Tweeter/tests/database_test.nim +++ b/tests/niminaction/Chapter7/Tweeter/tests/database_test.nim @@ -4,7 +4,7 @@ outputsub: "All tests finished successfully!" import database, os, times -when isMainModule: +when true: removeFile("tweeter_test.db") var db = newDatabase("tweeter_test.db") db.setup() |