: 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?
[ 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 ;
""
"USING: kernel prettyprint.tests ;"
"M: object method-layout ;"
- ""
}
} [
[ \ method-layout see-methods ] with-string-writer split-lines
""
"IN: prettyprint.tests"
"GENERIC: class-see-layout ( x -- y )"
- ""
}
} [
[ \ class-see-layout see ] with-string-writer split-lines
{
"USING: prettyprint.tests ;"
"M: class-see-layout class-see-layout ;"
- ""
}
} [
[ \ class-see-layout see-methods ] with-string-writer split-lines
"USING: math ;"
"IN: prettyprint.tests"
"TUPLE: tuple-with-declared-slot { x integer initial: 0 } ;"
- ""
}
} [
[ \ tuple-with-declared-slot see ] with-string-writer split-lines
{
"IN: prettyprint.tests"
"TUPLE: tuple-with-read-only-slot { x read-only } ;"
- ""
}
} [
[ \ tuple-with-read-only-slot see ] with-string-writer split-lines
{
"IN: prettyprint.tests"
"TUPLE: tuple-with-initial-slot { x initial: 123 } ;"
- ""
}
} [
[ \ tuple-with-initial-slot see ] with-string-writer split-lines
"IN: prettyprint.tests"
"TUPLE: tuple-with-initial-declared-slot"
" { x integer initial: 123 } ;"
- ""
}
} [
[ \ tuple-with-initial-declared-slot see ] with-string-writer split-lines
{
"IN: prettyprint.tests"
"TUPLE: final-tuple ; final"
- ""
}
} [
[ \ final-tuple see ] with-string-writer split-lines
: 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