]> gitweb.factorcode.org Git - factor.git/commitdiff
factor: Update split-lines tests, fix other tests
authorDoug Coleman <doug.coleman@gmail.com>
Tue, 21 Dec 2021 05:15:39 +0000 (23:15 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Tue, 21 Dec 2021 05:15:39 +0000 (23:15 -0600)
basis/io/crlf/crlf.factor
basis/prettyprint/prettyprint-tests.factor
basis/unicode/collation/collation-tests.factor
basis/unicode/normalize/normalize-tests.factor
basis/xml/syntax/syntax-tests.factor
extra/python/syntax/syntax-tests.factor

index 43f6ae0cd6c6bc1515201bb27efc3b45deff8147..1efdbb4dd7f229c9a81402c932af790561a96b3e 100644 (file)
@@ -26,8 +26,9 @@ IN: io.crlf
 : crlf>lf ( str -- str' )
     CHAR: \r swap remove ;
 
+! Note: can't use split-lines here
 : lf>crlf ( str -- str' )
-    split-lines "\r\n" join ;
+    "\n" split "\r\n" join ;
 
 :: stream-read1-ignoring-crlf ( stream -- ch )
     stream stream-read1 dup "\r\n" member?
index 3b550071b616868e94a8d3f3d1a2fa32afe3f203..e1f0477105596aa53ef40f74bd8c6bb0802e4820 100644 (file)
@@ -115,7 +115,7 @@ unit-test
             [ parse-fresh drop ] with-compilation-unit
             [
                 "prettyprint.tests" lookup-word see
-            ] with-string-writer split-lines but-last
+            ] with-string-writer split-lines
         ] keep =
     ] with-interactive-vocabs ;
 
@@ -148,7 +148,6 @@ M: object method-layout ;
         ""
         "USING: kernel prettyprint.tests ;"
         "M: object method-layout ;"
-        ""
     }
 } [
     [ \ method-layout see-methods ] with-string-writer split-lines
@@ -250,7 +249,6 @@ M: class-see-layout class-see-layout ;
         ""
         "IN: prettyprint.tests"
         "GENERIC: class-see-layout ( x -- y )"
-        ""
     }
 } [
     [ \ class-see-layout see ] with-string-writer split-lines
@@ -260,7 +258,6 @@ M: class-see-layout class-see-layout ;
     {
         "USING: prettyprint.tests ;"
         "M: class-see-layout class-see-layout ;"
-        ""
     }
 } [
     [ \ class-see-layout see-methods ] with-string-writer split-lines
@@ -330,7 +327,6 @@ TUPLE: tuple-with-declared-slot { x integer } ;
         "USING: math ;"
         "IN: prettyprint.tests"
         "TUPLE: tuple-with-declared-slot { x integer initial: 0 } ;"
-        ""
     }
 } [
     [ \ tuple-with-declared-slot see ] with-string-writer split-lines
@@ -342,7 +338,6 @@ TUPLE: tuple-with-read-only-slot { x read-only } ;
     {
         "IN: prettyprint.tests"
         "TUPLE: tuple-with-read-only-slot { x read-only } ;"
-        ""
     }
 } [
     [ \ tuple-with-read-only-slot see ] with-string-writer split-lines
@@ -354,7 +349,6 @@ TUPLE: tuple-with-initial-slot { x initial: 123 } ;
     {
         "IN: prettyprint.tests"
         "TUPLE: tuple-with-initial-slot { x initial: 123 } ;"
-        ""
     }
 } [
     [ \ tuple-with-initial-slot see ] with-string-writer split-lines
@@ -368,7 +362,6 @@ TUPLE: tuple-with-initial-declared-slot { x integer initial: 123 } ;
         "IN: prettyprint.tests"
         "TUPLE: tuple-with-initial-declared-slot"
         "    { x integer initial: 123 } ;"
-        ""
     }
 } [
     [ \ tuple-with-initial-declared-slot see ] with-string-writer split-lines
@@ -380,7 +373,6 @@ TUPLE: final-tuple ; final
     {
         "IN: prettyprint.tests"
         "TUPLE: final-tuple ; final"
-        ""
     }
 } [
     [ \ final-tuple see ] with-string-writer split-lines
index 1cb09c83194c992fbdad08b838671b487b410d88..f8c00dc7892a20b355f457cd8a79585b619a16ec 100644 (file)
@@ -24,19 +24,19 @@ IN: unicode.collation.tests
 
 : parse-collation-test-shifted ( -- lines )
     collation-test-lines
-    [ ";" split first words [ hex> ] "" map-as ] map ;
+    [ ";" split first split-words [ hex> ] "" map-as ] map ;
 
 : tail-from-last ( string char -- string' )
     '[ _ = ] dupd find-last drop 1 + tail ; inline
 
 : line>test-weights ( string -- pair )
     ";" split1 [
-        words [ hex> ] map
+        split-words [ hex> ] map
     ] [
         "#" split1 nip CHAR: [ tail-from-last
         "]" split1 drop
         "|" split 4 head
-        [ words harvest [ hex> ] map ] map
+        [ split-words harvest [ hex> ] map ] map
     ] bi* 2array ;
 
 ! These tests actually would pass if I didn't fix up
index a97fc42231e92560502627917a02804211aaba03..533cd3af8927d998bdcee9628ba6b08cc003c444 100644 (file)
@@ -34,7 +34,7 @@ IN: unicode.normalize.tests
     values [
         [
             "#@" split first [ CHAR: \s = ] trim-tail ";" split harvest
-            [ words [ hex> ] "" map-as ] map
+            [ split-words [ hex> ] "" map-as ] map
         ] map
     ] map concat ;
 
index 08205a19cfef6a6706b40c8bb23d9ff164cbfe5a..c354137cff912d6a1f12486df49226239f4453e5 100644 (file)
@@ -74,7 +74,7 @@ XML-NS: foo http://blah.com
     three
   </item>
 </doc>" } [
-    "one two three" split-Words
+    "one two three" split-words
     [ [XML <item><-></item> XML] ] map
     <XML <doc><-></doc> XML> pprint-xml>string
 ] unit-test
index 9e4e212d5a34a75e4b786402d8ea3b5a27090227..92728a8b5427de6ed30690475edb9b78ad9cce60 100644 (file)
@@ -107,7 +107,7 @@ PY-METHODS: code =>
         ArgumentParser dup
         "--foo" >py H{ { "help" "badger" } } >py add_argument
         format_help py>
-    ] with-destructors [ blank? ] s:trim words "badger" swap in?
+    ] with-destructors [ blank? ] s:trim string-words "badger" swap in?
 ] py-test
 
 { t } [