]> gitweb.factorcode.org Git - factor.git/commitdiff
add test case for: chars > 127 were being read incorrectly in cfactor
authorSlava Pestov <slava@factorcode.org>
Fri, 3 Sep 2004 03:00:30 +0000 (03:00 +0000)
committerSlava Pestov <slava@factorcode.org>
Fri, 3 Sep 2004 03:00:30 +0000 (03:00 +0000)
library/httpd/wiki-responder.factor
library/test/io/binary.txt [new file with mode: 0644]
library/test/io/io.factor

index 65e4370bdbac063cd94a07c2ebe62f168fd45ef1..2e48101ea67870c379531cc32916aa5ff20564fe 100644 (file)
@@ -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 -- )
     "<hr>" 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 (file)
index 0000000..ce542ef
--- /dev/null
@@ -0,0 +1 @@
+ΓΏ
\ No newline at end of file
index 7554acec8f7c1d9bdab92809d64f1ca85c7bb5b1..247450d65ed0f619ed94806a2ff9dbb230eb3231 100644 (file)
@@ -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" <resource-stream> fread#
+    "/library/test/io/mac-os-eol.txt" <resource-stream>
+    [ 500 read# ] with-stream
+] unit-test
+
+[
+    255
+] [
+    "/library/test/io/binary.txt" <resource-stream>
+    [ read1 ] with-stream >fixnum
 ] unit-test