From 6bd761e4609a1ac2048e7bde627c4ccc384adc4a Mon Sep 17 00:00:00 2001 From: Chris Double Date: Fri, 20 Jun 2008 12:35:33 +1200 Subject: [PATCH] Another breaking unit test for ebnf --- extra/peg/ebnf/ebnf-tests.factor | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/extra/peg/ebnf/ebnf-tests.factor b/extra/peg/ebnf/ebnf-tests.factor index 1824c0342a..0a16fc8007 100644 --- a/extra/peg/ebnf/ebnf-tests.factor +++ b/extra/peg/ebnf/ebnf-tests.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. ! USING: kernel tools.test peg peg.ebnf words math math.parser - sequences accessors peg.parsers ; + sequences accessors peg.parsers parser namespaces ; IN: peg.ebnf.tests { T{ ebnf-non-terminal f "abc" } } [ @@ -443,10 +443,17 @@ foo= 'd' "ad" parser4 ast>> ] unit-test -{ V{ "a" "\n" } } [ - "a\n" [EBNF foo='a' '\n' => [[ drop '\n' ]] EBNF] call ast>> +{ t } [ + "USING: kernel peg.ebnf ; [EBNF foo='a' '\n' => [[ drop '\n' ]] EBNF]" eval drop t ] unit-test +[ + "USING: peg.ebnf ; [EBNF foo='a' foo='b' EBNF]" eval +] must-fail + + { t } [ - [EBNF foo='a' foo='b' EBNF] drop t + #! Rule lookup occurs in a namespace. This causes an incorrect duplicate rule + #! if a var in a namespace is set. This unit test is to remind me to fix this. + [ "fail" "foo" set "foo='a'" 'ebnf' parse ast>> transform drop t ] with-scope ] unit-test \ No newline at end of file