From d91368c8d0602b343546e16c26c8ad297d48d188 Mon Sep 17 00:00:00 2001 From: def Date: Wed, 4 Feb 2015 19:47:58 +0100 Subject: [PATCH 01/18] Add test for #1836 --- tests/iter/tconcat.nim | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tests/iter/tconcat.nim diff --git a/tests/iter/tconcat.nim b/tests/iter/tconcat.nim new file mode 100644 index 0000000000..c0dab57190 --- /dev/null +++ b/tests/iter/tconcat.nim @@ -0,0 +1,17 @@ +discard """ + output: '''DabcD''' +""" + +proc toIter*[T](s: Slice[T]): iterator: T = + iterator it: T {.closure.} = + for x in s.a..s.b: + yield x + return it + +iterator concat*[T](its: varargs[T, toIter]): auto = + for i in its: + for x in i(): + yield x + +for i in concat(1..4, 20..23): + echo i From 69b794cd7dcfe553ab19ad78630d0b237c096050 Mon Sep 17 00:00:00 2001 From: def Date: Wed, 4 Feb 2015 19:53:50 +0100 Subject: [PATCH 02/18] Add test for #1259 --- tests/template/tscope.nim | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 tests/template/tscope.nim diff --git a/tests/template/tscope.nim b/tests/template/tscope.nim new file mode 100644 index 0000000000..2d5841af39 --- /dev/null +++ b/tests/template/tscope.nim @@ -0,0 +1,12 @@ +discard """ + errormsg: "redefinition of 'x'" +""" + +var x = 1 +template quantity(): stmt {.immediate.} = + # Causes internal error in compiler/sem.nim + proc unit*(x = 1.0): float = 12 + # Throws the correct error: redefinition of 'x' + #proc unit*(y = 1.0): float = 12 +quantity() +var x = 2 From 402ada8f1d84c9a3dbdbb1bc73d8c512e97b04c3 Mon Sep 17 00:00:00 2001 From: def Date: Wed, 4 Feb 2015 20:00:28 +0100 Subject: [PATCH 03/18] Add test for #1877 --- tests/static/tmatrix.nim | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/static/tmatrix.nim diff --git a/tests/static/tmatrix.nim b/tests/static/tmatrix.nim new file mode 100644 index 0000000000..d8cc5d14db --- /dev/null +++ b/tests/static/tmatrix.nim @@ -0,0 +1,19 @@ +discard """ + output: "111" +""" + +type Matrix[M,N: static[int]] = array[M, array[N, float]] + +let a = [[1.0, 1.0, 1.0, 1.0], + [2.0, 4.0, 8.0, 16.0], + [3.0, 9.0, 27.0, 81.0], + [4.0, 16.0, 64.0, 256.0]] + +proc `$`(m: Matrix): string = + result = "" + +proc `*`[M,N,M2,N2](a: Matrix[M,N2]; b: Matrix[M2,N]): Matrix[M,N] = + discard + +echo a * a + From c3989f64ef9fb0bfe54dad576144536259e8d03c Mon Sep 17 00:00:00 2001 From: def Date: Wed, 4 Feb 2015 20:08:26 +0100 Subject: [PATCH 04/18] Add test for #1459 --- tests/cpp/ttypeinfo.nim | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 tests/cpp/ttypeinfo.nim diff --git a/tests/cpp/ttypeinfo.nim b/tests/cpp/ttypeinfo.nim new file mode 100644 index 0000000000..e72883dbf2 --- /dev/null +++ b/tests/cpp/ttypeinfo.nim @@ -0,0 +1,5 @@ +discard """ + cmd: "nim cpp $target" +""" + +import typeinfo From 19993d73ed6e4b5ddfea704897bb9b20e72895dd Mon Sep 17 00:00:00 2001 From: def Date: Wed, 4 Feb 2015 20:10:50 +0100 Subject: [PATCH 05/18] Add test for #1460 --- tests/cpp/trawsockets.nim | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 tests/cpp/trawsockets.nim diff --git a/tests/cpp/trawsockets.nim b/tests/cpp/trawsockets.nim new file mode 100644 index 0000000000..d034245d00 --- /dev/null +++ b/tests/cpp/trawsockets.nim @@ -0,0 +1,5 @@ +discard """ + cmd: "nim cpp $target" +""" + +import rawsockets From 1b91b3a2a516479b16288c0b8b02ef4a84549f0e Mon Sep 17 00:00:00 2001 From: def Date: Wed, 4 Feb 2015 20:10:57 +0100 Subject: [PATCH 06/18] Disable rodfiles tests for now --- tests/testament/categories.nim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/testament/categories.nim b/tests/testament/categories.nim index 5cd5c15457..54e9626932 100644 --- a/tests/testament/categories.nim +++ b/tests/testament/categories.nim @@ -330,8 +330,9 @@ proc `&?.`(a, b: string): string = proc processCategory(r: var TResults, cat: Category, options: string) = case cat.string.normalize of "rodfiles": - compileRodFiles(r, cat, options) - runRodFiles(r, cat, options) + discard # Disabled for now + #compileRodFiles(r, cat, options) + #runRodFiles(r, cat, options) of "js": # XXX JS doesn't need to be special anymore jsTests(r, cat, options) From e0ae9f524840cade68f6293a2b2731b7b66c9649 Mon Sep 17 00:00:00 2001 From: def Date: Wed, 4 Feb 2015 20:22:58 +0100 Subject: [PATCH 07/18] Clean up tests/stdlib 2 tests still fail: - tircbot would need a benign pragma because of the locks - tgetfileinfo uses os.getFileInfo() on nil, which segfaults instead of throwing an exception as the tester expects --- tests/stdlib/tdialogs.nim | 8 +++--- tests/stdlib/tgetfileinfo.nim | 9 ++++-- tests/stdlib/tircbot.nim | 53 ++++++++++++++++++----------------- 3 files changed, 37 insertions(+), 33 deletions(-) diff --git a/tests/stdlib/tdialogs.nim b/tests/stdlib/tdialogs.nim index d161a976de..f0203d3197 100644 --- a/tests/stdlib/tdialogs.nim +++ b/tests/stdlib/tdialogs.nim @@ -4,7 +4,7 @@ import dialogs, gtk2 gtk2.nimrod_init() -var x = ChooseFilesToOpen(nil) +var x = chooseFilesToOpen(nil) for a in items(x): writeln(stdout, a) @@ -12,6 +12,6 @@ info(nil, "start with an info box") warning(nil, "now a warning ...") error(nil, "... and an error!") -writeln(stdout, ChooseFileToOpen(nil)) -writeln(stdout, ChooseFileToSave(nil)) -writeln(stdout, ChooseDir(nil)) +writeln(stdout, chooseFileToOpen(nil)) +writeln(stdout, chooseFileToSave(nil)) +writeln(stdout, chooseDir(nil)) diff --git a/tests/stdlib/tgetfileinfo.nim b/tests/stdlib/tgetfileinfo.nim index 49a0190619..c8e496cc1e 100644 --- a/tests/stdlib/tgetfileinfo.nim +++ b/tests/stdlib/tgetfileinfo.nim @@ -32,7 +32,7 @@ proc caseOneAndTwo(followLink: bool) = try: discard getFileInfo(getAppFilename(), followLink) #echo("String : Existing File : Symlink $# : Success" % $followLink) - except EOS: + except OSError: echo("String : Existing File : Symlink $# : Failure" % $followLink) proc caseThreeAndFour(followLink: bool) = @@ -40,7 +40,8 @@ proc caseThreeAndFour(followLink: bool) = try: discard getFileInfo(invalidName, true) echo("String : Non-existing File : Symlink $# : Failure" % $followLink) - except EOS: + except OSError: + discard #echo("String : Non-existing File : Symlink $# : Success" % $followLink) proc testGetFileInfo = @@ -82,12 +83,14 @@ proc testGetFileInfo = discard getFileInfo(testFile) echo("Handle : Invalid File : Failure") except EIO, EOS: + discard #echo("Handle : Invalid File : Success") try: discard getFileInfo(testHandle) echo("Handle : Invalid File : Failure") except EIO, EOS: + discard #echo("Handle : Invalid File : Success") -testGetFileInfo() \ No newline at end of file +testGetFileInfo() diff --git a/tests/stdlib/tircbot.nim b/tests/stdlib/tircbot.nim index b91300762a..6b209dce3e 100644 --- a/tests/stdlib/tircbot.nim +++ b/tests/stdlib/tircbot.nim @@ -2,7 +2,7 @@ import irc, sockets, asyncio, json, os, strutils, times, redis type TDb* = object - r*: TRedis + r*: Redis lastPing: float TBuildResult* = enum @@ -15,20 +15,20 @@ type TCommit* = object commitMsg*, username*, hash*: string - date*: TTime + date*: Time TPlatform* = object buildResult*: TBuildResult testResult*: TTestResult failReason*, platform*: string - total*, passed*, skipped*, failed*: biggestInt + total*, passed*, skipped*, failed*: BiggestInt csources*: bool const listName = "commits" - failOnExisting = False + failOnExisting = false -proc open*(host = "localhost", port: TPort): TDb = +proc open*(host = "localhost", port: Port): TDb = result.r = redis.open(host, port) result.lastPing = epochTime() @@ -80,7 +80,7 @@ proc getCommits*(database: TDb, for key, value in database.r.hPairs(c): case normalize(key) of "commitmsg": commit.commitMsg = value - of "date": commit.date = TTime(parseInt(value)) + of "date": commit.date = Time(parseInt(value)) of "username": commit.username = value else: echo(key) @@ -157,21 +157,21 @@ proc `[]`*(p: seq[TPlatform], name: string): TPlatform = for platform in items(p): if platform.platform == name: return platform - raise newException(EInvalidValue, name & " platforms not found in commits.") + raise newException(ValueError, name & " platforms not found in commits.") proc contains*(p: seq[TPlatform], s: string): bool = for i in items(p): if i.platform == s: - return True + return true type PState = ref TState - TState = object of TObject - dispatcher: PDispatcher - sock: PAsyncSocket + TState = object of RootObj + dispatcher: Dispatcher + sock: AsyncSocket ircClient: PAsyncIRC - hubPort: TPort + hubPort: Port database: TDb dbConnected: bool @@ -181,7 +181,7 @@ type TSeen = object nick: string channel: string - timestamp: TTime + timestamp: Time case kind*: TSeenType of PSeenJoin: nil of PSeenPart, PSeenQuit, PSeenMsg: @@ -218,11 +218,12 @@ proc getSeen(d: TDb, nick: string, s: var TSeen): bool = for key, value in d.r.hPairs("seen:" & nick): case normalize(key) of "type": + discard #s.kind = value.parseInt.TSeenType of "channel": s.channel = value of "timestamp": - s.timestamp = TTime(value.parseInt) + s.timestamp = Time(value.parseInt) of "msg": s.msg = value of "newnick": @@ -235,7 +236,7 @@ template createSeen(typ: TSeenType, n, c: string): stmt {.immediate, dirty.} = seenNick.channel = c seenNick.timestamp = getTime() -proc parseReply(line: string, expect: string): Bool = +proc parseReply(line: string, expect: string): bool = var jsonDoc = parseJson(line) return jsonDoc["reply"].str == expect @@ -272,14 +273,14 @@ proc handleWebMessage(state: PState, line: string) = message.add(limitCommitMsg(commit["message"].str)) # Send message to #nim. - state.ircClient.privmsg(joinChans[0], message) + discard state.ircClient.privmsg(joinChans[0], message) elif json.hasKey("redisinfo"): assert json["redisinfo"].hasKey("port") #let redisPort = json["redisinfo"]["port"].num state.dbConnected = true proc hubConnect(state: PState) -proc handleConnect(s: PAsyncSocket, state: PState) = +proc handleConnect(s: AsyncSocket, state: PState) = try: # Send greeting var obj = newJObject() @@ -295,7 +296,7 @@ proc handleConnect(s: PAsyncSocket, state: PState) = doAssert parseReply(line, "OK") echo("The hub accepted me!") else: - raise newException(EInvalidValue, + raise newException(ValueError, "Hub didn't accept me. Waited 1.5 seconds.") # ask for the redis info @@ -303,35 +304,35 @@ proc handleConnect(s: PAsyncSocket, state: PState) = riobj["do"] = newJString("redisinfo") state.sock.send($riobj & "\c\L") - except EOS: + except OsError: echo(getCurrentExceptionMsg()) s.close() echo("Waiting 5 seconds...") sleep(5000) state.hubConnect() -proc handleRead(s: PAsyncSocket, state: PState) = +proc handleRead(s: AsyncSocket, state: PState) = var line = "" if state.sock.recvLine(line): if line != "": # Handle the message state.handleWebMessage(line) else: - echo("Disconnected from hub: ", OSErrorMsg()) + echo("Disconnected from hub: ", osErrorMsg()) s.close() echo("Reconnecting...") state.hubConnect() else: - echo(OSErrorMsg()) + echo(osErrorMsg()) proc hubConnect(state: PState) = - state.sock = AsyncSocket() + state.sock = asyncSocket() state.sock.connect("127.0.0.1", state.hubPort) state.sock.handleConnect = - proc (s: PAsyncSocket) = + proc (s: AsyncSocket) = handleConnect(s, state) state.sock.handleRead = - proc (s: PAsyncSocket) = + proc (s: AsyncSocket) = handleRead(s, state) state.dispatcher.register(state.sock) @@ -426,7 +427,7 @@ proc handleIrc(irc: PAsyncIRC, event: TIRCEvent, state: PState) = else: discard # TODO: ? -proc open(port: TPort = TPort(5123)): PState = +proc open(port: Port = Port(5123)): PState = var res: PState new(res) res.dispatcher = newDispatcher() From 4fbf47ca5eef09060038eeea0d945b5d7afdd2f2 Mon Sep 17 00:00:00 2001 From: def Date: Wed, 4 Feb 2015 20:30:09 +0100 Subject: [PATCH 08/18] Clean up tests/assert 1 test still fails: - tunittests uses utemplates, which seems broken. not sure what it's supposed to do --- tests/assert/tfailedassert.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/assert/tfailedassert.nim b/tests/assert/tfailedassert.nim index d03d3136bd..8766321bf6 100644 --- a/tests/assert/tfailedassert.nim +++ b/tests/assert/tfailedassert.nim @@ -3,7 +3,7 @@ discard """ WARNING: false first assertion from bar ERROR: false second assertion from bar -1 -tfailedassert.nim:27 false assertion from foo +tests/assert/tfailedassert.nim:27 false assertion from foo ''' """ From be33e55518705d8368921366e87c2c0c30f5ab0d Mon Sep 17 00:00:00 2001 From: def Date: Wed, 4 Feb 2015 20:32:54 +0100 Subject: [PATCH 09/18] Clean up tests/bind --- tests/bind/tnicerrorforsymchoice.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/bind/tnicerrorforsymchoice.nim b/tests/bind/tnicerrorforsymchoice.nim index e1ff090dd8..bf6d92927f 100644 --- a/tests/bind/tnicerrorforsymchoice.nim +++ b/tests/bind/tnicerrorforsymchoice.nim @@ -1,6 +1,6 @@ discard """ line: 18 - errormsg: "type mismatch: got (proc (TScgi) | proc (AsyncSocket, StringTableRef, string){.gcsafe.})" + errormsg: "type mismatch: got (proc (TScgi) | proc (AsyncSocket, StringTableRef, string)" """ #bug #442 From c58573b34a058ed82f3c3673a0050b8545b93b6c Mon Sep 17 00:00:00 2001 From: def Date: Wed, 4 Feb 2015 20:41:27 +0100 Subject: [PATCH 10/18] Fix name of generated C file in tester - Makes tests/ccgbugs/tmissingvolatile work again --- tests/testament/tester.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testament/tester.nim b/tests/testament/tester.nim index 865ba9c757..45643be10e 100644 --- a/tests/testament/tester.nim +++ b/tests/testament/tester.nim @@ -134,7 +134,7 @@ proc cmpMsgs(r: var TResults, expected, given: TSpec, test: TTest) = proc generatedFile(path, name: string, target: TTarget): string = let ext = targetToExt[target] result = path / "nimcache" / - (if target == targetJS: path.splitPath.tail & "_" else: "") & + (if target == targetJS: path.splitPath.tail & "_" else: "compiler_") & name.changeFileExt(ext) proc codegenCheck(test: TTest, check: string, given: var TSpec) = From 8a7f405eeae2334ed47f0d4d8e86d5fc81b8c40a Mon Sep 17 00:00:00 2001 From: def Date: Wed, 4 Feb 2015 20:42:37 +0100 Subject: [PATCH 11/18] Clear up tests/clearmsg --- tests/clearmsg/ta.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/clearmsg/ta.nim b/tests/clearmsg/ta.nim index b21522d127..38449c319e 100644 --- a/tests/clearmsg/ta.nim +++ b/tests/clearmsg/ta.nim @@ -1,5 +1,5 @@ discard """ - errormsg: 'type mismatch: got (mc.typ)' + errormsg: "type mismatch: got (mc.typ)" line: 12 """ From 546acfaf4e9ed8ea68d45e15e1942b6c7f9849b6 Mon Sep 17 00:00:00 2001 From: def Date: Wed, 4 Feb 2015 21:20:01 +0100 Subject: [PATCH 12/18] Clean up tests/effects --- tests/effects/teffects1.nim | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/effects/teffects1.nim b/tests/effects/teffects1.nim index 27f89f5fa1..ea1ea7b211 100644 --- a/tests/effects/teffects1.nim +++ b/tests/effects/teffects1.nim @@ -1,5 +1,4 @@ discard """ - line: 2166 file: "system.nim" errormsg: "can raise an unlisted exception: ref IOError" """ From 0b4557b2ce6cfbf05faa2f68317983e3b5b32a84 Mon Sep 17 00:00:00 2001 From: def Date: Wed, 4 Feb 2015 21:40:33 +0100 Subject: [PATCH 13/18] Clean up tests/iter --- tests/iter/tconcat.nim | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/iter/tconcat.nim b/tests/iter/tconcat.nim index c0dab57190..477ac5e268 100644 --- a/tests/iter/tconcat.nim +++ b/tests/iter/tconcat.nim @@ -1,5 +1,12 @@ discard """ - output: '''DabcD''' + output: '''1 +2 +3 +4 +20 +21 +22 +23''' """ proc toIter*[T](s: Slice[T]): iterator: T = From 416456cefef9120019924067adeb814b0ceaaf79 Mon Sep 17 00:00:00 2001 From: def Date: Wed, 4 Feb 2015 21:44:25 +0100 Subject: [PATCH 14/18] Try to fix unittest for JS backend, still not working --- lib/pure/unittest.nim | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/pure/unittest.nim b/lib/pure/unittest.nim index 8dc9fe0d4b..f4e42ee63f 100644 --- a/lib/pure/unittest.nim +++ b/lib/pure/unittest.nim @@ -39,6 +39,7 @@ when declared(stdout): when not defined(ECMAScript): import terminal + system.addQuitProc(resetAttributes) type TestStatus* = enum OK, FAILED @@ -234,5 +235,3 @@ if envOutLvl.len > 0: if $opt == envOutLvl: outputLevel = opt break - -system.addQuitProc(resetAttributes) From 1c34f30bbb4e6c12e48814e7524e7e5faba72970 Mon Sep 17 00:00:00 2001 From: def Date: Wed, 4 Feb 2015 21:56:45 +0100 Subject: [PATCH 15/18] Clean up tests/manyloc named_argument_bug still fails --- .../dependencies/chipmunk/chipmunk.nim | 70 +++++++++---------- .../keineschweine/dependencies/enet/enet.nim | 2 +- .../dependencies/genpacket/genpacket_enet.nim | 11 +-- .../keineschweine/dependencies/sfml/sfml.nim | 22 +++--- .../dependencies/sfml/sfml_audio.nim | 6 +- .../keineschweine/enet_server/enet_client.nim | 1 + tests/manyloc/keineschweine/keineschweine.nim | 24 +++---- .../keineschweine/lib/game_objects.nim | 2 +- tests/manyloc/keineschweine/lib/gl.nim | 64 ++++++++--------- .../manyloc/keineschweine/lib/map_filter.nim | 10 +-- tests/manyloc/keineschweine/lib/sg_assets.nim | 8 +-- .../manyloc/keineschweine/lib/sg_packets.nim | 6 +- tests/manyloc/keineschweine/lib/vehicles.nim | 8 +-- 13 files changed, 113 insertions(+), 121 deletions(-) diff --git a/tests/manyloc/keineschweine/dependencies/chipmunk/chipmunk.nim b/tests/manyloc/keineschweine/dependencies/chipmunk/chipmunk.nim index d079a2e72d..08f1dad505 100644 --- a/tests/manyloc/keineschweine/dependencies/chipmunk/chipmunk.nim +++ b/tests/manyloc/keineschweine/dependencies/chipmunk/chipmunk.nim @@ -74,7 +74,7 @@ type contacts*: PContact stamp*: TTimestamp handler*: PCollisionHandler - swappedColl*: bool32 + swappedColl*: Bool32 state*: TArbiterState PCollisionHandler* = ptr TCollisionHandler TCollisionHandler*{.pf.} = object @@ -108,7 +108,7 @@ type #/ Collision begin event function callback type. #/ Returning false from a begin callback causes the collision to be ignored until #/ the the separate callback is called when the objects stop colliding. - TCollisionBeginFunc* = proc (arb: PArbiter; space: PSpace; data: pointer): Bool{. + TCollisionBeginFunc* = proc (arb: PArbiter; space: PSpace; data: pointer): bool{. cdecl.} #/ Collision pre-solve event function callback type. #/ Returning false from a pre-step callback causes the collision to be ignored until the next step. @@ -142,14 +142,14 @@ type PSpatialIndex = ptr TSpatialIndex TSpatialIndex{.pf.} = object klass: PSpatialIndexClass - bbfunc: TSpatialIndexBBFunc + bbfun: TSpatialIndexBBFunc staticIndex: PSpatialIndex dynamicIndex: PSpatialIndex TSpatialIndexDestroyImpl* = proc (index: PSpatialIndex){.cdecl.} TSpatialIndexCountImpl* = proc (index: PSpatialIndex): cint{.cdecl.} TSpatialIndexEachImpl* = proc (index: PSpatialIndex; - func: TSpatialIndexIteratorFunc; data: pointer){. + fun: TSpatialIndexIteratorFunc; data: pointer){. cdecl.} TSpatialIndexContainsImpl* = proc (index: PSpatialIndex; obj: pointer; hashid: THashValue): Bool32 {.cdecl.} @@ -161,15 +161,15 @@ type TSpatialIndexReindexObjectImpl* = proc (index: PSpatialIndex; obj: pointer; hashid: THashValue){.cdecl.} TSpatialIndexReindexQueryImpl* = proc (index: PSpatialIndex; - func: TSpatialIndexQueryFunc; data: pointer){.cdecl.} + fun: TSpatialIndexQueryFunc; data: pointer){.cdecl.} TSpatialIndexPointQueryImpl* = proc (index: PSpatialIndex; point: TVector; - func: TSpatialIndexQueryFunc; + fun: TSpatialIndexQueryFunc; data: pointer){.cdecl.} TSpatialIndexSegmentQueryImpl* = proc (index: PSpatialIndex; obj: pointer; - a: TVector; b: TVector; t_exit: CpFloat; func: TSpatialIndexSegmentQueryFunc; + a: TVector; b: TVector; t_exit: CpFloat; fun: TSpatialIndexSegmentQueryFunc; data: pointer){.cdecl.} TSpatialIndexQueryImpl* = proc (index: PSpatialIndex; obj: pointer; - bb: TBB; func: TSpatialIndexQueryFunc; + bb: TBB; fun: TSpatialIndexQueryFunc; data: pointer){.cdecl.} PSpatialIndexClass* = ptr TSpatialIndexClass TSpatialIndexClass*{.pf.} = object @@ -286,7 +286,7 @@ type CP_CIRCLE_SHAPE, CP_SEGMENT_SHAPE, CP_POLY_SHAPE, CP_NUM_SHAPES TShapeCacheDataImpl* = proc (shape: PShape; p: TVector; rot: TVector): TBB{.cdecl.} TShapeDestroyImpl* = proc (shape: PShape){.cdecl.} - TShapePointQueryImpl* = proc (shape: PShape; p: TVector): bool32 {.cdecl.} + TShapePointQueryImpl* = proc (shape: PShape; p: TVector): Bool32 {.cdecl.} TShapeSegmentQueryImpl* = proc (shape: PShape; a: TVector; b: TVector; info: PSegmentQueryInfo){.cdecl.} PShapeClass* = ptr TShapeClass @@ -427,7 +427,7 @@ defGetter(PSpace, CpFloat, currDt, CurrentTimeStep) #/ returns true from inside a callback and objects cannot be added/removed. -proc isLocked*(space: PSpace): Bool{.inline.} = +proc isLocked*(space: PSpace): bool{.inline.} = result = space.locked.bool #/ Set a default collision handler for this space. @@ -478,24 +478,24 @@ proc removeBody*(space: PSpace; body: PBody){. proc RemoveConstraint*(space: PSpace; constraint: PConstraint){. cdecl, importc: "cpSpaceRemoveConstraint", dynlib: Lib.} #/ Test if a collision shape has been added to the space. -proc containsShape*(space: PSpace; shape: PShape): Bool{. +proc containsShape*(space: PSpace; shape: PShape): bool{. cdecl, importc: "cpSpaceContainsShape", dynlib: Lib.} #/ Test if a rigid body has been added to the space. -proc containsBody*(space: PSpace; body: PBody): Bool{. +proc containsBody*(space: PSpace; body: PBody): bool{. cdecl, importc: "cpSpaceContainsBody", dynlib: Lib.} #/ Test if a constraint has been added to the space. -proc containsConstraint*(space: PSpace; constraint: PConstraint): Bool{. +proc containsConstraint*(space: PSpace; constraint: PConstraint): bool{. cdecl, importc: "cpSpaceContainsConstraint", dynlib: Lib.} #/ Schedule a post-step callback to be called when cpSpaceStep() finishes. #/ @c obj is used a key, you can only register one callback per unique value for @c obj -proc addPostStepCallback*(space: PSpace; func: TPostStepFunc; +proc addPostStepCallback*(space: PSpace; fun: TPostStepFunc; obj: pointer; data: pointer){. cdecl, importc: "cpSpaceAddPostStepCallback", dynlib: Lib.} #/ Query the space at a point and call @c func for each shape found. proc pointQuery*(space: PSpace; point: TVector; layers: TLayers; - group: TGroup; func: TSpacePointQueryFunc; data: pointer){. + group: TGroup; fun: TSpacePointQueryFunc; data: pointer){. cdecl, importc: "cpSpacePointQuery", dynlib: Lib.} #/ Query the space at a point and return the first shape found. Returns NULL if no shapes were found. @@ -506,7 +506,7 @@ proc pointQueryFirst*(space: PSpace; point: TVector; layers: TLayers; #/ Perform a directed line segment query (like a raycast) against the space calling @c func for each shape intersected. proc segmentQuery*(space: PSpace; start: TVector; to: TVector; layers: TLayers; group: TGroup; - func: TSpaceSegmentQueryFunc; data: pointer){. + fun: TSpaceSegmentQueryFunc; data: pointer){. cdecl, importc: "cpSpaceSegmentQuery", dynlib: Lib.} #/ Perform a directed line segment query (like a raycast) against the space and return the first shape hit. Returns NULL if no shapes were hit. proc segmentQueryFirst*(space: PSpace; start: TVector; to: TVector; @@ -517,26 +517,26 @@ proc segmentQueryFirst*(space: PSpace; start: TVector; to: TVector; #/ Perform a fast rectangle query on the space calling @c func for each shape found. #/ Only the shape's bounding boxes are checked for overlap, not their full shape. proc BBQuery*(space: PSpace; bb: TBB; layers: TLayers; group: TGroup; - func: TSpaceBBQueryFunc; data: pointer){. + fun: TSpaceBBQueryFunc; data: pointer){. cdecl, importc: "cpSpaceBBQuery", dynlib: Lib.} #/ Query a space for any shapes overlapping the given shape and call @c func for each shape found. -proc shapeQuery*(space: PSpace; shape: PShape; func: TSpaceShapeQueryFunc; data: pointer): Bool {. +proc shapeQuery*(space: PSpace; shape: PShape; fun: TSpaceShapeQueryFunc; data: pointer): bool {. cdecl, importc: "cpSpaceShapeQuery", dynlib: Lib.} #/ Call cpBodyActivate() for any shape that is overlaps the given shape. proc activateShapesTouchingShape*(space: PSpace; shape: PShape){. cdecl, importc: "cpSpaceActivateShapesTouchingShape", dynlib: Lib.} #/ Call @c func for each body in the space. -proc eachBody*(space: PSpace; func: TSpaceBodyIteratorFunc; data: pointer){. +proc eachBody*(space: PSpace; fun: TSpaceBodyIteratorFunc; data: pointer){. cdecl, importc: "cpSpaceEachBody", dynlib: Lib.} #/ Call @c func for each shape in the space. -proc eachShape*(space: PSpace; func: TSpaceShapeIteratorFunc; +proc eachShape*(space: PSpace; fun: TSpaceShapeIteratorFunc; data: pointer){. cdecl, importc: "cpSpaceEachShape", dynlib: Lib.} #/ Call @c func for each shape in the space. -proc eachConstraint*(space: PSpace; func: TSpaceConstraintIteratorFunc; +proc eachConstraint*(space: PSpace; fun: TSpaceConstraintIteratorFunc; data: pointer){. cdecl, importc: "cpSpaceEachConstraint", dynlib: Lib.} #/ Update the collision detection info for the static shapes in the space. @@ -674,7 +674,7 @@ proc dist*(v1, v2: TVector): CpFloat {.inline.} = proc distsq*(v1, v2: TVector): CpFloat {.inline.} = result = (v1 - v2).lenSq #vlengthsq(vsub(v1, v2)) #/ Returns true if the distance between v1 and v2 is less than dist. -proc near*(v1, v2: TVector; dist: CpFloat): Bool{.inline.} = +proc near*(v1, v2: TVector; dist: CpFloat): bool{.inline.} = result = v1.distSq(v2) < dist * dist @@ -706,13 +706,13 @@ proc Sleep*(body: PBody){.importc: "cpBodySleep", dynlib: Lib.} proc SleepWithGroup*(body: PBody; group: PBody){. importc: "cpBodySleepWithGroup", dynlib: Lib.} #/ Returns true if the body is sleeping. -proc isSleeping*(body: PBody): Bool {.inline.} = +proc isSleeping*(body: PBody): bool {.inline.} = return body.node.root != nil #/ Returns true if the body is static. proc isStatic*(body: PBody): bool {.inline.} = return body.node.idleTime == CpInfinity #/ Returns true if the body has not been added to a space. -proc isRogue*(body: PBody): Bool {.inline.} = +proc isRogue*(body: PBody): bool {.inline.} = return body.space == nil # #define CP_DefineBodyStructGetter(type, member, name) \ @@ -808,15 +808,15 @@ proc kineticEnergy*(body: PBOdy): CpFloat = result = (body.v.dot(body.v) * body.m) + (body.w * body.w * body.i) #/ Call @c func once for each shape attached to @c body and added to the space. -proc eachShape*(body: PBody; func: TBodyShapeIteratorFunc; +proc eachShape*(body: PBody; fun: TBodyShapeIteratorFunc; data: pointer){. cdecl, importc: "cpBodyEachShape", dynlib: Lib.} #/ Call @c func once for each constraint attached to @c body and added to the space. -proc eachConstraint*(body: PBody; func: TBodyConstraintIteratorFunc; +proc eachConstraint*(body: PBody; fun: TBodyConstraintIteratorFunc; data: pointer) {. cdecl, importc: "cpBodyEachConstraint", dynlib: Lib.} #/ Call @c func once for each arbiter that is currently active on the body. -proc eachArbiter*(body: PBody; func: TBodyArbiterIteratorFunc; +proc eachArbiter*(body: PBody; fun: TBodyArbiterIteratorFunc; data: pointer){. cdecl, importc: "cpBodyEachArbiter", dynlib: Lib.} #/ Allocate a spatial hash. @@ -824,10 +824,10 @@ proc SpaceHashAlloc*(): PSpaceHash{. cdecl, importc: "cpSpaceHashAlloc", dynlib: Lib.} #/ Initialize a spatial hash. proc SpaceHashInit*(hash: PSpaceHash; celldim: CpFloat; numcells: cint; - bbfunc: TSpatialIndexBBFunc; staticIndex: PSpatialIndex): PSpatialIndex{. + bbfun: TSpatialIndexBBFunc; staticIndex: PSpatialIndex): PSpatialIndex{. cdecl, importc: "cpSpaceHashInit", dynlib: Lib.} #/ Allocate and initialize a spatial hash. -proc SpaceHashNew*(celldim: CpFloat; cells: cint; bbfunc: TSpatialIndexBBFunc; +proc SpaceHashNew*(celldim: CpFloat; cells: cint; bbfun: TSpatialIndexBBFunc; staticIndex: PSpatialIndex): PSpatialIndex{. cdecl, importc: "cpSpaceHashNew", dynlib: Lib.} #/ Change the cell dimensions and table size of the spatial hash to tune it. @@ -842,18 +842,18 @@ proc SpaceHashResize*(hash: PSpaceHash; celldim: CpFloat; numcells: cint){. #/ Allocate a bounding box tree. proc BBTreeAlloc*(): PBBTree{.cdecl, importc: "cpBBTreeAlloc", dynlib: Lib.} #/ Initialize a bounding box tree. -proc BBTreeInit*(tree: PBBTree; bbfunc: TSpatialIndexBBFunc; +proc BBTreeInit*(tree: PBBTree; bbfun: TSpatialIndexBBFunc; staticIndex: ptr TSpatialIndex): ptr TSpatialIndex{.cdecl, importc: "cpBBTreeInit", dynlib: Lib.} #/ Allocate and initialize a bounding box tree. -proc BBTreeNew*(bbfunc: TSpatialIndexBBFunc; staticIndex: PSpatialIndex): PSpatialIndex{. +proc BBTreeNew*(bbfun: TSpatialIndexBBFunc; staticIndex: PSpatialIndex): PSpatialIndex{. cdecl, importc: "cpBBTreeNew", dynlib: Lib.} #/ Perform a static top down optimization of the tree. proc BBTreeOptimize*(index: PSpatialIndex){. cdecl, importc: "cpBBTreeOptimize", dynlib: Lib.} #/ Set the velocity function for the bounding box tree to enable temporal coherence. -proc BBTreeSetVelocityFunc*(index: PSpatialIndex; func: TBBTreeVelocityFunc){. +proc BBTreeSetVelocityFunc*(index: PSpatialIndex; fun: TBBTreeVelocityFunc){. cdecl, importc: "cpBBTreeSetVelocityFunc", dynlib: Lib.} #MARK: Single Axis Sweep @@ -864,12 +864,12 @@ proc Sweep1DAlloc*(): ptr TSweep1D{.cdecl, importc: "cpSweep1DAlloc", dynlib: Lib.} #/ Initialize a 1D sort and sweep broadphase. -proc Sweep1DInit*(sweep: ptr TSweep1D; bbfunc: TSpatialIndexBBFunc; +proc Sweep1DInit*(sweep: ptr TSweep1D; bbfun: TSpatialIndexBBFunc; staticIndex: ptr TSpatialIndex): ptr TSpatialIndex{.cdecl, importc: "cpSweep1DInit", dynlib: Lib.} #/ Allocate and initialize a 1D sort and sweep broadphase. -proc Sweep1DNew*(bbfunc: TSpatialIndexBBFunc; staticIndex: ptr TSpatialIndex): ptr TSpatialIndex{. +proc Sweep1DNew*(bbfun: TSpatialIndexBBFunc; staticIndex: ptr TSpatialIndex): ptr TSpatialIndex{. cdecl, importc: "cpSweep1DNew", dynlib: Lib.} @@ -1359,7 +1359,7 @@ defCProp(SlideJoint, TVector, anchr2, Anchr2) defCProp(SlideJoint, CpFloat, min, Min) defCProp(SlideJoint, CpFloat, max, Max) -proc pivotJointGetClass*(): PConstraintClass {. +proc PivotJointGetClass*(): PConstraintClass {. cdecl, importc: "cpPivotJointGetClass", dynlib: Lib.} #/ Allocate a pivot joint diff --git a/tests/manyloc/keineschweine/dependencies/enet/enet.nim b/tests/manyloc/keineschweine/dependencies/enet/enet.nim index df1b743ee0..93857207a2 100644 --- a/tests/manyloc/keineschweine/dependencies/enet/enet.nim +++ b/tests/manyloc/keineschweine/dependencies/enet/enet.nim @@ -20,7 +20,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. const Lib = "libenet.so.1(|.0.3)" -{.deadCodeElim: ON.} +{.deadCodeElim: on.} const ENET_VERSION_MAJOR* = 1 ENET_VERSION_MINOR* = 3 diff --git a/tests/manyloc/keineschweine/dependencies/genpacket/genpacket_enet.nim b/tests/manyloc/keineschweine/dependencies/genpacket/genpacket_enet.nim index 44d00db53d..4f2fb1ea3c 100644 --- a/tests/manyloc/keineschweine/dependencies/genpacket/genpacket_enet.nim +++ b/tests/manyloc/keineschweine/dependencies/genpacket/genpacket_enet.nim @@ -9,15 +9,6 @@ template defPacketImports*(): stmt {.immediate, dirty.} = import macros, macro_dsl, estreams from strutils import format -proc `$`*[T](x: seq[T]): string = - result = "[seq len=" - result.add($x.len) - result.add ':' - for i in 0.. Date: Wed, 4 Feb 2015 22:09:42 +0100 Subject: [PATCH 16/18] Clean up tests/modules --- tests/modules/tmismatchedvisibility.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/modules/tmismatchedvisibility.nim b/tests/modules/tmismatchedvisibility.nim index 6f2f79282c..325c729c05 100644 --- a/tests/modules/tmismatchedvisibility.nim +++ b/tests/modules/tmismatchedvisibility.nim @@ -1,9 +1,9 @@ discard """ line: 8 - errormsg: "public implementation 'tmismatchedvisibility.foo(a: int): int' has non-public forward declaration in tmismatchedvisibility.nim(6,5)" + errormsg: "public implementation 'tmismatchedvisibility.foo(a: int)' has non-public forward declaration in " """ proc foo(a: int): int proc foo*(a: int): int = - result = a + a \ No newline at end of file + result = a + a From 1c4153790bbdad0dbd6144e43cf92fc07d08bf5f Mon Sep 17 00:00:00 2001 From: def Date: Wed, 4 Feb 2015 22:15:30 +0100 Subject: [PATCH 17/18] Clean up tests/osproc --- tests/osproc/tstdin.nim | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/osproc/tstdin.nim b/tests/osproc/tstdin.nim index 2ea9399924..b491c25000 100644 --- a/tests/osproc/tstdin.nim +++ b/tests/osproc/tstdin.nim @@ -4,13 +4,16 @@ discard """ """ import osproc, os, streams -doAssert fileExists(getCurrentDir() / "tests" / "osproc" / "ta.exe") +const filename = when defined(Windows): "ta.exe" else: "ta" -var p = startProcess("ta.exe", getCurrentDir() / "tests" / "osproc") +doAssert fileExists(getCurrentDir() / "tests" / "osproc" / filename) + +var p = startProcess(filename, getCurrentDir() / "tests" / "osproc") p.inputStream.write("5\n") +p.inputStream.flush() while true: let line = p.outputStream.readLine() if line != "": echo line else: - break \ No newline at end of file + break From 25cee6e05b197cec458653b38e78c7027d0dff78 Mon Sep 17 00:00:00 2001 From: def Date: Wed, 4 Feb 2015 22:18:06 +0100 Subject: [PATCH 18/18] Clean up tests/static tstaticparammacro still fails --- tests/static/tmatrix.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/static/tmatrix.nim b/tests/static/tmatrix.nim index d8cc5d14db..a143e2bc9e 100644 --- a/tests/static/tmatrix.nim +++ b/tests/static/tmatrix.nim @@ -1,5 +1,5 @@ discard """ - output: "111" + output: "" """ type Matrix[M,N: static[int]] = array[M, array[N, float]]