tests: add base_range.nit
authorJean Privat <jean@pryen.org>
Fri, 20 Apr 2012 17:51:53 +0000 (13:51 -0400)
committerJean Privat <jean@pryen.org>
Fri, 20 Apr 2012 20:32:38 +0000 (16:32 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

tests/base_range.nit [new file with mode: 0644]
tests/sav/base_range.sav [new file with mode: 0644]
tests/sav/base_range_alt1.sav [new file with mode: 0644]
tests/sav/base_range_alt2.sav [new file with mode: 0644]

diff --git a/tests/base_range.nit b/tests/base_range.nit
new file mode 100644 (file)
index 0000000..4fd8567
--- /dev/null
@@ -0,0 +1,28 @@
+# 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.
+
+import range
+
+class A end
+
+var a = [0..2[
+for x in a do x.output
+'\n'.output
+
+var b = [0..2]
+for x in b do x.output
+
+#alt1#var c = [new A..new A[
+
+#alt2#var d = [0..'z'[
diff --git a/tests/sav/base_range.sav b/tests/sav/base_range.sav
new file mode 100644 (file)
index 0000000..a9c3968
--- /dev/null
@@ -0,0 +1,6 @@
+0
+1
+
+0
+1
+2
diff --git a/tests/sav/base_range_alt1.sav b/tests/sav/base_range_alt1.sav
new file mode 100644 (file)
index 0000000..43eeb74
--- /dev/null
@@ -0,0 +1 @@
+alt/base_range_alt1.nit:26,10--14: Type error: expected Discrete, got A
diff --git a/tests/sav/base_range_alt2.sav b/tests/sav/base_range_alt2.sav
new file mode 100644 (file)
index 0000000..4ff5df6
--- /dev/null
@@ -0,0 +1 @@
+alt/base_range_alt2.nit:28,9--16: Type error: Int incompatible with Char.