diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2018-05-06 08:03:29 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-05-06 08:03:29 +0200 |
commit | 272bbad7844aa6f5eead28c25942c3c2c5a24884 (patch) | |
tree | 4672b688ac7ac43c2bb160a9e46b06ccdbbad75d /tests | |
parent | dfc17e5f8e0652ebc4c693e5a5900a122b85ab95 (diff) | |
parent | d8fde9daba32019a35933cb97f482de5cf3669fa (diff) | |
download | Nim-272bbad7844aa6f5eead28c25942c3c2c5a24884.tar.gz |
Merge branch 'devel' into araq-parser-fixes
Diffstat (limited to 'tests')
-rw-r--r-- | tests/async/tasyncawait.nim | 12 | ||||
-rw-r--r-- | tests/collections/thashes.nim | 4 | ||||
-rw-r--r-- | tests/exprs/tstmtexprs.nim | 2 | ||||
-rw-r--r-- | tests/misc/tsimplesort.nim | 10 | ||||
-rw-r--r-- | tests/stdlib/ttimes.nim | 6 | ||||
-rw-r--r-- | tests/trmacros/thoist.nim | 2 | ||||
-rw-r--r-- | tests/typerel/texplicitcmp.nim | 4 |
7 files changed, 23 insertions, 17 deletions
diff --git a/tests/async/tasyncawait.nim b/tests/async/tasyncawait.nim index 9fe9507ad..74933f063 100644 --- a/tests/async/tasyncawait.nim +++ b/tests/async/tasyncawait.nim @@ -12,11 +12,11 @@ const var clientCount = 0 -proc sendMessages(client: TAsyncFD) {.async.} = +proc sendMessages(client: AsyncFD) {.async.} = for i in 0 .. <messagesToSend: await send(client, "Message " & $i & "\c\L") -proc launchSwarm(port: TPort) {.async.} = +proc launchSwarm(port: Port) {.async.} = for i in 0 .. <swarmSize: var sock = newAsyncNativeSocket() @@ -24,7 +24,7 @@ proc launchSwarm(port: TPort) {.async.} = await sendMessages(sock) closeSocket(sock) -proc readMessages(client: TAsyncFD) {.async.} = +proc readMessages(client: AsyncFD) {.async.} = while true: var line = await recvLine(client) if line == "": @@ -37,7 +37,7 @@ proc readMessages(client: TAsyncFD) {.async.} = else: doAssert false -proc createServer(port: TPort) {.async.} = +proc createServer(port: Port) {.async.} = var server = newAsyncNativeSocket() block: var name: Sockaddr_in @@ -55,8 +55,8 @@ proc createServer(port: TPort) {.async.} = while true: asyncCheck readMessages(await accept(server)) -asyncCheck createServer(TPort(10335)) -asyncCheck launchSwarm(TPort(10335)) +asyncCheck createServer(Port(10335)) +asyncCheck launchSwarm(Port(10335)) while true: poll() if clientCount == swarmSize: break diff --git a/tests/collections/thashes.nim b/tests/collections/thashes.nim index 76b99313c..5cc3cc8bb 100644 --- a/tests/collections/thashes.nim +++ b/tests/collections/thashes.nim @@ -3,7 +3,7 @@ discard """ """ import tables -from hashes import THash +from hashes import Hash # Test with int block: @@ -66,7 +66,7 @@ block: # The same test with a custom hash(s: string) does # work though. block: - proc hash(x: int): THash {.inline.} = + proc hash(x: int): Hash {.inline.} = echo "overloaded hash" result = x var t = initTable[int, int]() diff --git a/tests/exprs/tstmtexprs.nim b/tests/exprs/tstmtexprs.nim index 2a0ec2821..577f314ec 100644 --- a/tests/exprs/tstmtexprs.nim +++ b/tests/exprs/tstmtexprs.nim @@ -81,7 +81,7 @@ semiProblem() # bug #844 import json -proc parseResponse(): PJsonNode = +proc parseResponse(): JsonNode = result = % { "key1": % { "key2": % "value" } } for key, val in result["key1"]: var excMsg = key & "(" diff --git a/tests/misc/tsimplesort.nim b/tests/misc/tsimplesort.nim index 3115863d5..e4a8e0b37 100644 --- a/tests/misc/tsimplesort.nim +++ b/tests/misc/tsimplesort.nim @@ -40,11 +40,11 @@ proc mustRehash(length, counter: int): bool {.inline.} = assert(length > counter) result = (length * 2 < counter * 3) or (length - counter < 4) -proc nextTry(h, maxHash: THash): THash {.inline.} = +proc nextTry(h, maxHash: Hash): Hash {.inline.} = result = ((5 * h) + 1) and maxHash template rawGetImpl() = - var h: THash = hash(key) and high(t.data) # start with real hash value + var h: Hash = hash(key) and high(t.data) # start with real hash value while t.data[h].slot != seEmpty: if t.data[h].key == key and t.data[h].slot == seFilled: return h @@ -52,7 +52,7 @@ template rawGetImpl() = result = -1 template rawInsertImpl() = - var h: THash = hash(key) and high(data) + var h: Hash = hash(key) and high(data) while data[h].slot == seFilled: h = nextTry(h, high(data)) data[h].key = key @@ -162,7 +162,7 @@ iterator values*[A](t: TCountTable[A]): int = if t.data[h].val != 0: yield t.data[h].val proc RawGet[A](t: TCountTable[A], key: A): int = - var h: THash = hash(key) and high(t.data) # start with real hash value + var h: Hash = hash(key) and high(t.data) # start with real hash value while t.data[h].val != 0: if t.data[h].key == key: return h h = nextTry(h, high(t.data)) @@ -181,7 +181,7 @@ proc hasKey*[A](t: TCountTable[A], key: A): bool = proc rawInsert[A](t: TCountTable[A], data: var seq[tuple[key: A, val: int]], key: A, val: int) = - var h: THash = hash(key) and high(data) + var h: Hash = hash(key) and high(data) while data[h].val != 0: h = nextTry(h, high(data)) data[h].key = key data[h].val = val diff --git a/tests/stdlib/ttimes.nim b/tests/stdlib/ttimes.nim index 37e14c1e2..4ab3ba581 100644 --- a/tests/stdlib/ttimes.nim +++ b/tests/stdlib/ttimes.nim @@ -28,6 +28,12 @@ t.checkFormat("d dd ddd dddd h hh H HH m mm M MM MMM MMMM s" & t.checkFormat("yyyyMMddhhmmss", "20380119031407") +# issue 7620 +let t7620_am = parse("4/15/2017 12:01:02 AM +0", "M/d/yyyy' 'h:mm:ss' 'tt' 'z", utc()) +t7620_am.checkFormat("M/d/yyyy' 'h:mm:ss' 'tt' 'z", "4/15/2017 12:01:02 AM +0") +let t7620_pm = parse("4/15/2017 12:01:02 PM +0", "M/d/yyyy' 'h:mm:ss' 'tt' 'z", utc()) +t7620_pm.checkFormat("M/d/yyyy' 'h:mm:ss' 'tt' 'z", "4/15/2017 12:01:02 PM +0") + let t2 = fromUnix(160070789).utc # Mon 27 Jan 16:06:29 GMT 1975 t2.checkFormat("d dd ddd dddd h hh H HH m mm M MM MMM MMMM s" & " ss t tt y yy yyy yyyy yyyyy z zz zzz", diff --git a/tests/trmacros/thoist.nim b/tests/trmacros/thoist.nim index 7d14c0abf..657f210a1 100644 --- a/tests/trmacros/thoist.nim +++ b/tests/trmacros/thoist.nim @@ -5,7 +5,7 @@ true''' import pegs -template optPeg{peg(pattern)}(pattern: string{lit}): TPeg = +template optPeg{peg(pattern)}(pattern: string{lit}): Peg = var gl {.global, gensym.} = peg(pattern) gl diff --git a/tests/typerel/texplicitcmp.nim b/tests/typerel/texplicitcmp.nim index 8aec9885a..e91ac2ffe 100644 --- a/tests/typerel/texplicitcmp.nim +++ b/tests/typerel/texplicitcmp.nim @@ -18,7 +18,7 @@ proc works() = sort(f, system.cmp[int]) outp(f) -proc weird(json_params: TTable) = +proc weird(json_params: Table) = var f = @[3, 2, 1] # The following line doesn't compile: type mismatch. Why? sort(f, system.cmp[int]) @@ -29,4 +29,4 @@ when isMainModule: sort(t, system.cmp[int]) outp(t) works() - weird(initTable[string, TJsonNode]()) + weird(initTable[string, JsonNode]()) |