mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-21 06:45:27 +00:00
expr params implemented for procs; paving the way for type classes
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
import uclosures, utemplates
|
||||
import uclosures, utemplates, uexpr
|
||||
|
||||
|
||||
13
tests/run/uexpr.nim
Normal file
13
tests/run/uexpr.nim
Normal file
@@ -0,0 +1,13 @@
|
||||
import unittest
|
||||
|
||||
proc concat(a, b): string =
|
||||
result = $a & $b
|
||||
|
||||
test "if proc param types are not supplied, the params are assumed to be generic":
|
||||
check concat(1, "test") == "1test"
|
||||
check concat(1, 20) == "120"
|
||||
check concat("foo", "bar") == "foobar"
|
||||
|
||||
test "explicit param types can still be specified":
|
||||
check concat[cstring, cstring]("x", "y") == "xy"
|
||||
|
||||
Reference in New Issue
Block a user