Add tests for arrow like ops in tstrongspaces.nim
This commit is contained in:
parent
f15b4ccb52
commit
de34640098
1 changed files with 14 additions and 0 deletions
|
|
@ -15,6 +15,10 @@ true
|
||||||
tester args
|
tester args
|
||||||
all
|
all
|
||||||
all args
|
all args
|
||||||
|
19
|
||||||
|
-3
|
||||||
|
false
|
||||||
|
-2
|
||||||
'''
|
'''
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
@ -67,3 +71,13 @@ const
|
||||||
echo tester & " " & args|"all"
|
echo tester & " " & args|"all"
|
||||||
echo "all" | tester & " " & args
|
echo "all" | tester & " " & args
|
||||||
echo "all"|tester & " " & args
|
echo "all"|tester & " " & args
|
||||||
|
|
||||||
|
# Test arrow like operators. See also tests/macros/tclosuremacro.nim
|
||||||
|
proc `-+>`(a, b: int): int = a + b*4
|
||||||
|
template `===>`(a, b: int): expr = a - b shr 1
|
||||||
|
|
||||||
|
echo 3 -+> 2 + 2 and 4
|
||||||
|
var arrowed = 3-+>2 + 2 and 4 # arrowed = 4
|
||||||
|
echo arrowed ===> 15
|
||||||
|
echo (2 * 3-+>2) == (2*3 -+> 2)
|
||||||
|
echo arrowed ===> 2 + 3-+>2
|
||||||
Loading…
Add table
Add a link
Reference in a new issue