Hi
I just created a Nimble package for the first time in a still empty git project (exept: Folders are already created) via nimble init.
Nimble created some sample files for me right away. Among others:
In the manual it says that you can run the existing tests with nimble test. Since a demo file of nimble was already created I tried that.
Content of the file test1.nim:
import unittest
test "can add":
check add(5, 5) == 10
Unfortunately, it hails error messages during execution. I assume that the example file should work without errors Who can help me with this?
Output:
PS K:\40-Nim\Projects\cmdparser> nimble test
Verifying dependencies for [email protected]
Compiling K:\40-Nim\Projects\cmdparser\tests\test1 (from package cmdparser) using c backend
K:\40-Nim\Projects\cmdparser\tests\test1.nim(11, 6) template/generic instantiation of `test` from here
K:\40-Nim\Projects\cmdparser\tests\test1.nim(12, 9) template/generic instantiation of `check` from here
C:\Users\rtdie\.choosenim\toolchains\nim-1.6.6\lib\pure\unittest.nim(681, 43) Error: type mismatch: got <int literal(5), int literal(5)>
but expected one of:
proc add(x: var string; y: char)
first type mismatch at position: 1
required type for x: var string
but expression '5' is of type: int literal(5)
proc add(x: var string; y: cstring)
first type mismatch at position: 1
required type for x: var string
but expression '5' is of type: int literal(5)
proc add(x: var string; y: string)
first type mismatch at position: 1
required type for x: var string
but expression '5' is of type: int literal(5)
proc add[T](x: var seq[T]; y: openArray[T])
first type mismatch at position: 1
required type for x: var seq[T]
but expression '5' is of type: int literal(5)
proc add[T](x: var seq[T]; y: sink T)
first type mismatch at position: 1
required type for x: var seq[T]
but expression '5' is of type: int literal(5)
expression: add(5, 5)
Tip: 1 messages have been suppressed, use --verbose to show them.
Error: Execution failed with exit code 1
... Command: C:\Users\rtdie\.nimble\bin\nim.exe c --noNimblePath -d:NimblePkgVersion=1.0.00 --hints:off -r --path:. K:\40-Nim\Projects\cmdparser\tests\test1
PS K:\40-Nim\Projects\cmdparser>
it is clearly proclaimed better to use "testament"
its not. dont trust what you read, even in official docs.