From c0dfdfb23bd4e813917368cd5fc0f26e9186138b Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 3 Sep 2004 03:00:30 +0000 Subject: [PATCH] add test case for: chars > 127 were being read incorrectly in cfactor --- library/httpd/wiki-responder.factor | 4 ++-- library/test/io/binary.txt | 1 + library/test/io/io.factor | 14 ++++++++++++-- 3 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 library/test/io/binary.txt diff --git a/library/httpd/wiki-responder.factor b/library/httpd/wiki-responder.factor index 65e4370bdb..2e48101ea6 100644 --- a/library/httpd/wiki-responder.factor +++ b/library/httpd/wiki-responder.factor @@ -48,7 +48,7 @@ USE: httpd-responder wiki-word-regexp re-matches ; : wiki-word-links ( str -- str ) - wiki-word-regexp "$1" "$1" link-tag re-replace ; + wiki-word-regexp "$1" "$1" re-replace ; : get-wiki-page ( name -- text ) "wiki" get [ get ] bind ; @@ -70,7 +70,7 @@ USE: httpd-responder : wiki-footer ( name -- ) "
" print - "Edit" swap "edit?" swap cat2 link-tag write ; + "Edit" swap "edit?" swap cat2 write ; : serve-existing-page ( name text -- ) over [ write-wiki-page wiki-footer ] html-document ; diff --git a/library/test/io/binary.txt b/library/test/io/binary.txt new file mode 100644 index 0000000000..ce542efaa5 --- /dev/null +++ b/library/test/io/binary.txt @@ -0,0 +1 @@ +ÿ \ No newline at end of file diff --git a/library/test/io/io.factor b/library/test/io/io.factor index 7554acec8f..247450d65e 100644 --- a/library/test/io/io.factor +++ b/library/test/io/io.factor @@ -4,11 +4,13 @@ USE: parser USE: stack USE: streams USE: test +USE: stdio +USE: math [ 4 ] [ "/library/test/io/no-trailing-eol.factor" run-resource ] unit-test : lines-test ( stream -- line1 line2 ) - dup freadln swap dup freadln swap fclose ; + [ read read ] with-stream ; [ "This is a line." @@ -27,5 +29,13 @@ USE: test [ "This is a line.\rThis is another line.\r" ] [ - 500 "/library/test/io/mac-os-eol.txt" fread# + "/library/test/io/mac-os-eol.txt" + [ 500 read# ] with-stream +] unit-test + +[ + 255 +] [ + "/library/test/io/binary.txt" + [ read1 ] with-stream >fixnum ] unit-test