]> gitweb.factorcode.org Git - factor.git/commitdiff
peg: adding a future test case
authorJohn Benediktsson <mrjbq7@gmail.com>
Mon, 28 Aug 2023 21:55:31 +0000 (14:55 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 28 Aug 2023 21:55:31 +0000 (14:55 -0700)
basis/peg/peg-tests.factor

index b71025dd6fd11848c95b15c3b783502b3c02b7d2..410bc315ec1e6b6ba5347dcfc2a528e45d6e900d 100644 (file)
@@ -1,8 +1,10 @@
 ! Copyright (C) 2007 Chris Double.
 ! See https://factorcode.org/license.txt for BSD license.
-!
-USING: continuations kernel tools.test strings namespaces make arrays
-sequences peg peg.private peg.parsers words math accessors ;
+
+USING: accessors arrays compiler concurrency.futures
+continuations kernel make math namespaces peg peg.parsers
+peg.private sequences strings tools.test words ;
+
 IN: peg.tests
 
 { } [ reset-pegs ] unit-test
@@ -197,8 +199,6 @@ IN: peg.tests
 
 { f } [ \ + T{ parser f f f } equal? ] unit-test
 
-USE: compiler
-
 { } [ disable-optimizer ] unit-test
 
 { } [ "" epsilon parse drop ] unit-test
@@ -216,3 +216,10 @@ USE: compiler
 } [
     [ "fbcd" "a" token "b" token 2array choice parse ] [ ] recover
 ] unit-test
+
+PEG: foo ( x -- x ) "abc" token ;
+
+{ t } [
+    10,000 [ [ "abc" foo ] future ] replicate
+    [ ?future "abc" = ] all?
+] unit-test