]> gitweb.factorcode.org Git - factor.git/commitdiff
sequences: fix 1surround, add tests
authorDoug Coleman <doug.coleman@gmail.com>
Wed, 12 Jan 2022 03:06:17 +0000 (21:06 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Wed, 12 Jan 2022 03:06:17 +0000 (21:06 -0600)
core/sequences/sequences-tests.factor
core/sequences/sequences.factor

index 61ca2d6e802a3ede954663fe1c968315c2290c67..cdb92e6df9ac48326822e983c258f72c05814007 100644 (file)
@@ -427,3 +427,12 @@ M: bogus-hashcode hashcode* 2drop 0 >bignum ;
 { f } [ { } { 99 88 } [ <= ] 2any? ] unit-test
 { t } [ { 2 4 5 8 } { 2 4 6 8 } [ < ] 2any? ] unit-test
 { f } [ { 2 4 6 8 } { 2 4 6 8 } [ < ] 2any? ] unit-test
+
+{ "ollo" } [ "ll" "o" 1surround ] unit-test
+{ "ollo" } [ { CHAR: l CHAR: l } "o" 1surround ] unit-test
+
+{ { CHAR: o CHAR: l CHAR: l CHAR: o } }
+[ { CHAR: l CHAR: l } "o" { } 1surround-as ] unit-test
+
+{ "ollo" }
+[ { CHAR: l CHAR: l } "o" "" 1surround-as ] unit-test
\ No newline at end of file
index 7d20148de9b2b19ce121cfe19fa346c370c94075..610630053e197f44e1c49830a89caab8b3893945 100644 (file)
@@ -382,7 +382,7 @@ PRIVATE>
 
 : 1surround-as ( seq1 seq2 exemplar  -- newseq ) dupd surround-as ; inline
 
-: 1surround ( seq1 seq2 -- newseq ) over 1surround-as ; inline
+: 1surround ( seq1 seq2 -- newseq ) dup 1surround-as ; inline
 
 : glue-as ( seq1 seq2 seq3 exemplar -- newseq ) swapd 3append-as ; inline