tests: add test for filter_stream
authorJean-Sebastien Gelinas <calestar@gmail.com>
Tue, 30 Jun 2009 13:27:48 +0000 (09:27 -0400)
committerJean Privat <jean@pryen.org>
Sat, 4 Jul 2009 00:56:01 +0000 (20:56 -0400)
Signed-off-by: Jean-Sebastien Gelinas <calestar@gmail.com>
Signed-off-by: Jean Privat <jean@pryen.org>

tests/sav/test_filterstream.sav [new file with mode: 0644]
tests/test_filterstream.nit [new file with mode: 0644]

diff --git a/tests/sav/test_filterstream.sav b/tests/sav/test_filterstream.sav
new file mode 100644 (file)
index 0000000..743492c
--- /dev/null
@@ -0,0 +1,5 @@
+Hello World !!
+
+Hello World !!
+
+
diff --git a/tests/test_filterstream.nit b/tests/test_filterstream.nit
new file mode 100644 (file)
index 0000000..9faecb8
--- /dev/null
@@ -0,0 +1,40 @@
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2009 Jean-Sebastien Gelinas <calestar@gmail.com>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+import filter_stream
+
+var filename_1 = "test_filterstream_tmp1.write"
+var filename_2 = "test_filterstream_tmp2.write"
+
+var output_file_1 = new OFStream.open(filename_1)
+var output_file_2 = new OFStream.open(filename_2)
+
+var stream_demux = new StreamDemux(output_file_1, output_file_2)
+
+stream_demux.write("Hello World !!\n")
+stream_demux.close
+
+var input_file_1 = new IFStream.open(filename_1)
+var input_file_2 = new IFStream.open(filename_2)
+
+var stream_cat = new StreamCat(input_file_1,input_file_2)
+
+while not stream_cat.eof do
+       print stream_cat.read_line
+end
+
+stream_cat.close