diff options
Diffstat (limited to 'tests/manyloc')
21 files changed, 41 insertions, 41 deletions
diff --git a/tests/manyloc/argument_parser/argument_parser.nim b/tests/manyloc/argument_parser/argument_parser.nim index d42842f93..9a37ef8c9 100644 --- a/tests/manyloc/argument_parser/argument_parser.nim +++ b/tests/manyloc/argument_parser/argument_parser.nim @@ -486,7 +486,7 @@ proc echo_help*(expected: seq[Tparameter_specification] = @[], echo line -when isMainModule: +when true: # Simply tests code embedded in docs. let parsed_param1 = new_parsed_parameter(PK_FLOAT, 3.41) diff --git a/tests/manyloc/argument_parser/ex_wget.nim b/tests/manyloc/argument_parser/ex_wget.nim index 625a6f595..ebbf1933f 100644 --- a/tests/manyloc/argument_parser/ex_wget.nim +++ b/tests/manyloc/argument_parser/ex_wget.nim @@ -81,7 +81,7 @@ proc process_commandline(): Tcommandline_results = echo "Will use progress type $1" % [result.options[PARAM_PROGRESS[0]].str_val] -when isMainModule: +when true: let args = process_commandline() for param in args.positional_parameters: echo "Downloading $1" % param.str_val diff --git a/tests/manyloc/keineschweine/dependencies/genpacket/genpacket.nim b/tests/manyloc/keineschweine/dependencies/genpacket/genpacket.nim index 3026cc4b9..fe9909750 100644 --- a/tests/manyloc/keineschweine/dependencies/genpacket/genpacket.nim +++ b/tests/manyloc/keineschweine/dependencies/genpacket/genpacket.nim @@ -252,7 +252,7 @@ template forwardPacketT*(typeName: expr): stmt {.dirty, immediate.} = proc `pack typeName`*(p: var typeName; s: PStream) = writeData(s, addr p, sizeof(p)) -when isMainModule: +when true: type SomeEnum = enum A = 0'i8, diff --git a/tests/manyloc/keineschweine/dependencies/genpacket/genpacket_enet.nim b/tests/manyloc/keineschweine/dependencies/genpacket/genpacket_enet.nim index 3fb4dc7d9..b36b49823 100644 --- a/tests/manyloc/keineschweine/dependencies/genpacket/genpacket_enet.nim +++ b/tests/manyloc/keineschweine/dependencies/genpacket/genpacket_enet.nim @@ -2,7 +2,7 @@ import macros, macro_dsl, estreams from strutils import format template newLenName() = - let lenName {.inject.} = ^("len"& $lenNames) + let lenName {.inject.} = ^("len" & $lenNames) inc(lenNames) template defPacketImports*() {.dirty.} = @@ -18,7 +18,7 @@ macro defPacket*(typeNameN: untyped, typeFields: untyped): untyped = var constructorParams = newNimNode(nnkFormalParams).und(typeName) constructor = newNimNode(nnkProcDef).und( - postfix(^("new"& $typeName.ident), "*"), + postfix(^("new" & $typeName.ident), "*"), emptyNode(), emptyNode(), constructorParams, @@ -41,7 +41,7 @@ macro defPacket*(typeNameN: untyped, typeFields: untyped): untyped = emptyNode(), emptyNode()) read = newNimNode(nnkProcDef).und( - newIdentNode("read"& $typeName.ident).postfix("*"), + newIdentNode("read" & $typeName.ident).postfix("*"), emptyNode(), emptyNode(), newNimNode(nnkFormalParams).und( @@ -70,7 +70,7 @@ macro defPacket*(typeNameN: untyped, typeFields: untyped): untyped = let item = ^"item" ## item name in our iterators seqType = typeFields[i][1][1] ## type of seq - readName = newIdentNode("read"& $seqType.ident) + readName = newIdentNode("read" & $seqType.ident) readBody.add(newNimNode(nnkLetSection).und( newNimNode(nnkIdentDefs).und( lenName, @@ -100,7 +100,7 @@ macro defPacket*(typeNameN: untyped, typeFields: untyped): untyped = #set the default value to @[] (new sequence) typeFields[i][2] = "@".prefix(newNimNode(nnkBracket)) else: - error("Unknown type: "& treeRepr(typeFields[i])) + error("Unknown type: " & treeRepr(typeFields[i])) of nnkIdent: ##normal type case $typeFields[i][1].ident of "string": # length encoded string @@ -109,12 +109,12 @@ macro defPacket*(typeNameN: untyped, typeFields: untyped): untyped = of "int8", "int16", "int32", "float32", "float64", "char", "bool": packBody.add(newCall( "writeBE", streamID, dotName)) - readBody.add(resName := newCall("read"& $typeFields[i][1].ident, streamID)) + readBody.add(resName := newCall("read" & $typeFields[i][1].ident, streamID)) else: ## hopefully the type you specified was another defpacket() type packBody.add(newCall("pack", streamID, dotName)) - readBody.add(resName := newCall("read"& $typeFields[i][1].ident, streamID)) + readBody.add(resName := newCall("read" & $typeFields[i][1].ident, streamID)) else: - error("I dont know what to do with: "& treerepr(typeFields[i])) + error("I dont know what to do with: " & treerepr(typeFields[i])) var toStringFunc = newNimNode(nnkProcDef).und( @@ -137,7 +137,7 @@ macro defPacket*(typeNameN: untyped, typeFields: untyped): untyped = newNimNode(nnkCall).und(# [6][0][1] ^"format", ## format emptyNode())))) ## "[TypeName $1 $2]" - formatStr = "["& $typeName.ident + formatStr = "[" & $typeName.ident const emptyFields = {nnkEmpty, nnkNilLit} var objFields = newNimNode(nnkRecList) @@ -206,7 +206,7 @@ macro forwardPacket*(typeName: untyped, underlyingType: untyped): untyped = streamID = ^"s" result = newNimNode(nnkStmtList).und( newProc( - (^("read"& $typeName.ident)).postfix("*"), + (^("read" & $typeName.ident)).postfix("*"), [ iddefs("s", "PBuffer", newNimNode(nnkNilLit)) ], typeName), newProc( @@ -244,7 +244,7 @@ template forwardPacketT*(typeName: untyped; underlyingType: untyped) {.dirty.} = #writeData(s, addr p, sizeof(p)) buffer.write(underlyingType(ord)) -when isMainModule: +when false: type SomeEnum = enum A = 0'i8, diff --git a/tests/manyloc/keineschweine/dependencies/genpacket/macro_dsl.nim b/tests/manyloc/keineschweine/dependencies/genpacket/macro_dsl.nim index 33d2a7177..3341f42c2 100644 --- a/tests/manyloc/keineschweine/dependencies/genpacket/macro_dsl.nim +++ b/tests/manyloc/keineschweine/dependencies/genpacket/macro_dsl.nim @@ -50,7 +50,7 @@ macro `?`(a: untyped): untyped = result = ($a[1].ident)[0].lit ## echo(?F,?a,?t,?t,?y) -when isMainModule: +when false: macro foo(x: untyped) = result = newNimNode(nnkStmtList) result.add(newNimNode(nnkCall).und(!!"echo", "Hello thar".lit)) diff --git a/tests/manyloc/keineschweine/dependencies/genpacket/streams_enh.nim b/tests/manyloc/keineschweine/dependencies/genpacket/streams_enh.nim index 5a1dffc93..ad0d20f1c 100644 --- a/tests/manyloc/keineschweine/dependencies/genpacket/streams_enh.nim +++ b/tests/manyloc/keineschweine/dependencies/genpacket/streams_enh.nim @@ -24,7 +24,7 @@ proc writeLEStr*(s: PStream, str: string) = s.write(str.len.int16) s.write(str) -when isMainModule: +when true: var testStream = newStringStream() testStream.writeLEStr("Hello") diff --git a/tests/manyloc/keineschweine/dependencies/nake/nake.nim b/tests/manyloc/keineschweine/dependencies/nake/nake.nim index 5341c1079..83569e30e 100644 --- a/tests/manyloc/keineschweine/dependencies/nake/nake.nim +++ b/tests/manyloc/keineschweine/dependencies/nake/nake.nim @@ -50,7 +50,7 @@ template withDir*(dir: string; body: stmt): stmt = body cd(curDir) -when isMainModule: +when true: if not existsFile("nakefile.nim"): echo "No nakefile.nim found. Current working dir is ", getCurrentDir() quit 1 diff --git a/tests/manyloc/keineschweine/enet_server/enet_client.nim b/tests/manyloc/keineschweine/enet_server/enet_client.nim index ac600c0af..7b8576a14 100644 --- a/tests/manyloc/keineschweine/enet_server/enet_client.nim +++ b/tests/manyloc/keineschweine/enet_server/enet_client.nim @@ -217,7 +217,7 @@ proc lobbyUpdate*(dt: float) = gui.update(dt) i = (i + 1) mod 60 if i == 0: - fpsText.setString("FPS: "& ff(1.0/dt)) + fpsText.setString("FPS: " & ff(1.0/dt)) proc lobbyDraw*(window: PRenderWindow) = window.clear(Black) diff --git a/tests/manyloc/keineschweine/enet_server/enet_server.nim b/tests/manyloc/keineschweine/enet_server/enet_server.nim index eae7c034e..3bb259386 100644 --- a/tests/manyloc/keineschweine/enet_server/enet_server.nim +++ b/tests/manyloc/keineschweine/enet_server/enet_server.nim @@ -102,7 +102,7 @@ handlers[HZoneJoinReq] = proc(client: PClient; buffer: PBuffer) = -when isMainModule: +when true: import parseopt, matchers, os, json diff --git a/tests/manyloc/keineschweine/keineschweine.nim b/tests/manyloc/keineschweine/keineschweine.nim index 59347ee46..b6fd3cc19 100644 --- a/tests/manyloc/keineschweine/keineschweine.nim +++ b/tests/manyloc/keineschweine/keineschweine.nim @@ -230,7 +230,7 @@ proc explode*(b: PLiveBullet) = proc bulletUpdate(body: PBody, gravity: TVector, damping, dt: CpFloat){.cdecl.} = body.UpdateVelocity(gravity, damping, dt) -template getPhysical() {.immediate.} = +template getPhysical() {.dirty.} = result.body = space.addBody(newBody( record.physics.mass, record.physics.moment)) @@ -281,7 +281,7 @@ proc draw*(window: PRenderWindow; b: PLiveBullet) {.inline.} = proc free*(veh: PVehicle) = - ("Destroying vehicle "& veh.record.name).echo + ("Destroying vehicle " & veh.record.name).echo destroy(veh.sprite) if veh.shape.isNil: "Free'd vehicle's shape was NIL!".echo else: space.removeShape(veh.shape) @@ -290,12 +290,12 @@ proc free*(veh: PVehicle) = veh.body.free() veh.shape.free() veh.sprite = nil - veh.body = nil + veh.body = nil veh.shape = nil proc newVehicle*(record: PVehicleRecord): PVehicle = - echo("Creating "& record.name) + echo("Creating " & record.name) new(result, free) result.record = record result.sprite = result.record.anim.spriteSheet.sprite.copy() @@ -663,7 +663,7 @@ proc mainRender() = proc readyMainState() = specInputClient.setActive() -when isMainModule: +when true: import parseopt localPlayer = newPlayer() diff --git a/tests/manyloc/keineschweine/lib/client_helpers.nim b/tests/manyloc/keineschweine/lib/client_helpers.nim index 5f819a7d1..0ebb4ade1 100644 --- a/tests/manyloc/keineschweine/lib/client_helpers.nim +++ b/tests/manyloc/keineschweine/lib/client_helpers.nim @@ -8,7 +8,7 @@ type addy: enet.TAddress host*: PHost peer*: PPeer - handlers*: TTable[char, TScPktHandler] + handlers*: Table[char, TScPktHandler] TScPktHandler* = proc(serv: PServer; buffer: PBuffer) TFileTransfer = object fileName: string diff --git a/tests/manyloc/keineschweine/lib/estreams.nim b/tests/manyloc/keineschweine/lib/estreams.nim index 00a55c626..99cbb63d1 100644 --- a/tests/manyloc/keineschweine/lib/estreams.nim +++ b/tests/manyloc/keineschweine/lib/estreams.nim @@ -106,7 +106,7 @@ proc readChar*(buffer: PBuffer): char {.inline.} = return readInt8(buffer).char proc readBool*(buffer: PBuffer): bool {.inline.} = return readInt8(buffer).bool -when isMainModule: +when false: var b = newBuffer(100) var str = "hello there" b.write str diff --git a/tests/manyloc/keineschweine/lib/map_filter.nim b/tests/manyloc/keineschweine/lib/map_filter.nim index f3f1df190..acb58c60e 100644 --- a/tests/manyloc/keineschweine/lib/map_filter.nim +++ b/tests/manyloc/keineschweine/lib/map_filter.nim @@ -17,7 +17,7 @@ template unless*(condition: untyped; body: untyped) {.dirty.} = if not condition: body -when isMainModule: +when false: proc dumpSeq[T](x: seq[T]) = for index, item in x.pairs: echo index, " ", item diff --git a/tests/manyloc/keineschweine/lib/sg_assets.nim b/tests/manyloc/keineschweine/lib/sg_assets.nim index 90f0a54e9..7caa9c3fb 100644 --- a/tests/manyloc/keineschweine/lib/sg_assets.nim +++ b/tests/manyloc/keineschweine/lib/sg_assets.nim @@ -222,7 +222,7 @@ template cacheImpl(procName, cacheName, resultType, body: untyped) {.dirty.} = template checkFile(path: untyped) {.dirty.} = if not existsFile(path): - errors.add("File missing: "& path) + errors.add("File missing: " & path) cacheImpl newSprite, SpriteSheets, PSpriteSheet: result.file = filename @@ -231,7 +231,7 @@ cacheImpl newSprite, SpriteSheets, PSpriteSheet: result.frameh = strutils.parseInt(matches[1]) checkFile("data/gfx"/result.file) else: - errors.add "Bad file: "&filename&" must be in format name_WxH.png" + errors.add "Bad file: " & filename & " must be in format name_WxH.png" return cacheImpl newSound, SoundCache, PSoundRecord: @@ -314,10 +314,10 @@ proc validateSettings*(settings: JsonNode, errors: var seq[string]): bool = else: var id = 0 for i in items.items: - if i.kind != JArray: errors.add("Item #$1 is not an array"% $id) + if i.kind != JArray: errors.add("Item #$1 is not an array" % $id) elif i.len != 3: errors.add("($1) Item record should have 3 fields"%($id)) elif i[0].kind != JString or i[1].kind != JString or i[2].kind != JObject: - errors.add("($1) Item should be in form [name, type, {item: data}]"% $id) + errors.add("($1) Item should be in form [name, type, {item: data}]" % $id) result = false inc id @@ -332,10 +332,10 @@ proc loadSettings*(rawJson: string, errors: var seq[string]): bool = try: settings = parseJson(rawJson) except JsonParsingError: - errors.add("JSON parsing error: "& getCurrentExceptionMsg()) + errors.add("JSON parsing error: " & getCurrentExceptionMsg()) return except: - errors.add("Unknown exception: "& getCurrentExceptionMsg()) + errors.add("Unknown exception: " & getCurrentExceptionMsg()) return if not validateSettings(settings, errors): return @@ -378,7 +378,7 @@ proc loadSettings*(rawJson: string, errors: var seq[string]): bool = inc vID if itm.kind == Projectile: if itm.bullet.isNil: - errors.add("Projectile #$1 has no bullet!"% $vID) + errors.add("Projectile #$1 has no bullet!" % $vID) elif itm.bullet.id == -1: ## this item has an anonymous bullet, fix the ID and name itm.bullet.id = bID diff --git a/tests/manyloc/keineschweine/lib/sg_gui.nim b/tests/manyloc/keineschweine/lib/sg_gui.nim index 074e0604c..83ad0d1bf 100644 --- a/tests/manyloc/keineschweine/lib/sg_gui.nim +++ b/tests/manyloc/keineschweine/lib/sg_gui.nim @@ -260,7 +260,7 @@ proc update*(m: PMessageArea) = m.texts.add messageProto.copy() elif m.texts.len > m.sizeVisible: echo "cutting ", m.texts.len - m.sizeVisible, " fields" - for i in m.sizeVisible.. < m.texts.len: + for i in m.sizeVisible ..< m.texts.len: m.texts.pop().destroy() let nmsgs = m.messages.len() if m.sizeVisible == 0 or nmsgs == 0: diff --git a/tests/manyloc/keineschweine/lib/sg_packets.nim b/tests/manyloc/keineschweine/lib/sg_packets.nim index f3a0e8925..9a5aa5496 100644 --- a/tests/manyloc/keineschweine/lib/sg_packets.nim +++ b/tests/manyloc/keineschweine/lib/sg_packets.nim @@ -92,7 +92,7 @@ defPacket(DsMsg, tuple[msg: string]) let HVerifyClient* = 'v' defPacket(SdVerifyClient, tuple[session: ScLogin]) -when isMainModule: +when true: var buf = newBuffer(100) var m = toMd5("hello there") diff --git a/tests/manyloc/keineschweine/lib/vehicles.nim b/tests/manyloc/keineschweine/lib/vehicles.nim index e245c9e8c..2c6e54d2b 100644 --- a/tests/manyloc/keineschweine/lib/vehicles.nim +++ b/tests/manyloc/keineschweine/lib/vehicles.nim @@ -23,7 +23,7 @@ proc strafe_left*(obj: PVehicle, dt: float) = VectorZero) proc strafe_right*(obj: PVehicle, dt: float) = obj.body.applyImpulse( - vectorForAngle(obj.body.getAngle()).rperp()* obj.record.handling.strafe * dt, + vectorForAngle(obj.body.getAngle()).rperp() * obj.record.handling.strafe * dt, VectorZero) proc turn_right*(obj: PVehicle, dt: float) = #obj.angle = (obj.angle + (obj.record.handling.rotation.float / 10.0 * dt)) mod TAU diff --git a/tests/manyloc/keineschweine/lib/zlib_helpers.nim b/tests/manyloc/keineschweine/lib/zlib_helpers.nim index 076475964..895f41759 100644 --- a/tests/manyloc/keineschweine/lib/zlib_helpers.nim +++ b/tests/manyloc/keineschweine/lib/zlib_helpers.nim @@ -20,7 +20,7 @@ proc uncompress*(source: string, destLen: var int): string = echo "Error occurred: ", res -when isMainModule: +when true: import strutils var r = compress("Hello") echo repr(r) diff --git a/tests/manyloc/keineschweine/server/old_dirserver.nim b/tests/manyloc/keineschweine/server/old_dirserver.nim index 202dc6fe7..cfb0b0377 100644 --- a/tests/manyloc/keineschweine/server/old_dirserver.nim +++ b/tests/manyloc/keineschweine/server/old_dirserver.nim @@ -156,7 +156,7 @@ proc poll*(timeout: int = 250) = echo("Write ", c, " result: ", res, " data: ", repr(c.outputBuf.data)) c.outputBuf.flush() -when isMainModule: +when true: import parseopt, matchers, strutils var cfgFile = "dirserver_settings.json" for kind, key, val in getOpt(): diff --git a/tests/manyloc/keineschweine/server/old_sg_server.nim b/tests/manyloc/keineschweine/server/old_sg_server.nim index bddc74c6d..d046df9dd 100644 --- a/tests/manyloc/keineschweine/server/old_sg_server.nim +++ b/tests/manyloc/keineschweine/server/old_sg_server.nim @@ -141,7 +141,7 @@ proc poll*(timeout: int = 250) = echo("Write ", c, " result: ", res, " data: ", c.outputBuf.data) c.outputBuf.flush() -when isMainModule: +when true: import parseopt, matchers, strutils var zoneCfgFile = "./server_settings.json" for kind, key, val in getOpt(): diff --git a/tests/manyloc/nake/nake.nim b/tests/manyloc/nake/nake.nim index ff3c10a17..ebcf21d19 100644 --- a/tests/manyloc/nake/nake.nim +++ b/tests/manyloc/nake/nake.nim @@ -50,7 +50,7 @@ template withDir*(dir: string; body: untyped) = body cd(curDir) -when isMainModule: +when true: if not existsFile("nakefile.nim"): echo "No nakefile.nim found. Current working dir is ", getCurrentDir() quit 1 |