fix for nimInAction

This commit is contained in:
Arne Döring
2018-11-20 11:08:18 +01:00
committed by Araq
parent 161e14829a
commit 6946116272
16 changed files with 88 additions and 33 deletions

View File

@@ -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
# 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.
var testHashes: seq[string] = @[]
for test in tests:
testHashes.add(getMD5(readFile("tests" / test.addFileExt("nim")).string))
const refHashes = @[
"51afdfa84b3ca3d810809d6c4e5037ba", "30f07e4cd5eaec981f67868d4e91cfcf",
"d14e7c032de36d219c9548066a97e846", "2e40bfd5daadb268268727da91bb4e81",
"c5d3853ed0aba04bf6d35ba28a98dca0", "058603145ff92d46c009006b06e5b228",
"7b94a029b94ddb7efafddd546c965ff6", "586d74514394e49f2370dfc01dd9e830",
"e1901837b757c9357dc8d259fd0ef0f6", "097670c7ae12e825debaf8ec3995227b",
"a8cb7b78cc78d28535ab467361db5d6e", "bfaec2816a1848991b530c1ad17a0184",
"47cb71bb4c1198d6d29cdbee05aa10b9", "87e4436809f9d73324cfc4f57f116770",
"7b7db5cddc8cf8fa9b6776eef1d0a31d", "e6e40219f0f2b877869b738737b7685e",
"6532ee87d819f2605a443d5e94f9422a", "9a8fe78c588d08018843b64b57409a02",
"03a801275b8b76b4170c870cd0da079d", "20bb7d3e2d38d43b0cb5fcff4909a4a8",
"af6844598f534fab6942abfa4dfe9ab2", "2a7a17f84f6503d9bc89a5ab8feea127"
"13febc363ed82585f2a60de40ddfefda", "c11a013db35e798f44077bc0763cc86d",
"3e32e2c5e9a24bd13375e1cd0467079c", "0b9fe7ba159623d49ae60db18a15037c",
"b2dd5293d7f784824bbf9792c6fb51ad", "4c19d8d9026bfe151b31d7007fa3c237",
"9415c6a568cfceed08da8378e95b5cd5", "da520038c153f4054cb8cc5faa617714",
"e6c6e061b6f77b2475db6fec7abfb7f4", "9a8fe78c588d08018843b64b57409a02",
"8b5d28e985c0542163927d253a3e4fc9", "783299b98179cc725f9c46b5e3b5381f",
"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.
for testfile in tests:
@@ -328,8 +327,6 @@ proc testNimInAction(r: var TResults, cat: Category, options: string) =
testCPP cppFile
# ------------------------- manyloc -------------------------------------------
#proc runSpecialTests(r: var TResults, options: string) =
# for t in ["lib/packages/docutils/highlite"]:

View File

@@ -1,3 +1,7 @@
discard """
action: compile
"""
import os, threadpool, asyncdispatch, asyncnet
import protocol

View File

@@ -1,3 +1,7 @@
discard """
action: compile
"""
import asyncdispatch, asyncnet
type
@@ -81,4 +85,4 @@ when isMainModule:
echo("Server initialised!")
# Execute the ``loop`` procedure. The ``waitFor`` procedure will run the
# asyncdispatch event loop until the ``loop`` procedure finishes executing.
waitFor loop(server)
waitFor loop(server)

View File

@@ -1,3 +1,9 @@
discard """
output: '''
Future is no longer empty, 42
'''
"""
import threadpool
proc foo: string = "Dog"
var x: FlowVar[string] = spawn foo()
@@ -33,9 +39,9 @@ let data = """
{"username": "Dominik"}
"""
let obj = parseJson(data)
assert obj.kind == JObject
assert obj["username"].kind == JString
let obj = parseJson(data)
assert obj.kind == JObject
assert obj["username"].kind == JString
assert obj["username"].str == "Dominik"
block:
@@ -60,12 +66,12 @@ var amy = Human(name: "Amy", age: 20)
import asyncdispatch
var future = newFuture[int]()
doAssert(not future.finished)
var future = newFuture[int]()
doAssert(not future.finished)
future.callback =
proc (future: Future[int]) =
echo("Future is no longer empty, ", future.read)
future.callback =
proc (future: Future[int]) =
echo("Future is no longer empty, ", future.read)
future.complete(42)
@@ -85,9 +91,8 @@ import asyncdispatch, asyncfile, os
proc readFiles() {.async.} =
# --- Changed to getTempDir here.
var file = openAsync(getTempDir() / "test.txt", fmReadWrite)
let data = await file.readAll()
echo(data)
await file.write("Hello!\n")
let data = await file.readAll()
echo(data)
await file.write("Hello!\n")
waitFor readFiles()

View File

@@ -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
import tables, parseutils, strutils, threadpool

View File

@@ -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
import tables, parseutils, strutils, threadpool, re

View File

@@ -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
import tables, parseutils, strutils

View File

@@ -1,3 +1,7 @@
discard """
action: compile
"""
import os, parseutils, threadpool, strutils
type
@@ -69,4 +73,4 @@ proc readPageCounts(filename: string, chunkSize = 1_000_000) =
when isMainModule:
const file = "pagecounts-20160101-050000"
let filename = getCurrentDir() / file
readPageCounts(filename)
readPageCounts(filename)

View File

@@ -1,3 +1,7 @@
discard """
action: compile
"""
import threadpool
var counter = 0
@@ -10,4 +14,4 @@ proc increment(x: int) =
spawn increment(10_000)
spawn increment(10_000)
sync()
echo(counter)
echo(counter)

View File

@@ -1,3 +1,7 @@
discard """
action: compile
"""
import os, parseutils
proc parse(line: string, domainCode, pageTitle: var string,
@@ -31,4 +35,4 @@ proc readPageCounts(filename: string) =
when isMainModule:
const file = "pagecounts-20160101-050000"
let filename = getCurrentDir() / file
readPageCounts(filename)
readPageCounts(filename)

View File

@@ -1,6 +1,10 @@
discard """
output: "Database created successfully!"
"""
import database
var db = newDatabase()
db.setup()
echo("Database created successfully!")
db.close()
db.close()

View File

@@ -1,3 +1,7 @@
discard """
action: compile
"""
import asyncdispatch, times
import jester

View File

@@ -1,3 +1,7 @@
discard """
outputsub: "All tests finished successfully!"
"""
import database, os, times
when isMainModule:

View File

@@ -1,3 +1,7 @@
discard """
action: compile
"""
import dom
type

View File

@@ -1,3 +1,7 @@
discard """
action: compile
"""
import os
import sdl

View File

@@ -1,5 +1,6 @@
discard """
disabled: "windows"
action: compile
disabled: "windows"
"""
import sfml, os