tests: Added read_all test
authorLucas Bajolet <r4pass@hotmail.com>
Tue, 11 Aug 2015 13:48:37 +0000 (09:48 -0400)
committerLucas Bajolet <r4pass@hotmail.com>
Fri, 14 Aug 2015 17:34:43 +0000 (13:34 -0400)
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

tests/UTF-8-test.txt [new file with mode: 0644]
tests/sav/test_read_all.res [new file with mode: 0644]
tests/sav/test_read_all_args1.res [new file with mode: 0644]
tests/test_read_all.args [new file with mode: 0644]
tests/test_read_all.nit [new file with mode: 0644]

diff --git a/tests/UTF-8-test.txt b/tests/UTF-8-test.txt
new file mode 100644 (file)
index 0000000..abd16f7
Binary files /dev/null and b/tests/UTF-8-test.txt differ
diff --git a/tests/sav/test_read_all.res b/tests/sav/test_read_all.res
new file mode 100644 (file)
index 0000000..2f4cc2a
--- /dev/null
@@ -0,0 +1 @@
+usage ./test_read_all file
diff --git a/tests/sav/test_read_all_args1.res b/tests/sav/test_read_all_args1.res
new file mode 100644 (file)
index 0000000..6228c6e
Binary files /dev/null and b/tests/sav/test_read_all_args1.res differ
diff --git a/tests/test_read_all.args b/tests/test_read_all.args
new file mode 100644 (file)
index 0000000..e497886
--- /dev/null
@@ -0,0 +1 @@
+UTF-8-test.txt
diff --git a/tests/test_read_all.nit b/tests/test_read_all.nit
new file mode 100644 (file)
index 0000000..4f2d7e0
--- /dev/null
@@ -0,0 +1,26 @@
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# 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.
+
+if args.is_empty then
+       print "usage ./test_read_all file"
+       exit -1
+end
+
+var file = new FileReader.open(args[0])
+
+var s = file.read_all
+
+for i in s do
+       printn i
+end