From 20b5f31c03fb556ec0aa2428a40adbac004d8987 Mon Sep 17 00:00:00 2001 From: Araq Date: Mon, 13 Jan 2014 02:10:03 +0100 Subject: new tester; all tests categorized --- tests/constraints/tconstraints.nim | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tests/constraints/tconstraints.nim (limited to 'tests/constraints/tconstraints.nim') diff --git a/tests/constraints/tconstraints.nim b/tests/constraints/tconstraints.nim new file mode 100644 index 000000000..e61095fff --- /dev/null +++ b/tests/constraints/tconstraints.nim @@ -0,0 +1,18 @@ +discard """ + line: 16 + errormsg: "type mismatch: got (int literal(232))" +""" + +proc myGenericProc[T: object|tuple|ptr|ref|distinct](x: T): string = + result = $x + +type + TMyObj = tuple[x, y: int] + +var + x: TMyObj + +assert myGenericProc(x) == "(x: 0, y: 0)" +assert myGenericProc(232) == "232" + + -- cgit 1.4.1-2-gfad0