new tester; all tests categorized

This commit is contained in:
Araq 2014-01-13 02:10:03 +01:00
commit 20b5f31c03
481 changed files with 794 additions and 2506 deletions

21
tests/borrow/tborrow.nim Normal file
View file

@ -0,0 +1,21 @@
discard """
output: "4887 true"
"""
# test the new borrow feature that works with generics:
proc `++`*[T: int | float](a, b: T): T =
result = a + b
type
DI = distinct int
DF = distinct float
DS = distinct string
proc `++`(x, y: DI): DI {.borrow.}
proc `++`(x, y: DF): DF {.borrow.}
proc `$`(x: DI): string {.borrow.}
proc `$`(x: DF): string {.borrow.}
echo 4544.DI ++ 343.di, " ", (4.5.df ++ 0.5.df).float == 5.0

View file

@ -0,0 +1,17 @@
discard """
line: 11
errormsg: "no symbol to borrow from found"
"""
# bug #516
type
TAtom = culong
proc `==`*(a, b: TAtom): bool {.borrow.}
var
d, e: TAtom
echo( $(d == e) )