factor/basis/peg/search/search-tests.factor

19 lines
496 B
Factor
Raw Normal View History

! Copyright (C) 2007 Chris Double.
! See http://factorcode.org/license.txt for BSD license.
!
2008-03-06 14:46:15 -05:00
USING: kernel math math.parser arrays tools.test peg peg.parsers
peg.search ;
2008-03-01 17:00:45 -05:00
IN: peg.search.tests
{ V{ 123 456 } } [
"abc 123 def 456" integer-parser search
] unit-test
{ V{ 123 "hello" 456 } } [
"one 123 \"hello\" two 456" integer-parser string-parser 2array choice search
] unit-test
{ "abc 246 def 912" } [
"abc 123 def 456" integer-parser [ 2 * number>string ] action replace
] unit-test