fix for nimInAction
This commit is contained in:
parent
161e14829a
commit
6946116272
16 changed files with 88 additions and 33 deletions
|
|
@ -297,25 +297,24 @@ proc testNimInAction(r: var TResults, cat: Category, options: string) =
|
||||||
# whoever edits these hashes without dom96's permission, j/k. But please only
|
# whoever edits these hashes without dom96's permission, j/k. But please only
|
||||||
# edit when making a conscious breaking change, also please try to make your
|
# edit when making a conscious breaking change, also please try to make your
|
||||||
# commit message clear and notify me so I can easily compile an errata later.
|
# commit message clear and notify me so I can easily compile an errata later.
|
||||||
var testHashes: seq[string] = @[]
|
|
||||||
|
|
||||||
for test in tests:
|
|
||||||
testHashes.add(getMD5(readFile("tests" / test.addFileExt("nim")).string))
|
|
||||||
|
|
||||||
const refHashes = @[
|
const refHashes = @[
|
||||||
"51afdfa84b3ca3d810809d6c4e5037ba", "30f07e4cd5eaec981f67868d4e91cfcf",
|
"51afdfa84b3ca3d810809d6c4e5037ba", "30f07e4cd5eaec981f67868d4e91cfcf",
|
||||||
"d14e7c032de36d219c9548066a97e846", "2e40bfd5daadb268268727da91bb4e81",
|
"d14e7c032de36d219c9548066a97e846", "2e40bfd5daadb268268727da91bb4e81",
|
||||||
"c5d3853ed0aba04bf6d35ba28a98dca0", "058603145ff92d46c009006b06e5b228",
|
"c5d3853ed0aba04bf6d35ba28a98dca0", "058603145ff92d46c009006b06e5b228",
|
||||||
"7b94a029b94ddb7efafddd546c965ff6", "586d74514394e49f2370dfc01dd9e830",
|
"7b94a029b94ddb7efafddd546c965ff6", "586d74514394e49f2370dfc01dd9e830",
|
||||||
"e1901837b757c9357dc8d259fd0ef0f6", "097670c7ae12e825debaf8ec3995227b",
|
"13febc363ed82585f2a60de40ddfefda", "c11a013db35e798f44077bc0763cc86d",
|
||||||
"a8cb7b78cc78d28535ab467361db5d6e", "bfaec2816a1848991b530c1ad17a0184",
|
"3e32e2c5e9a24bd13375e1cd0467079c", "0b9fe7ba159623d49ae60db18a15037c",
|
||||||
"47cb71bb4c1198d6d29cdbee05aa10b9", "87e4436809f9d73324cfc4f57f116770",
|
"b2dd5293d7f784824bbf9792c6fb51ad", "4c19d8d9026bfe151b31d7007fa3c237",
|
||||||
"7b7db5cddc8cf8fa9b6776eef1d0a31d", "e6e40219f0f2b877869b738737b7685e",
|
"9415c6a568cfceed08da8378e95b5cd5", "da520038c153f4054cb8cc5faa617714",
|
||||||
"6532ee87d819f2605a443d5e94f9422a", "9a8fe78c588d08018843b64b57409a02",
|
"e6c6e061b6f77b2475db6fec7abfb7f4", "9a8fe78c588d08018843b64b57409a02",
|
||||||
"03a801275b8b76b4170c870cd0da079d", "20bb7d3e2d38d43b0cb5fcff4909a4a8",
|
"8b5d28e985c0542163927d253a3e4fc9", "783299b98179cc725f9c46b5e3b5381f",
|
||||||
"af6844598f534fab6942abfa4dfe9ab2", "2a7a17f84f6503d9bc89a5ab8feea127"
|
"bc523f9a9921299090bac1af6c958e73", "80f9c3e594a798225046e8a42e990daf"
|
||||||
]
|
]
|
||||||
doAssert testHashes == refHashes, "Nim in Action tests were changed."
|
|
||||||
|
for i, test in tests:
|
||||||
|
let filename = "tests" / test.addFileExt("nim")
|
||||||
|
let testHash = getMD5(readFile(filename).string)
|
||||||
|
doAssert testHash == refHashes[i], "Nim in Action test " & filename & " was changed."
|
||||||
|
|
||||||
# Run the tests.
|
# Run the tests.
|
||||||
for testfile in tests:
|
for testfile in tests:
|
||||||
|
|
@ -328,8 +327,6 @@ proc testNimInAction(r: var TResults, cat: Category, options: string) =
|
||||||
testCPP cppFile
|
testCPP cppFile
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ------------------------- manyloc -------------------------------------------
|
# ------------------------- manyloc -------------------------------------------
|
||||||
#proc runSpecialTests(r: var TResults, options: string) =
|
#proc runSpecialTests(r: var TResults, options: string) =
|
||||||
# for t in ["lib/packages/docutils/highlite"]:
|
# for t in ["lib/packages/docutils/highlite"]:
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
discard """
|
||||||
|
action: compile
|
||||||
|
"""
|
||||||
|
|
||||||
import os, threadpool, asyncdispatch, asyncnet
|
import os, threadpool, asyncdispatch, asyncnet
|
||||||
import protocol
|
import protocol
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
discard """
|
||||||
|
action: compile
|
||||||
|
"""
|
||||||
|
|
||||||
import asyncdispatch, asyncnet
|
import asyncdispatch, asyncnet
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
@ -81,4 +85,4 @@ when isMainModule:
|
||||||
echo("Server initialised!")
|
echo("Server initialised!")
|
||||||
# Execute the ``loop`` procedure. The ``waitFor`` procedure will run the
|
# Execute the ``loop`` procedure. The ``waitFor`` procedure will run the
|
||||||
# asyncdispatch event loop until the ``loop`` procedure finishes executing.
|
# asyncdispatch event loop until the ``loop`` procedure finishes executing.
|
||||||
waitFor loop(server)
|
waitFor loop(server)
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,9 @@
|
||||||
|
discard """
|
||||||
|
output: '''
|
||||||
|
Future is no longer empty, 42
|
||||||
|
'''
|
||||||
|
"""
|
||||||
|
|
||||||
import threadpool
|
import threadpool
|
||||||
proc foo: string = "Dog"
|
proc foo: string = "Dog"
|
||||||
var x: FlowVar[string] = spawn foo()
|
var x: FlowVar[string] = spawn foo()
|
||||||
|
|
@ -33,9 +39,9 @@ let data = """
|
||||||
{"username": "Dominik"}
|
{"username": "Dominik"}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
let obj = parseJson(data)
|
let obj = parseJson(data)
|
||||||
assert obj.kind == JObject
|
assert obj.kind == JObject
|
||||||
assert obj["username"].kind == JString
|
assert obj["username"].kind == JString
|
||||||
assert obj["username"].str == "Dominik"
|
assert obj["username"].str == "Dominik"
|
||||||
|
|
||||||
block:
|
block:
|
||||||
|
|
@ -60,12 +66,12 @@ var amy = Human(name: "Amy", age: 20)
|
||||||
|
|
||||||
import asyncdispatch
|
import asyncdispatch
|
||||||
|
|
||||||
var future = newFuture[int]()
|
var future = newFuture[int]()
|
||||||
doAssert(not future.finished)
|
doAssert(not future.finished)
|
||||||
|
|
||||||
future.callback =
|
future.callback =
|
||||||
proc (future: Future[int]) =
|
proc (future: Future[int]) =
|
||||||
echo("Future is no longer empty, ", future.read)
|
echo("Future is no longer empty, ", future.read)
|
||||||
|
|
||||||
future.complete(42)
|
future.complete(42)
|
||||||
|
|
||||||
|
|
@ -85,9 +91,8 @@ import asyncdispatch, asyncfile, os
|
||||||
proc readFiles() {.async.} =
|
proc readFiles() {.async.} =
|
||||||
# --- Changed to getTempDir here.
|
# --- Changed to getTempDir here.
|
||||||
var file = openAsync(getTempDir() / "test.txt", fmReadWrite)
|
var file = openAsync(getTempDir() / "test.txt", fmReadWrite)
|
||||||
let data = await file.readAll()
|
let data = await file.readAll()
|
||||||
echo(data)
|
echo(data)
|
||||||
await file.write("Hello!\n")
|
await file.write("Hello!\n")
|
||||||
|
|
||||||
waitFor readFiles()
|
waitFor readFiles()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
discard """
|
||||||
|
action: compile
|
||||||
|
"""
|
||||||
|
|
||||||
# See this page for info about the format https://wikitech.wikimedia.org/wiki/Analytics/Data/Pagecounts-all-sites
|
# See this page for info about the format https://wikitech.wikimedia.org/wiki/Analytics/Data/Pagecounts-all-sites
|
||||||
import tables, parseutils, strutils, threadpool
|
import tables, parseutils, strutils, threadpool
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
discard """
|
||||||
|
action: compile
|
||||||
|
"""
|
||||||
|
|
||||||
# See this page for info about the format https://wikitech.wikimedia.org/wiki/Analytics/Data/Pagecounts-all-sites
|
# See this page for info about the format https://wikitech.wikimedia.org/wiki/Analytics/Data/Pagecounts-all-sites
|
||||||
import tables, parseutils, strutils, threadpool, re
|
import tables, parseutils, strutils, threadpool, re
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
discard """
|
||||||
|
action: compile
|
||||||
|
"""
|
||||||
|
|
||||||
# See this page for info about the format https://wikitech.wikimedia.org/wiki/Analytics/Data/Pagecounts-all-sites
|
# See this page for info about the format https://wikitech.wikimedia.org/wiki/Analytics/Data/Pagecounts-all-sites
|
||||||
import tables, parseutils, strutils
|
import tables, parseutils, strutils
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
discard """
|
||||||
|
action: compile
|
||||||
|
"""
|
||||||
|
|
||||||
import os, parseutils, threadpool, strutils
|
import os, parseutils, threadpool, strutils
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
@ -69,4 +73,4 @@ proc readPageCounts(filename: string, chunkSize = 1_000_000) =
|
||||||
when isMainModule:
|
when isMainModule:
|
||||||
const file = "pagecounts-20160101-050000"
|
const file = "pagecounts-20160101-050000"
|
||||||
let filename = getCurrentDir() / file
|
let filename = getCurrentDir() / file
|
||||||
readPageCounts(filename)
|
readPageCounts(filename)
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
discard """
|
||||||
|
action: compile
|
||||||
|
"""
|
||||||
|
|
||||||
import threadpool
|
import threadpool
|
||||||
|
|
||||||
var counter = 0
|
var counter = 0
|
||||||
|
|
@ -10,4 +14,4 @@ proc increment(x: int) =
|
||||||
spawn increment(10_000)
|
spawn increment(10_000)
|
||||||
spawn increment(10_000)
|
spawn increment(10_000)
|
||||||
sync()
|
sync()
|
||||||
echo(counter)
|
echo(counter)
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
discard """
|
||||||
|
action: compile
|
||||||
|
"""
|
||||||
|
|
||||||
import os, parseutils
|
import os, parseutils
|
||||||
|
|
||||||
proc parse(line: string, domainCode, pageTitle: var string,
|
proc parse(line: string, domainCode, pageTitle: var string,
|
||||||
|
|
@ -31,4 +35,4 @@ proc readPageCounts(filename: string) =
|
||||||
when isMainModule:
|
when isMainModule:
|
||||||
const file = "pagecounts-20160101-050000"
|
const file = "pagecounts-20160101-050000"
|
||||||
let filename = getCurrentDir() / file
|
let filename = getCurrentDir() / file
|
||||||
readPageCounts(filename)
|
readPageCounts(filename)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
|
discard """
|
||||||
|
output: "Database created successfully!"
|
||||||
|
"""
|
||||||
|
|
||||||
import database
|
import database
|
||||||
|
|
||||||
var db = newDatabase()
|
var db = newDatabase()
|
||||||
db.setup()
|
db.setup()
|
||||||
echo("Database created successfully!")
|
echo("Database created successfully!")
|
||||||
db.close()
|
db.close()
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
discard """
|
||||||
|
action: compile
|
||||||
|
"""
|
||||||
|
|
||||||
import asyncdispatch, times
|
import asyncdispatch, times
|
||||||
|
|
||||||
import jester
|
import jester
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
discard """
|
||||||
|
outputsub: "All tests finished successfully!"
|
||||||
|
"""
|
||||||
|
|
||||||
import database, os, times
|
import database, os, times
|
||||||
|
|
||||||
when isMainModule:
|
when isMainModule:
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
discard """
|
||||||
|
action: compile
|
||||||
|
"""
|
||||||
|
|
||||||
import dom
|
import dom
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
discard """
|
||||||
|
action: compile
|
||||||
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sdl
|
import sdl
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
discard """
|
discard """
|
||||||
disabled: "windows"
|
action: compile
|
||||||
|
disabled: "windows"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import sfml, os
|
import sfml, os
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue