]> gitweb.factorcode.org Git - factor.git/commitdiff
Add with-error>output word and test
authorDoug Coleman <doug.coleman@gmail.com>
Wed, 19 Oct 2011 07:56:11 +0000 (00:56 -0700)
committerDoug Coleman <doug.coleman@gmail.com>
Wed, 19 Oct 2011 07:56:11 +0000 (00:56 -0700)
core/io/io-tests.factor
core/io/io.factor

index 237c0f617c91ae8819cb272e91d1a03fdb2049cd..520d700ce1e8404582ebd827da0b358588f55b46 100644 (file)
@@ -1,5 +1,5 @@
 USING: accessors io io.streams.string kernel math parser sbufs
-sequences tools.test words ;
+sequences tools.test words namespaces ;
 IN: io.tests
 
 { f } [
@@ -78,3 +78,19 @@ M: dumb-writer stream-write1 vector>> push ; inline
 
 { SBUF" asdf" }
 [ "asdf" <string-reader> 4 <sbuf> [ stream-copy ] keep ] unit-test
+
+[ "asdf" ]
+[
+    [
+        [ "asdf" error-stream get stream-write ] with-error>output
+    ] with-string-writer
+] unit-test
+
+[ "asdf" ]
+[
+    <string-writer> [
+        [
+            [ "asdf" output-stream get stream-write ] with-output>error
+        ] with-error-stream
+    ] keep >string
+] unit-test
\ No newline at end of file
index 110f0f5943c5b0a2742405a76017757c8086bc5b..8e744936472cbf4993fd01d89ce8e35e20d6eb19 100644 (file)
@@ -77,6 +77,9 @@ SYMBOL: error-stream
 : with-output>error ( quot -- )
     error-stream get swap with-output-stream* ; inline
 
+: with-error>output ( quot -- )
+    output-stream get swap with-error-stream* ; inline
+
 : with-streams* ( input output quot -- )
     swapd [ with-output-stream* ] curry with-input-stream* ; inline