From eec07b4e84d3418d171cf08aa8a02f380a39b78e Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Tue, 11 Feb 2020 12:33:06 -0800 Subject: fix several bugs with `repr` (#13386) --- tests/errmsgs/t8434.nim | 3 +-- tests/macros/tdumpast.nim | 17 +++++++++++++++++ tests/stdlib/tunittesttemplate.nim | 4 ++-- 3 files changed, 20 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/errmsgs/t8434.nim b/tests/errmsgs/t8434.nim index ada38e9c0..c8bc1193b 100644 --- a/tests/errmsgs/t8434.nim +++ b/tests/errmsgs/t8434.nim @@ -1,8 +1,7 @@ discard """ errormsg: "type mismatch: got " nimout: '''but expected one of: -proc fun0[T1: int | float | - object | array | seq](a1: T1; a2: int) +proc fun0[T1: int | float | object | array | seq](a1: T1; a2: int) first type mismatch at position: 1 required type for a1: T1: int or float or object or array or seq[T] but expression 'byte(1)' is of type: byte diff --git a/tests/macros/tdumpast.nim b/tests/macros/tdumpast.nim index 3a26ffd2f..b9d224ab8 100644 --- a/tests/macros/tdumpast.nim +++ b/tests/macros/tdumpast.nim @@ -31,3 +31,20 @@ dumpAST: proc sub(x, y: int): int = return x - y +macro fun() = + let n = quote do: + 1+1 == 2 + doAssert n.repr == "1 + 1 == 2", n.repr +fun() + +macro fun2(): untyped = + let n = quote do: + 1 + 2 * 3 == 1 + 6 + doAssert n.repr == "1 + 2 * 3 == 1 + 6", n.repr +fun2() + +macro fun3(): untyped = + let n = quote do: + int | float | array | seq | object | ptr | pointer | float32 + doAssert n.repr == "int | float | array | seq | object | ptr | pointer | float32", n.repr +fun3() diff --git a/tests/stdlib/tunittesttemplate.nim b/tests/stdlib/tunittesttemplate.nim index 5ac323a36..2ca50a18b 100644 --- a/tests/stdlib/tunittesttemplate.nim +++ b/tests/stdlib/tunittesttemplate.nim @@ -1,13 +1,13 @@ discard """ exitcode: 1 outputsub: ''' - tunittesttemplate.nim(20, 12): Check failed: a.b == - 2 + tunittesttemplate.nim(20, 12): Check failed: a.b == 2 a.b was 0 [FAILED] 1 ''' """ + # bug #6736 import unittest -- cgit 1.4.1-2-gfad0