First NIT release and new clean mercurial repository
[nit.git] / tests / test_file_read.sav
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Copyright 2004-2008 Jean Privat <jean@pryen.org>
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #     http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17 var f = new IFStream.open("test_file_read.nit")
18 var s: String
19 while not f.eof do
20     s = f.read_line
21     printn(s)
22     printn("\n")
23 end
24 f.close
25
26 f.reopen
27 printn(f.read(10))
28 printn("|")
29 printn(f.read_all)
30
31 # This fil|e is part of NIT ( http://www.nitlanguage.org ).
32 #
33 # Copyright 2004-2008 Jean Privat <jean@pryen.org>
34 #
35 # Licensed under the Apache License, Version 2.0 (the "License");
36 # you may not use this file except in compliance with the License.
37 # You may obtain a copy of the License at
38 #
39 #     http://www.apache.org/licenses/LICENSE-2.0
40 #
41 # Unless required by applicable law or agreed to in writing, software
42 # distributed under the License is distributed on an "AS IS" BASIS,
43 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
44 # See the License for the specific language governing permissions and
45 # limitations under the License.
46
47 var f = new IFStream.open("test_file_read.nit")
48 var s: String
49 while not f.eof do
50     s = f.read_line
51     printn(s)
52     printn("\n")
53 end
54 f.close
55
56 f.reopen
57 printn(f.read(10))
58 printn("|")
59 printn(f.read_all)