]> gitweb.factorcode.org Git - factor.git/commitdiff
memoize: add another test case, only ( -- ) was broken
authorJohn Benediktsson <mrjbq7@gmail.com>
Tue, 4 Apr 2023 20:58:48 +0000 (13:58 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Tue, 4 Apr 2023 20:58:48 +0000 (13:58 -0700)
core/memoize/memoize-tests.factor

index 8125f1237c295ef1f38a8f55cf75f5c887955b75..809cae2794ac5dbce8e3a5252f888bcd45bcff1e 100644 (file)
@@ -38,7 +38,7 @@ SYMBOL: foo-counter
 
 MEMO: foo ( -- ) foo-counter counter drop ;
 
-[ 0 1 1 1 ] [
+{ 0 1 1 1 } [
     foo-counter get-global
     foo
     foo-counter get-global
@@ -47,3 +47,15 @@ MEMO: foo ( -- ) foo-counter counter drop ;
     foo
     foo-counter get-global
 ] unit-test
+
+SYMBOL: bar-counter
+0 bar-counter set-global
+
+MEMO: bar ( -- x ) bar-counter counter ;
+
+{ 0 1 1 1 } [
+    bar-counter get-global
+    bar
+    bar
+    bar
+] unit-test