diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/types/tisopr.nim | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/tests/types/tisopr.nim b/tests/types/tisopr.nim index 6d3c51749..f173b93f4 100644 --- a/tests/types/tisopr.nim +++ b/tests/types/tisopr.nim @@ -1,5 +1,8 @@ discard """ - output: "true true false yes" + output: '''true +true +false +yes''' """ proc IsVoid[T](): string = @@ -11,3 +14,26 @@ proc IsVoid[T](): string = const x = int is int echo x, " ", float is float, " ", float is string, " ", IsVoid[void]() +template yes(e: expr): stmt = + static: assert e + +template no(e: expr): stmt = + static: assert(not e) + +var s = @[1, 2, 3] + +yes s.items is iterator +no s.items is proc + +yes s.items is iterator: int +no s.items is iterator: float + +yes s.items is iterator: TNumber +no s.items is iterator: object + +type + Iter[T] = iterator: T + +yes s.items is Iter[TNumber] +no s.items is Iter[float] + |