From: Jean Privat Date: Mon, 15 Jun 2009 09:13:23 +0000 (-0400) Subject: tests: nullable and array X-Git-Tag: v0.3~225 X-Git-Url: http://nitlanguage.org tests: nullable and array Signed-off-by: Jean Privat --- diff --git a/tests/base_array_nullable.nit b/tests/base_array_nullable.nit new file mode 100644 index 0000000..d79fc57 --- /dev/null +++ b/tests/base_array_nullable.nit @@ -0,0 +1,24 @@ +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2009 Jean Privat +# +# 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 index 0000000..8045984 --- /dev/null +++ b/tests/sav/base_array_nullable.sav @@ -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 index 0000000..8045984 --- /dev/null +++ b/tests/sav/base_array_nullable_alt1.sav @@ -0,0 +1,5 @@ +1 +2 +3 + +5