diff options
Diffstat (limited to 'tests/manyloc')
14 files changed, 61 insertions, 61 deletions
diff --git a/tests/manyloc/argument_parser/argument_parser.nim b/tests/manyloc/argument_parser/argument_parser.nim index 6f4fb650e..fec00dbf8 100644 --- a/tests/manyloc/argument_parser/argument_parser.nim +++ b/tests/manyloc/argument_parser/argument_parser.nim @@ -1,7 +1,7 @@ ## Command line parsing module for Nimrod. ## -## `Nimrod <http://nimrod-code.org>`_ provides the `parseopt module -## <http://nimrod-code.org/parseopt.html>`_ to parse options from the +## `Nim <http://nim-code.org>`_ provides the `parseopt module +## <http://nim-code.org/parseopt.html>`_ to parse options from the ## commandline. This module tries to provide functionality to prevent you from ## writing commandline parsing and let you concentrate on providing the best ## possible experience for your users. @@ -76,14 +76,14 @@ type case kind*: Tparam_kind of PK_EMPTY: nil of PK_INT: int_val*: int - of PK_BIGGEST_INT: big_int_val*: biggestInt + of PK_BIGGEST_INT: big_int_val*: BiggestInt of PK_FLOAT: float_val*: float - of PK_BIGGEST_FLOAT: big_float_val*: biggestFloat + of PK_BIGGEST_FLOAT: big_float_val*: BiggestFloat of PK_STRING: str_val*: string of PK_BOOL: bool_val*: bool of PK_HELP: nil - Tcommandline_results* = object of TObject ## \ + Tcommandline_results* = object of RootObj ## \ ## Contains the results of the parsing. ## ## Usually this is the result of the parse() call, but you can inherit from @@ -97,7 +97,7 @@ type ## the first name variant for all options to avoid you repeating the test ## with different keys. positional_parameters*: seq[Tparsed_parameter] - options*: TOrderedTable[string, Tparsed_parameter] + options*: OrderedTable[string, Tparsed_parameter] # - Tparam_kind procs @@ -169,7 +169,7 @@ template new_parsed_parameter*(tkind: Tparam_kind, expr): Tparsed_parameter = ## assign the variable to, and thus you reduce code clutter and may use this ## to initialise single assignments variables in `let` blocks. Example: ## - ## .. code-block:: nimrod + ## .. code-block:: nim ## let ## parsed_param1 = new_parsed_parameter(PK_FLOAT, 3.41) ## parsed_param2 = new_parsed_parameter(PK_BIGGEST_INT, 2358123 * 23123) @@ -193,7 +193,7 @@ template new_parsed_parameter*(tkind: Tparam_kind, expr): Tparsed_parameter = proc init*(param: var Tcommandline_results; positional_parameters: seq[Tparsed_parameter] = @[]; - options: TOrderedTable[string, Tparsed_parameter] = + options: OrderedTable[string, Tparsed_parameter] = initOrderedTable[string, Tparsed_parameter](4)) = ## Initialization helper with default parameters. param.positional_parameters = positional_parameters @@ -231,12 +231,12 @@ template run_custom_proc(parsed_parameter: Tparsed_parameter, ## Pass in the string of the parameter triggering the call. If the if not custom_validator.isNil: except: - raise_or_quit(EInvalidValue, ("Couldn't run custom proc for " & + raise_or_quit(ValueError, ("Couldn't run custom proc for " & "parameter $1:\n$2" % [escape(parameter), getCurrentExceptionMsg()])) let message = custom_validator(parameter, parsed_parameter) if not message.isNil and message.len > 0: - raise_or_quit(EInvalidValue, ("Failed to validate value for " & + raise_or_quit(ValueError, ("Failed to validate value for " & "parameter $1:\n$2" % [escape(parameter), message])) @@ -246,50 +246,50 @@ proc parse_parameter(quit_on_failure: bool, param, value: string, ## ## Pass the parameter string which requires a value and the text the user ## passed in for it. It will be parsed according to the param_kind. This proc - ## will raise (EInvalidValue, EOverflow) if something can't be parsed. + ## will raise (ValueError, EOverflow) if something can't be parsed. result.kind = param_kind case param_kind: of PK_INT: try: result.int_val = value.parseInt - except EOverflow: - raise_or_quit(EOverflow, ("parameter $1 requires an " & + except OverflowError: + raise_or_quit(OverflowError, ("parameter $1 requires an " & "integer, but $2 is too large to fit into one") % [param, escape(value)]) - except EInvalidValue: - raise_or_quit(EInvalidValue, ("parameter $1 requires an " & + except ValueError: + raise_or_quit(ValueError, ("parameter $1 requires an " & "integer, but $2 can't be parsed into one") % [param, escape(value)]) of PK_STRING: result.str_val = value of PK_FLOAT: try: result.float_val = value.parseFloat - except EInvalidValue: - raise_or_quit(EInvalidValue, ("parameter $1 requires a " & + except ValueError: + raise_or_quit(ValueError, ("parameter $1 requires a " & "float, but $2 can't be parsed into one") % [param, escape(value)]) of PK_BOOL: try: result.bool_val = value.parseBool - except EInvalidValue: - raise_or_quit(EInvalidValue, ("parameter $1 requires a " & + except ValueError: + raise_or_quit(ValueError, ("parameter $1 requires a " & "boolean, but $2 can't be parsed into one. Valid values are: " & "y, yes, true, 1, on, n, no, false, 0, off") % [param, escape(value)]) of PK_BIGGEST_INT: try: let parsed_len = parseBiggestInt(value, result.big_int_val) if value.len != parsed_len or parsed_len < 1: - raise_or_quit(EInvalidValue, ("parameter $1 requires an " & + raise_or_quit(ValueError, ("parameter $1 requires an " & "integer, but $2 can't be parsed completely into one") % [ param, escape(value)]) - except EInvalidValue: - raise_or_quit(EInvalidValue, ("parameter $1 requires an " & + except ValueError: + raise_or_quit(ValueError, ("parameter $1 requires an " & "integer, but $2 can't be parsed into one") % [param, escape(value)]) of PK_BIGGEST_FLOAT: try: let parsed_len = parseBiggestFloat(value, result.big_float_val) if value.len != parsed_len or parsed_len < 1: - raise_or_quit(EInvalidValue, ("parameter $1 requires a " & + raise_or_quit(ValueError, ("parameter $1 requires a " & "float, but $2 can't be parsed completely into one") % [ param, escape(value)]) - except EInvalidValue: - raise_or_quit(EInvalidValue, ("parameter $1 requires a " & + except ValueError: + raise_or_quit(ValueError, ("parameter $1 requires a " & "float, but $2 can't be parsed into one") % [param, escape(value)]) of PK_EMPTY: discard @@ -298,15 +298,15 @@ proc parse_parameter(quit_on_failure: bool, param, value: string, template build_specification_lookup(): - TOrderedTable[string, ptr Tparameter_specification] = + OrderedTable[string, ptr Tparameter_specification] = ## Returns the table used to keep pointers to all of the specifications. - var result {.gensym.}: TOrderedTable[string, ptr Tparameter_specification] + var result {.gensym.}: OrderedTable[string, ptr Tparameter_specification] result = initOrderedTable[string, ptr Tparameter_specification]( nextPowerOfTwo(expected.len)) for i in 0..expected.len-1: for param_to_detect in expected[i].names: if result.hasKey(param_to_detect): - raise_or_quit(EInvalidKey, + raise_or_quit(KeyError, "Parameter $1 repeated in input specification" % param_to_detect) else: result[param_to_detect] = addr(expected[i]) @@ -344,7 +344,7 @@ proc parse*(expected: seq[Tparameter_specification] = @[], ## ## If there is any kind of error and quit_on_failure is true, the quit proc ## will be called with a user error message. If quit_on_failure is false - ## errors will raise exceptions (usually EInvalidValue or EOverflow) instead + ## errors will raise exceptions (usually ValueError or EOverflow) instead ## for you to catch and handle. assert type_of_positional_parameters != PK_EMPTY and @@ -359,7 +359,7 @@ proc parse*(expected: seq[Tparameter_specification] = @[], # Prepare the input parameter list, maybe get it from the OS if not available. var args = args if args == nil: - let total_params = ParamCount() + let total_params = paramCount() #echo "Got no explicit args, retrieving from OS. Count: ", total_params newSeq(args, total_params) for i in 0..total_params - 1: @@ -387,7 +387,7 @@ proc parse*(expected: seq[Tparameter_specification] = @[], if param.consumes == PK_HELP: echo_help(expected, type_of_positional_parameters, bad_prefixes, end_of_options) - raise_or_quit(EInvalidKey, "") + raise_or_quit(KeyError, "") if param.consumes != PK_EMPTY: if i + 1 < args.len: @@ -396,14 +396,14 @@ proc parse*(expected: seq[Tparameter_specification] = @[], run_custom_proc(parsed, param.custom_validator, arg) i += 1 else: - raise_or_quit(EInvalidValue, ("parameter $1 requires a " & + raise_or_quit(ValueError, ("parameter $1 requires a " & "value, but none was provided") % [arg]) result.options[param.names[0]] = parsed break adding_positional_parameter else: for bad_prefix in bad_prefixes: if arg.startsWith(bad_prefix): - raise_or_quit(EInvalidValue, ("Found ambiguos parameter '$1' " & + raise_or_quit(ValueError, ("Found ambiguos parameter '$1' " & "starting with '$2', put '$3' as the previous parameter " & "if you want to force it as positional parameter.") % [arg, bad_prefix, end_of_options]) @@ -415,7 +415,7 @@ proc parse*(expected: seq[Tparameter_specification] = @[], i += 1 -proc toString(runes: seq[TRune]): string = +proc toString(runes: seq[Rune]): string = result = "" for rune in runes: result.add(rune.toUTF8) @@ -424,7 +424,7 @@ proc ascii_cmp(a, b: string): int = ## Comparison ignoring non ascii characters, for better switch sorting. let a = filterIt(toSeq(runes(a)), it.isAlpha()) # Can't use filterIt twice, github bug #351. - let b = filter(toSeq(runes(b)), proc(x: TRune): bool = x.isAlpha()) + let b = filter(toSeq(runes(b)), proc(x: Rune): bool = x.isAlpha()) return system.cmp(toString(a), toString(b)) diff --git a/tests/manyloc/argument_parser/ex_wget.nimrod.cfg b/tests/manyloc/argument_parser/ex_wget.nim.cfg index 4ea571d31..4ea571d31 100644 --- a/tests/manyloc/argument_parser/ex_wget.nimrod.cfg +++ b/tests/manyloc/argument_parser/ex_wget.nim.cfg diff --git a/tests/manyloc/keineschweine/dependencies/chipmunk/chipmunk.nim b/tests/manyloc/keineschweine/dependencies/chipmunk/chipmunk.nim index d9c933939..d079a2e72 100644 --- a/tests/manyloc/keineschweine/dependencies/chipmunk/chipmunk.nim +++ b/tests/manyloc/keineschweine/dependencies/chipmunk/chipmunk.nim @@ -21,8 +21,8 @@ const Lib = "libchipmunk.so.6.1.1" -when defined(MoreNimrod): - {.hint: "MoreNimrod defined; some Chipmunk functions replaced in Nimrod".} +when defined(MoreNim): + {.hint: "MoreNim defined; some Chipmunk functions replaced in Nim".} {.deadCodeElim: on.} from math import sqrt, sin, cos, arctan2 when defined(CpUseFloat): @@ -729,7 +729,7 @@ proc isRogue*(body: PBody): Bool {.inline.} = defGetter(PBody, CpFloat, m, Mass) #/ Set the mass of a body. -when defined(MoreNimrod): +when defined(MoreNim): defSetter(PBody, CpFloat, m, Mass) else: proc setMass*(body: PBody; m: CpFloat){. @@ -738,7 +738,7 @@ else: #/ Get the moment of a body. defGetter(PBody, CpFloat, i, Moment) #/ Set the moment of a body. -when defined(MoreNimrod): +when defined(MoreNim): defSetter(PBody, CpFloat, i, Moment) else: proc SetMoment*(body: PBody; i: CpFloat) {. @@ -747,7 +747,7 @@ else: #/ Get the position of a body. defGetter(PBody, TVector, p, Pos) #/ Set the position of a body. -when defined(MoreNimrod): +when defined(MoreNim): defSetter(PBody, TVector, p, Pos) else: proc setPos*(body: PBody; pos: TVector) {. @@ -1088,7 +1088,7 @@ proc getSegmentRadius*(shape: PShape): CpFloat {. #var VersionString*{.importc: "cpVersionString", dynlib: Lib.}: cstring #/ Calculate the moment of inertia for a circle. #/ @c r1 and @c r2 are the inner and outer diameters. A solid circle has an inner diameter of 0. -when defined(MoreNimrod): +when defined(MoreNim): proc momentForCircle*(m, r1, r2: CpFloat; offset: TVector): CpFloat {.cdecl.} = result = m * (0.5 * (r1 * r1 + r2 * r2) + lenSq(offset)) else: diff --git a/tests/manyloc/keineschweine/dependencies/nake/nake.nim b/tests/manyloc/keineschweine/dependencies/nake/nake.nim index eade28c70..5828e400c 100644 --- a/tests/manyloc/keineschweine/dependencies/nake/nake.nim +++ b/tests/manyloc/keineschweine/dependencies/nake/nake.nim @@ -58,7 +58,7 @@ when isMainModule: for i in 1..paramCount(): args.add paramStr(i) args.add " " - quit(shell("nimrod", "c", "-r", "nakefile.nim", args)) + quit(shell("nim", "c", "-r", "nakefile.nim", args)) else: addQuitProc(proc() {.noconv.} = var diff --git a/tests/manyloc/keineschweine/dependencies/nake/nakefile.nim b/tests/manyloc/keineschweine/dependencies/nake/nakefile.nim index 24af63d10..bdf2139c9 100644 --- a/tests/manyloc/keineschweine/dependencies/nake/nakefile.nim +++ b/tests/manyloc/keineschweine/dependencies/nake/nakefile.nim @@ -2,7 +2,7 @@ import nake nakeImports task "install", "compile and install nake binary": - if shell("nimrod", "c", "nake") == 0: + if shell("nim", "c", "nake") == 0: let path = getEnv("PATH").split(PathSep) for index, dir in pairs(path): echo " ", index, ". ", dir diff --git a/tests/manyloc/keineschweine/enet_server/nakefile.nim b/tests/manyloc/keineschweine/enet_server/nakefile.nim index 1ca93a340..3764c6271 100644 --- a/tests/manyloc/keineschweine/enet_server/nakefile.nim +++ b/tests/manyloc/keineschweine/enet_server/nakefile.nim @@ -5,9 +5,9 @@ const ServerDefines = "-d:NoSFML --forceBuild" task "server", "build the server": - if shell("nimrod", ServerDefines, "-r", "compile", "enet_server") != 0: + if shell("nim", ServerDefines, "-r", "compile", "enet_server") != 0: quit "Failed to build" task "gui", "build the server GUI mode": - if shell("nimrod", "--app:gui", ServerDefines, "-r", "compile", "enet_server") != 0: + if shell("nim", "--app:gui", ServerDefines, "-r", "compile", "enet_server") != 0: quit "Failed to build" diff --git a/tests/manyloc/keineschweine/keineschweine.nimrod.cfg b/tests/manyloc/keineschweine/keineschweine.nim.cfg index ca6c75f6e..ca6c75f6e 100644 --- a/tests/manyloc/keineschweine/keineschweine.nimrod.cfg +++ b/tests/manyloc/keineschweine/keineschweine.nim.cfg diff --git a/tests/manyloc/nake/nake.nim b/tests/manyloc/nake/nake.nim index 4b1b35662..04b745003 100644 --- a/tests/manyloc/nake/nake.nim +++ b/tests/manyloc/nake/nake.nim @@ -58,7 +58,7 @@ when isMainModule: for i in 1..paramCount(): args.add paramStr(i) args.add " " - quit(shell("nimrod", "c", "-r", "nakefile.nim", args)) + quit(shell("nim", "c", "-r", "nakefile.nim", args)) else: addQuitProc(proc() {.noconv.} = var diff --git a/tests/manyloc/nake/nakefile.nim b/tests/manyloc/nake/nakefile.nim index 700f9ab49..d1d712964 100644 --- a/tests/manyloc/nake/nakefile.nim +++ b/tests/manyloc/nake/nakefile.nim @@ -9,16 +9,16 @@ const BinLibs = "http://dl.dropbox.com/u/37533467/libs-2012-09-12.zip" ExeName = "keineschweine" ServerDefines = "-d:NoSFML -d:NoChipmunk" - TestBuildDefines = "-d:escapeMenuTest -d:debugWeps -d:showFPS -d:moreNimrod -d:debugKeys -d:foo -d:recordMode --forceBuild" + TestBuildDefines = "-d:escapeMenuTest -d:debugWeps -d:showFPS -d:moreNim -d:debugKeys -d:foo -d:recordMode --forceBuild" ReleaseDefines = "-d:release --deadCodeElim:on" ReleaseTestDefines = "-d:debugWeps -d:debugKeys --forceBuild" task "testprofile", "..": - if shell("nimrod", TestBuildDefines, "--profiler:on", "--stacktrace:on", "compile", ExeName) == 0: + if shell("nim", TestBuildDefines, "--profiler:on", "--stacktrace:on", "compile", ExeName) == 0: shell "."/ExeName, "offline" task "test", "Build with test defines": - if shell("nimrod", TestBuildDefines, "compile", ExeName) != 0: + if shell("nim", TestBuildDefines, "compile", ExeName) != 0: quit "The build failed." task "testrun", "Build with test defines and run": @@ -26,22 +26,22 @@ task "testrun", "Build with test defines and run": shell "."/ExeName task "test2", "Build release test build test release build": - if shell("nimrod", ReleaseDefines, ReleaseTestDefines, "compile", ExeName) == 0: + if shell("nim", ReleaseDefines, ReleaseTestDefines, "compile", ExeName) == 0: shell "."/ExeName discard """task "dirserver", "build the directory server": withDir "server": - if shell("nimrod", ServerDefines, "compile", "dirserver") != 0: + if shell("nim", ServerDefines, "compile", "dirserver") != 0: echo "Failed to build the dirserver" quit 1""" task "zoneserver", "build the zone server": withDir "enet_server": - if shell("nimrod", ServerDefines, "compile", "enet_server") != 0: + if shell("nim", ServerDefines, "compile", "enet_server") != 0: quit "Failed to build the zoneserver" task "zoneserver-gui", "build the zone server, with gui!": withDir "enet_server": - if shell("nimrod", ServerDefines, "--app:gui", "compile", "enet_server") != 0: + if shell("nim", ServerDefines, "--app:gui", "compile", "enet_server") != 0: quit "Failed to build the zoneserver" task "servers", "build the server and directory server": @@ -54,7 +54,7 @@ task "all", "run SERVERS and TEST tasks": runTask "test" task "release", "release build": - let res = shell("nimrod", ReleaseDefines, "compile", ExeName) + let res = shell("nim", ReleaseDefines, "compile", ExeName) if res != 0: echo "The build failed." quit 1 @@ -84,7 +84,7 @@ task "download", "download game assets": skipAssets = false path = expandFilename("data") path.add DirSep - path.add(extractFilename(gameAssets)) + path.add(extractFilename(GameAssets)) if existsFile(path): echo "The file already exists\n", "[R]emove [M]ove [Q]uit [S]kip Source: ", GameAssets @@ -92,7 +92,7 @@ task "download", "download game assets": of "r": removeFile path of "m": - moveFile path, path/../(extractFilename(gameAssets)&"-old") + moveFile path, path/../(extractFilename(GameAssets)&"-old") of "s": skipAssets = true else: @@ -101,7 +101,7 @@ task "download", "download game assets": echo "Downloading from ", GameAssets if not skipAssets: echo "Downloading to ", path - downloadFile gameAssets, path + downloadFile GameAssets, path echo "Download finished" let targetDir = parentDir(parentDir(path)) diff --git a/tests/manyloc/nake/nakefile.nimrod.cfg b/tests/manyloc/nake/nakefile.nim.cfg index 6f3e86fe6..6f3e86fe6 100644 --- a/tests/manyloc/nake/nakefile.nimrod.cfg +++ b/tests/manyloc/nake/nakefile.nim.cfg diff --git a/tests/manyloc/named_argument_bug/main.nimrod.cfg b/tests/manyloc/named_argument_bug/main.nim.cfg index 27cf8e688..27cf8e688 100644 --- a/tests/manyloc/named_argument_bug/main.nimrod.cfg +++ b/tests/manyloc/named_argument_bug/main.nim.cfg diff --git a/tests/manyloc/named_argument_bug/tri_engine/math/vec.nim b/tests/manyloc/named_argument_bug/tri_engine/math/vec.nim index a6b7bac63..3b57acb8e 100644 --- a/tests/manyloc/named_argument_bug/tri_engine/math/vec.nim +++ b/tests/manyloc/named_argument_bug/tri_engine/math/vec.nim @@ -3,10 +3,10 @@ import tri_engine/config type - TV2*[T:TNumber=TR] = array[0..1, T] - TV3*[T:TNumber=TR] = array[0..2, T] - TV4*[T:TNumber=TR] = array[0..3, T] - TVT*[T:TNumber=TR] = TV2|TV3|TV4 + TV2*[T:SomeNumber=TR] = array[0..1, T] + TV3*[T:SomeNumber=TR] = array[0..2, T] + TV4*[T:SomeNumber=TR] = array[0..3, T] + TVT*[T:SomeNumber=TR] = TV2|TV3|TV4 #TV2* = array[0..1, TR] #TV3* = array[0..2, TR] #TV4* = array[0..3, TR] diff --git a/tests/manyloc/packages/noconflicts.nimrod.cfg b/tests/manyloc/packages/noconflicts.nim.cfg index 88974ab8c..88974ab8c 100644 --- a/tests/manyloc/packages/noconflicts.nimrod.cfg +++ b/tests/manyloc/packages/noconflicts.nim.cfg diff --git a/tests/manyloc/standalone/barebone.nimrod.cfg b/tests/manyloc/standalone/barebone.nim.cfg index 52ec64e3f..52ec64e3f 100644 --- a/tests/manyloc/standalone/barebone.nimrod.cfg +++ b/tests/manyloc/standalone/barebone.nim.cfg |