]> gitweb.factorcode.org Git - factor.git/commitdiff
Add more control-pictures
authorAlex Maestas <git@se30.xyz>
Thu, 29 Sep 2022 23:53:50 +0000 (23:53 +0000)
committerJohn Benediktsson <mrjbq7@gmail.com>
Thu, 20 Oct 2022 17:23:31 +0000 (10:23 -0700)
basis/unicode/control-pictures/control-pictures-tests.factor
basis/unicode/control-pictures/control-pictures.factor

index fb19622ceeff89b7f929b7d5729fd2297c8425fa..35b2b6d496526f5a47f8716e53b54e0e36fe4e2b 100644 (file)
@@ -3,3 +3,10 @@ USING: sequences strings tools.test unicode.control-pictures ;
 { "␀␁␂␃␄␅␆␇␈␉␊␋␌␍␎␏␐␑␒␓␔␕␖␗␘␙␚␛␜␝␞␟ !\"#$%&'()*+,-./" } [
     48 <iota> >string control-pictures
 ] unit-test
+
+{ "␡" } [ "\x7f" control-pictures ] unit-test
+{ "a␡b" } [ "a\x7fb" control-pictures ] unit-test
+
+{ "␀␁␂␃␄␅␆␇␈␉␊␋␌␍␎␏␐␑␒␓␔␕␖␗␘␙␚␛␜␝␞␟␠!\"#$%&'()*+,-./" } [
+    48 <iota> >string control-pictures*
+] unit-test
index 5e7515bb247292e6a936ea4d97afecd2b39ae6a5..defec7e40e34682ccadf21f732b3407872bf227d 100644 (file)
@@ -12,7 +12,14 @@ IN: unicode.control-pictures
         [ ]
     } cond ;
 
+: char>control-picture* ( char -- char' )
+    char>control-picture
+    dup 0x20 = [ drop 0x2420 ] when ;
+
 PRIVATE>
 
 : control-pictures ( string -- string )
     [ char>control-picture ] map ;
+
+: control-pictures* ( string -- string )
+    [ char>control-picture* ] map ;