lots of small changes

This commit is contained in:
Arne Döring 2018-12-05 19:03:01 +01:00 • committed by Araq
commit a5ecbf823f
85 changed files with 180 additions and 110 deletions

View file

@ -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)

View file

@ -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!")

View file

@ -79,5 +79,5 @@ proc readChunks(filename: string, chunksize = 1000000): Stats =
file.close()
when isMainModule:
when true:
echo readChunks(filename)

View file

@ -64,5 +64,5 @@ proc readChunks(filename: string, chunksize = 1000000): Stats =
file.close()
when isMainModule:
when true:
echo readChunks(filename)

View file

@ -29,5 +29,5 @@ proc parse(filename: string): tuple[projectName, pageTitle: string,
file.close()
when isMainModule:
when true:
echo parse(filename)

View file

@ -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)

View file

@ -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)

View file

@ -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!"),

View file

@ -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()