tests: new base_var.nit
authorJean Privat <jean@pryen.org>
Thu, 18 Jun 2009 01:47:42 +0000 (21:47 -0400)
committerJean Privat <jean@pryen.org>
Wed, 24 Jun 2009 19:47:33 +0000 (15:47 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

tests/base_var.nit [new file with mode: 0644]
tests/sav/base_var.sav [new file with mode: 0644]
tests/sav/base_var_alt1.sav [new file with mode: 0644]
tests/sav/base_var_alt2.sav [new file with mode: 0644]
tests/sav/base_var_alt3.sav [new file with mode: 0644]
tests/sav/base_var_alt4.sav [new file with mode: 0644]
tests/sav/base_var_alt5.sav [new file with mode: 0644]
tests/sav/base_var_alt6.sav [new file with mode: 0644]
tests/sav/base_var_alt7.sav [new file with mode: 0644]
tests/sav/base_var_alt8.sav [new file with mode: 0644]

diff --git a/tests/base_var.nit b/tests/base_var.nit
new file mode 100644 (file)
index 0000000..ed93ee2
--- /dev/null
@@ -0,0 +1,54 @@
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2009 Jean Privat <jean@pryen.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 kernel
+
+meth foo: Int do return 1
+meth bar do end
+
+var a1: Int
+var b1: Float
+a1 = 5
+b1 = 5.5
+#alt1#a1 = b1
+#alt2#b1 = a1
+a1.output
+b1.output
+
+var a2: Int = 1
+var b2: Float = 1.0
+a2 = 5
+b2 = 5.5
+#alt3#a2 = b2
+#alt4#b2 = a2
+a2.output
+b2.output
+
+var a3 = 1
+var b3 = 1.0
+a3 = 5
+b3 = 5.5
+#alt5#a3 = b3
+#alt6#b3 = a3
+a3.output
+b3.output
+
+var a4: Int = foo
+a4.output
+var a5 = foo
+a5.output
+#alt7#var a4: Int = bar
+#alt8#var a5 = bar
diff --git a/tests/sav/base_var.sav b/tests/sav/base_var.sav
new file mode 100644 (file)
index 0000000..d7e764f
--- /dev/null
@@ -0,0 +1,8 @@
+5
+5.500000
+5
+5.500000
+5
+5.500000
+1
+1
diff --git a/tests/sav/base_var_alt1.sav b/tests/sav/base_var_alt1.sav
new file mode 100644 (file)
index 0000000..92da362
--- /dev/null
@@ -0,0 +1 @@
+alt/base_var_alt1.nit:26,6--7: Type error: expected Int, got Float
diff --git a/tests/sav/base_var_alt2.sav b/tests/sav/base_var_alt2.sav
new file mode 100644 (file)
index 0000000..37c7307
--- /dev/null
@@ -0,0 +1 @@
+alt/base_var_alt2.nit:27,6--7: Type error: expected Float, got Int
diff --git a/tests/sav/base_var_alt3.sav b/tests/sav/base_var_alt3.sav
new file mode 100644 (file)
index 0000000..31e92a5
--- /dev/null
@@ -0,0 +1 @@
+alt/base_var_alt3.nit:35,6--7: Type error: expected Int, got Float
diff --git a/tests/sav/base_var_alt4.sav b/tests/sav/base_var_alt4.sav
new file mode 100644 (file)
index 0000000..7b8241d
--- /dev/null
@@ -0,0 +1 @@
+alt/base_var_alt4.nit:36,6--7: Type error: expected Float, got Int
diff --git a/tests/sav/base_var_alt5.sav b/tests/sav/base_var_alt5.sav
new file mode 100644 (file)
index 0000000..b0547c3
--- /dev/null
@@ -0,0 +1 @@
+alt/base_var_alt5.nit:44,6--7: Type error: expected Int, got Float
diff --git a/tests/sav/base_var_alt6.sav b/tests/sav/base_var_alt6.sav
new file mode 100644 (file)
index 0000000..dd946bd
--- /dev/null
@@ -0,0 +1 @@
+alt/base_var_alt6.nit:45,6--7: Type error: expected Float, got Int
diff --git a/tests/sav/base_var_alt7.sav b/tests/sav/base_var_alt7.sav
new file mode 100644 (file)
index 0000000..6a6758e
--- /dev/null
@@ -0,0 +1 @@
+alt/base_var_alt7.nit:53,15--17: Type error: expected expression.
diff --git a/tests/sav/base_var_alt8.sav b/tests/sav/base_var_alt8.sav
new file mode 100644 (file)
index 0000000..ab09b51
--- /dev/null
@@ -0,0 +1 @@
+alt/base_var_alt8.nit:54,10--12: Type error: expected expression.