]> gitweb.factorcode.org Git - factor.git/commitdiff
io.styles refactoring introduced a load error in io.streams.null; fix that, add docs...
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Wed, 14 Jan 2009 01:25:44 +0000 (19:25 -0600)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Wed, 14 Jan 2009 01:25:44 +0000 (19:25 -0600)
basis/io/streams/null/null-docs.factor [new file with mode: 0644]
basis/io/streams/null/null-tests.factor [new file with mode: 0644]
basis/io/streams/null/null.factor
basis/io/styles/styles-tests.factor [new file with mode: 0644]
basis/stack-checker/stack-checker-tests.factor
core/strings/strings-tests.factor

diff --git a/basis/io/streams/null/null-docs.factor b/basis/io/streams/null/null-docs.factor
new file mode 100644 (file)
index 0000000..19bf825
--- /dev/null
@@ -0,0 +1,28 @@
+USING: io help.markup help.syntax quotations ;
+IN: io.streams.null
+
+HELP: null-reader
+{ $class-description "Singleton class of null reader streams." } ;
+
+HELP: null-writer
+{ $class-description "Singleton class of null writer streams." } ;
+
+HELP: with-null-reader
+{ $values { "quot" quotation } }
+{ $description "Calls the quotation with " { $link input-stream } " rebound to a " { $link null-reader } " which always produces EOF." } ;
+
+HELP: with-null-writer
+{ $values { "quot" quotation } }
+{ $description "Calls the quotation with " { $link output-stream } " rebound to a " { $link null-writer } " which ignores all output." } ;
+
+ARTICLE: "io.streams.null" "Null streams"
+"The " { $vocab-link "io.streams.null" } " vocabulary implements a pair of streams which are useful for testing. The null reader always yields EOF and the null writer ignores all output. Conceptually, they are similar to " { $snippet "/dev/null" } " on a Unix system."
+$nl
+"Null readers:"
+{ $subsection null-reader }
+{ $subsection with-null-writer }
+"Null writers:"
+{ $subsection null-writer }
+{ $subsection with-null-reader } ;
+
+ABOUT: "io.streams.null"
\ No newline at end of file
diff --git a/basis/io/streams/null/null-tests.factor b/basis/io/streams/null/null-tests.factor
new file mode 100644 (file)
index 0000000..e69de29
index 191c8dce9177d998e9d1b75ab6cdc565c2ddc939..a2224ef306397d630a2bd4ce7a5af09de1964cd3 100644 (file)
@@ -1,22 +1,19 @@
-! Copyright (C) 2007 Slava Pestov.
+! Copyright (C) 2007, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
+USING: kernel io io.timeouts io.styles destructors ;
 IN: io.streams.null
-USING: kernel io io.timeouts io.streams.duplex destructors ;
 
-TUPLE: null-stream ;
+SINGLETONS: null-reader null-writer ;
+UNION: null-stream null-reader null-writer ;
 
 M: null-stream dispose drop ;
 M: null-stream set-timeout 2drop ;
 
-TUPLE: null-reader < null-stream ;
-
 M: null-reader stream-readln drop f ;
 M: null-reader stream-read1 drop f ;
 M: null-reader stream-read-until 2drop f f ;
 M: null-reader stream-read 2drop f ;
 
-TUPLE: null-writer < null-stream ;
-
 M: null-writer stream-write1 2drop ;
 M: null-writer stream-write 2drop ;
 M: null-writer stream-nl drop ;
@@ -28,11 +25,7 @@ M: null-writer make-cell-stream nip ;
 M: null-writer stream-write-table 3drop ;
 
 : with-null-reader ( quot -- )
-    T{ null-reader } swap with-input-stream* ; inline
+    null-reader swap with-input-stream* ; inline
 
 : with-null-writer ( quot -- )
-    T{ null-writer } swap with-output-stream* ; inline
-
-: with-null-stream ( quot -- )
-    T{ duplex-stream f T{ null-reader } T{ null-writer } }
-    swap with-stream* ; inline
+    null-writer swap with-output-stream* ; inline
\ No newline at end of file
diff --git a/basis/io/styles/styles-tests.factor b/basis/io/styles/styles-tests.factor
new file mode 100644 (file)
index 0000000..86c3681
--- /dev/null
@@ -0,0 +1,8 @@
+IN: io.styles.tests
+USING: io.styles tools.test ;
+
+\ stream-format must-infer
+\ stream-write-table must-infer
+\ make-span-stream must-infer
+\ make-block-stream must-infer
+\ make-cell-stream must-infer
\ No newline at end of file
index 7b2a6d2d839dadd1d52c17e932f23528e489f601..4d7295042c09c3a57624b0df80936bd9e1205b64 100644 (file)
@@ -416,12 +416,7 @@ DEFER: bar
 \ stream-write must-infer
 \ stream-write1 must-infer
 \ stream-nl must-infer
-\ stream-format must-infer
-\ stream-write-table must-infer
 \ stream-flush must-infer
-\ make-span-stream must-infer
-\ make-block-stream must-infer
-\ make-cell-stream must-infer
 
 ! Test stream utilities
 \ lines must-infer
index 078785178bc34eb493198b51cfde6979848480a7..810e9051d8637b3a2543fcbab03f6db70148cf60 100644 (file)
@@ -108,7 +108,7 @@ unit-test
             ] times
             .
         ] times
-    ] with-null-stream
+    ] with-null-writer
 ] unit-test
 
 [ t ] [