tests: add base_label_while2.nit for anonymous labels
authorJean Privat <jean@pryen.org>
Mon, 14 Jul 2014 15:09:06 +0000 (11:09 -0400)
committerJean Privat <jean@pryen.org>
Wed, 16 Jul 2014 20:57:39 +0000 (16:57 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

tests/base_label_while2.nit [new file with mode: 0644]
tests/sav/base_label_while2.res [new file with mode: 0644]
tests/sav/base_label_while2_alt4.res [new file with mode: 0644]
tests/sav/base_label_while2_alt5.res [new file with mode: 0644]
tests/sav/base_label_while2_alt6.res [new file with mode: 0644]
tests/sav/base_label_while2_alt7.res [new file with mode: 0644]

diff --git a/tests/base_label_while2.nit b/tests/base_label_while2.nit
new file mode 100644 (file)
index 0000000..3beca77
--- /dev/null
@@ -0,0 +1,38 @@
+# 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
+
+fun maybe: Bool do return true
+
+var a = 1
+1.output
+while a == 1 do
+       a = 2
+       2.output
+       while a == 2 do
+               a = 3
+               3.output
+               if maybe then
+               #alt4#break
+               #alt5#continue label
+               end
+               if maybe then break label
+               4.output
+       end label l2#alt6#end label
+       5.output
+end label#alt7#end label l1
+6.output
diff --git a/tests/sav/base_label_while2.res b/tests/sav/base_label_while2.res
new file mode 100644 (file)
index 0000000..c65db77
--- /dev/null
@@ -0,0 +1,4 @@
+1
+2
+3
+6
diff --git a/tests/sav/base_label_while2_alt4.res b/tests/sav/base_label_while2_alt4.res
new file mode 100644 (file)
index 0000000..150a5fb
--- /dev/null
@@ -0,0 +1,5 @@
+1
+2
+3
+5
+6
diff --git a/tests/sav/base_label_while2_alt5.res b/tests/sav/base_label_while2_alt5.res
new file mode 100644 (file)
index 0000000..c65db77
--- /dev/null
@@ -0,0 +1,4 @@
+1
+2
+3
+6
diff --git a/tests/sav/base_label_while2_alt6.res b/tests/sav/base_label_while2_alt6.res
new file mode 100644 (file)
index 0000000..48cf58d
--- /dev/null
@@ -0,0 +1 @@
+alt/base_label_while2_alt6.nit:35,6--10: Syntax error: anonymous label already defined.
diff --git a/tests/sav/base_label_while2_alt7.res b/tests/sav/base_label_while2_alt7.res
new file mode 100644 (file)
index 0000000..eb284b5
--- /dev/null
@@ -0,0 +1 @@
+alt/base_label_while2_alt7.nit:33,23--27: Syntax error: invalid anonymous label.