factor/extra/lint/lint-tests.factor

15 lines
367 B
Factor

USING: io lint kernel math tools.test ;
IN: lint.tests
! Don't write code like this
: lint1 ( -- ) [ "hi" print ] [ ] if ; ! when
[ { { lint1 { [ [ ] if ] } } } ] [ \ lint1 lint-word ] unit-test
: lint2 ( n -- n' ) 1 + ; ! 1+
[ { [ 1 + ] } ] [ \ lint2 lint ] unit-test
: lint3 dup -rot ; ! tuck
[ { { lint3 { [ dup -rot ] } } } ] [ \ lint3 lint-word ] unit-test