From 154de53470720c57da4f57a64f4adb6bf669b59c Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Tue, 25 Jul 2017 11:31:30 -0700 Subject: [PATCH] tools.test: less duplication in unit-test~/v~. --- basis/tools/test/test.factor | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/basis/tools/test/test.factor b/basis/tools/test/test.factor index 939f6d191b..b33afe19c8 100644 --- a/basis/tools/test/test.factor +++ b/basis/tools/test/test.factor @@ -66,15 +66,16 @@ SYMBOL: current-test-file : (unit-test-comparator) ( output input comparator -- error/f failed? tested? ) swapd '[ - { } _ with-datastack - _ >quotation _ compose with-datastack first dup not + { } _ with-datastack _ >quotation + [ 3dup @ [ 3drop t ] [ drop assert ] if ] compose + with-datastack first dup not ] [ t ] recover t ; inline : (unit-test~) ( output input -- error/f failed? tested? ) - [ 3dup ~ [ 3drop t ] [ drop assert ] if ] (unit-test-comparator) ; + [ ~ ] (unit-test-comparator) ; : (unit-test-v~) ( output input -- error/f failed? tested? ) - [ 3dup v~ [ 3drop t ] [ drop assert ] if ] (unit-test-comparator) ; + [ v~ ] (unit-test-comparator) ; : short-effect ( effect -- pair ) [ in>> length ] [ out>> length ] bi 2array ;