Merge: doc: fixed some typos and other misc. corrections
[nit.git] / tests / base_iterator3.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 class Test1
16 fun iterator: nullable Iterator[String] do return null
17 end
18
19 class Test2
20 fun iterator do end
21 end
22
23 class Test3
24 end
25
26 class Test4
27 fun iterator: TestIterator do return new TestIterator
28 end
29
30 class TestIterator
31 end
32
33 # wrong return type
34 var test1 = new Test1
35 for v in test1 do print v
36
37 # wrong return type
38 var test2 = new Test2
39 for v in test2 do print v
40
41 # no method iterator
42 var test3 = new Test3
43 for v in test3 do print v
44
45 # wrong numbe of variables
46 for k, v in new Array[String] do print "{k}:{v}"
47 for v in new HashMap[String, String] do print v