From 3adaa7a18e51216ec37c85a3fe9ce44d46eb9a09 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Thu, 22 Jan 2009 21:22:28 -0600 Subject: [PATCH] Add unit tests for non-optimizing compiler regression found by doublec --- basis/peg/peg-tests.factor | 18 ++++++++++++++++-- core/compiler/units/units-tests.factor | 9 ++++++++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/basis/peg/peg-tests.factor b/basis/peg/peg-tests.factor index 2d7e2a81ac..9a15dd2105 100644 --- a/basis/peg/peg-tests.factor +++ b/basis/peg/peg-tests.factor @@ -2,9 +2,11 @@ ! See http://factorcode.org/license.txt for BSD license. ! USING: kernel tools.test strings namespaces make arrays sequences - peg peg.private accessors words math accessors ; + peg peg.private peg.parsers accessors words math accessors ; IN: peg.tests +[ ] [ reset-pegs ] unit-test + [ "endbegin" "begin" token parse ] must-fail @@ -193,4 +195,16 @@ IN: peg.tests "B" [ drop t ] satisfy [ 66 >= ] semantic parse ] unit-test -{ f } [ \ + T{ parser f f f } equal? ] unit-test \ No newline at end of file +{ f } [ \ + T{ parser f f f } equal? ] unit-test + +USE: compiler + +[ ] [ disable-compiler ] unit-test + +[ ] [ "" epsilon parse drop ] unit-test + +[ ] [ enable-compiler ] unit-test + +[ [ ] ] [ "" epsilon [ drop [ [ ] ] call ] action parse ] unit-test + +[ [ ] ] [ "" epsilon [ drop [ [ ] ] ] action [ call ] action parse ] unit-test \ No newline at end of file diff --git a/core/compiler/units/units-tests.factor b/core/compiler/units/units-tests.factor index b30e92bbfd..884207b901 100644 --- a/core/compiler/units/units-tests.factor +++ b/core/compiler/units/units-tests.factor @@ -1,5 +1,6 @@ IN: compiler.units.tests -USING: definitions compiler.units tools.test arrays sequences ; +USING: definitions compiler.units tools.test arrays sequences words kernel +accessors ; [ flushed-dependency ] [ f flushed-dependency strongest-dependency ] unit-test [ flushed-dependency ] [ flushed-dependency f strongest-dependency ] unit-test @@ -7,3 +8,9 @@ USING: definitions compiler.units tools.test arrays sequences ; [ inlined-dependency ] [ called-dependency inlined-dependency strongest-dependency ] unit-test [ flushed-dependency ] [ called-dependency flushed-dependency strongest-dependency ] unit-test [ called-dependency ] [ called-dependency f strongest-dependency ] unit-test + +! Non-optimizing compiler bug +[ 1 1 ] [ + "A" "B" [ [ 1 ] dip ] >>def dup f 2array 1array f modify-code-heap + 1 swap execute +] unit-test \ No newline at end of file -- 2.11.4.GIT