tests: nullable and array
authorJean Privat <jean@pryen.org>
Mon, 15 Jun 2009 09:13:23 +0000 (05:13 -0400)
committerJean Privat <jean@pryen.org>
Wed, 24 Jun 2009 20:01:53 +0000 (16:01 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

tests/base_array_nullable.nit [new file with mode: 0644]
tests/sav/base_array_nullable.sav [new file with mode: 0644]
tests/sav/base_array_nullable_alt1.sav [new file with mode: 0644]

diff --git a/tests/base_array_nullable.nit b/tests/base_array_nullable.nit
new file mode 100644 (file)
index 0000000..d79fc57
--- /dev/null
@@ -0,0 +1,24 @@
+# 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 array
+
+var a: Array[nullable Int] = [1, 2, 3, null, 5]#!alt1#
+#alt1#var a = [1, 2, 3, null, 5]
+
+for i in a do
+       if i != null then i.output else '\n'.output
+end
diff --git a/tests/sav/base_array_nullable.sav b/tests/sav/base_array_nullable.sav
new file mode 100644 (file)
index 0000000..8045984
--- /dev/null
@@ -0,0 +1,5 @@
+1
+2
+3
+
+5
diff --git a/tests/sav/base_array_nullable_alt1.sav b/tests/sav/base_array_nullable_alt1.sav
new file mode 100644 (file)
index 0000000..8045984
--- /dev/null
@@ -0,0 +1,5 @@
+1
+2
+3
+
+5