From: Doug Coleman Date: Tue, 21 Dec 2021 05:15:39 +0000 (-0600) Subject: factor: Update split-lines tests, fix other tests X-Git-Tag: 0.99~2166 X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=654bb836138567e77f4d471d03bf98a79d96f3bc factor: Update split-lines tests, fix other tests --- diff --git a/basis/io/crlf/crlf.factor b/basis/io/crlf/crlf.factor index 43f6ae0cd6..1efdbb4dd7 100644 --- a/basis/io/crlf/crlf.factor +++ b/basis/io/crlf/crlf.factor @@ -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? diff --git a/basis/prettyprint/prettyprint-tests.factor b/basis/prettyprint/prettyprint-tests.factor index 3b550071b6..e1f0477105 100644 --- a/basis/prettyprint/prettyprint-tests.factor +++ b/basis/prettyprint/prettyprint-tests.factor @@ -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 diff --git a/basis/unicode/collation/collation-tests.factor b/basis/unicode/collation/collation-tests.factor index 1cb09c8319..f8c00dc789 100644 --- a/basis/unicode/collation/collation-tests.factor +++ b/basis/unicode/collation/collation-tests.factor @@ -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 diff --git a/basis/unicode/normalize/normalize-tests.factor b/basis/unicode/normalize/normalize-tests.factor index a97fc42231..533cd3af89 100644 --- a/basis/unicode/normalize/normalize-tests.factor +++ b/basis/unicode/normalize/normalize-tests.factor @@ -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 ; diff --git a/basis/xml/syntax/syntax-tests.factor b/basis/xml/syntax/syntax-tests.factor index 08205a19cf..c354137cff 100644 --- a/basis/xml/syntax/syntax-tests.factor +++ b/basis/xml/syntax/syntax-tests.factor @@ -74,7 +74,7 @@ XML-NS: foo http://blah.com three " } [ - "one two three" split-Words + "one two three" split-words [ [XML <-> XML] ] map <-> XML> pprint-xml>string ] unit-test diff --git a/extra/python/syntax/syntax-tests.factor b/extra/python/syntax/syntax-tests.factor index 9e4e212d5a..92728a8b54 100644 --- a/extra/python/syntax/syntax-tests.factor +++ b/extra/python/syntax/syntax-tests.factor @@ -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 } [