factor/extra/lint/lint-tests.factor

16 lines
446 B
Factor
Raw Permalink Normal View History

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
{ { { 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
: lint3 ( seq -- seq ) [ 0 swap nth 1 + ] map ;
{ { { lint3 { [ 0 swap nth ] } } } } [ \ lint3 lint-word ] unit-test