lots of small changes
This commit is contained in:
parent
c0c35839cc
commit
a5ecbf823f
85 changed files with 180 additions and 110 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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!")
|
||||
|
|
|
|||
|
|
@ -79,5 +79,5 @@ proc readChunks(filename: string, chunksize = 1000000): Stats =
|
|||
file.close()
|
||||
|
||||
|
||||
when isMainModule:
|
||||
when true:
|
||||
echo readChunks(filename)
|
||||
|
|
|
|||
|
|
@ -64,5 +64,5 @@ proc readChunks(filename: string, chunksize = 1000000): Stats =
|
|||
file.close()
|
||||
|
||||
|
||||
when isMainModule:
|
||||
when true:
|
||||
echo readChunks(filename)
|
||||
|
|
|
|||
|
|
@ -29,5 +29,5 @@ proc parse(filename: string): tuple[projectName, pageTitle: string,
|
|||
|
||||
file.close()
|
||||
|
||||
when isMainModule:
|
||||
when true:
|
||||
echo parse(filename)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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!"),
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue