combinators.smart: smart-if was declared inline, and had no unit tests, and so was broken. This was not caught until inline macros became a parse error. Add unit tests for it
parent
ca19d44350
commit
0fa425b03a
|
@ -53,3 +53,9 @@ IN: combinators.smart.tests
|
|||
{ 2 0 } [ [ + ] nullary ] must-infer-as
|
||||
|
||||
{ 2 2 } [ [ [ + ] nullary ] preserving ] must-infer-as
|
||||
|
||||
: smart-if-test ( a b -- b )
|
||||
[ < ] [ swap - ] [ - ] smart-if ;
|
||||
|
||||
[ 7 ] [ 10 3 smart-if-test ] unit-test
|
||||
[ 16 ] [ 25 41 smart-if-test ] unit-test
|
||||
|
|
|
@ -50,4 +50,4 @@ MACRO: nullary ( quot -- quot' )
|
|||
dup outputs '[ @ _ ndrop ] ;
|
||||
|
||||
MACRO: smart-if ( pred true false -- )
|
||||
'[ _ preserving _ _ if ] ; inline
|
||||
'[ _ preserving _ _ if ] ;
|
||||
|
|
Loading…
Reference in New Issue