2011-10-16 16:01:36 -04:00
|
|
|
USING: io lint kernel math sequences tools.test ;
|
2008-12-07 02:55:19 -05:00
|
|
|
IN: lint.tests
|
|
|
|
|
|
|
|
! Don't write code like this
|
2009-04-17 15:44:08 -04:00
|
|
|
: lint1 ( obj -- ) [ "hi" print ] [ ] if ; ! when
|
2008-12-07 02:55:19 -05:00
|
|
|
|
2015-07-03 12:39:59 -04:00
|
|
|
{ { { lint1 { [ [ ] if ] } } } } [ \ lint1 lint-word ] unit-test
|
2008-12-07 02:55:19 -05:00
|
|
|
|
2012-08-06 10:57:35 -04:00
|
|
|
! : lint2 ( a b -- b a b ) dup -rot ; ! tuck
|
2008-12-07 02:55:19 -05:00
|
|
|
|
2012-08-06 10:57:35 -04:00
|
|
|
! [ { { lint2 { [ dup -rot ] } } } ] [ \ lint2 lint-word ] unit-test
|
2011-10-16 16:01:36 -04:00
|
|
|
|
|
|
|
: lint3 ( seq -- seq ) [ 0 swap nth 1 + ] map ;
|
|
|
|
|
2015-07-03 12:39:59 -04:00
|
|
|
{ { { lint3 { [ 0 swap nth ] } } } } [ \ lint3 lint-word ] unit-test
|