syntax: 'meth' -> 'fun', 'attr' -> 'var'
[nit.git] / tests / test_star.nit
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 fun foo(a: Int...)
18 do
19 print(a)
20 end
21
22 fun bar(b: Int, a: Int...)
23 do
24 print("{b}, {a}")
25 end
26
27 fun baz(a: Int..., b: Int)
28 do
29 print("{a}, {b}")
30 end
31
32 fun foobar(b: Int, a: Int..., c: Int)
33 do
34 print("{c}, {a}, {b}")
35 end
36
37 foo(1)
38 foo(1,2)
39 bar(1,2)
40 bar(1,2,3)
41 baz(1,2)
42 baz(1,2,3)
43 foobar(1,2,3)
44 foobar(1,2,3,4)