tests: prepare for new constructors
authorJean Privat <jean@pryen.org>
Fri, 15 Aug 2014 10:46:28 +0000 (06:46 -0400)
committerJean Privat <jean@pryen.org>
Fri, 15 Aug 2014 10:46:28 +0000 (06:46 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

18 files changed:
tests/base_attr.nit
tests/base_attr_gen.nit
tests/base_attr_isset.nit
tests/base_attr_nullable.nit
tests/base_attr_nullable_int.nit
tests/base_prot_sig.nit
tests/base_prot_sig2.nit
tests/base_simple.nit
tests/base_virtual_type3.nit
tests/base_virtual_type_self.nit
tests/bench_netsim.nit
tests/bench_random_n_sort.nit
tests/example_objet.nit
tests/rterror_attr_def.nit
tests/string_ffi_ref_test.nit
tests/test_create.nit
tests/test_gtk.nit
tests/test_operator_brackets.nit

index 4daed95..a21188b 100644 (file)
@@ -24,8 +24,8 @@ class Int
 end
 
 class Foo
-       var a1: Int
-       var a2: Int
+       var a1: Int is noinit
+       var a2: Int is noinit
        fun run
        do
                _a1.output
@@ -41,7 +41,7 @@ end
 
 class Bar
        super Foo
-       var a3: Int
+       var a3: Int is noinit
        redef fun run
        do
                _a1.output
index 8a8a346..ad4c947 100644 (file)
@@ -17,9 +17,9 @@
 import kernel
 
 class A[E]
-       var e: E
-       init do end
+       var e: E is noinit
 end
+
 var i = 1
 var a = new A[nullable Int]#alt1#
 #alt1#var a = new A[Int]
index 5fc7e11..c1a1fea 100644 (file)
@@ -30,13 +30,13 @@ end
 
 class Integer
        var val: Int
-       init(val: Int) do _val = val
+
        fun output do _val.output
 end
 
 class Foo
-       var a1: Integer
-       var a2: Integer
+       var a1: Integer is noinit
+       var a2: Integer is noinit
        fun run
        do
                _a1.output
@@ -64,9 +64,9 @@ end
 
 class Bar
        super Foo
-       var a3: Integer#alt1# #alt2#
+       var a3: Integer is noinit#alt1# #alt2#
        #alt1#var a3: Integer = new Integer(9000)
-       #alt2#var a3: nullable Integer
+       #alt2#var a3: nullable Integer is noinit
        redef fun run
        do
                _a1.output
@@ -82,7 +82,7 @@ class Bar
 
        init
        do
-               nop
+               if false then super # no auto super init call
                show(4)
                _a1 = new Integer(10)
                show(5)
index 1d0ddab..ae29324 100644 (file)
@@ -18,7 +18,7 @@ import end
 
 interface Object
 end
-
+enum Bool end
 enum Int
        fun output is intern
        fun +(o: Int): Int is intern
@@ -31,8 +31,8 @@ class Integer
 end
 
 class Foo
-       var a1: Integer
-       var a2: Integer
+       var a1: Integer is noinit
+       var a2: Integer is noinit
        fun run
        do
                _a1.output
@@ -58,7 +58,7 @@ end
 
 class Bar
        super Foo
-       var a3: Integer
+       var a3: Integer is noinit
        redef fun run
        do
                _a1.output
@@ -68,7 +68,7 @@ class Bar
 
        init
        do
-               nop
+               if false then super # no auto super init call
                #alt3#run
                _a1 = new Integer(10)
                #alt4#run_other(self)
index 3276d2c..03c7d88 100644 (file)
@@ -18,15 +18,15 @@ import end
 
 interface Object
 end
-
+enum Bool end
 enum Int
        fun output is intern
        fun +(o: Int): Int is intern
 end
 
 class Foo
-       var a1: Int
-       var a2: Int
+       var a1: Int is noinit
+       var a2: Int is noinit
        fun run
        do
                _a1.output
@@ -52,7 +52,7 @@ end
 
 class Bar
        super Foo
-       var a3: Int
+       var a3: Int is noinit
        redef fun run
        do
                _a1.output
@@ -62,7 +62,7 @@ class Bar
 
        init
        do
-               nop
+               if false then super # no auto super init call
                #alt3#run
                _a1 = 10
                #alt4#run_other(self)
index f78b9b5..22d361e 100644 (file)
@@ -18,9 +18,9 @@ class A
        protected fun proA(a: A) do end
        private fun priA(a: A) do end
 
-       var vpubA: nullable A is writable
-       protected var vproA: nullable A is protected writable
-       private var vpriA: nullable A
+       var vpubA: nullable A is writable, noinit
+       protected var vproA: nullable A is protected writable, noinit
+       private var vpriA: nullable A is noinit
 
        var vpubA2 = new A is writable
        protected var vproA2 = new A is protected writable
@@ -30,15 +30,15 @@ class A
        #alt2#protected fun proB(a: B) do end
        private fun priB(a: B) do end
 
-       #alt3#var vpubB: nullable B is writable
-       #alt4#protected var vproB: nullable B is protected writable
-       private var vpriB: nullable B
+       #alt3#var vpubB: nullable B is writable, noinit
+       #alt4#protected var vproB: nullable B is protected writable, noinit
+       private var vpriB: nullable B is noinit
 
        #alt5#var vpubB2 = new B is writable
        #alt6#protected var vproB2 = new B is protected writable
        private var vpriB2 = new B
 
-       init do end
+
 end
 
 private class B
@@ -46,9 +46,9 @@ private class B
        #alt7#protected fun proA(a: A) do end
        private fun priA(a: A) do end
 
-       var vpubA: nullable A is writable
-       #alt7#protected var vproA: nullable A is protected writable
-       private var vpriA: nullable A
+       var vpubA: nullable A is writable, noinit
+       #alt7#protected var vproA: nullable A is protected writable, noinit
+       private var vpriA: nullable A is noinit
 
        var vpubA2 = new A is writable
        #alt7#protected var vproA2 = new A is protected writable
@@ -58,13 +58,13 @@ private class B
        #alt7#protected fun proB(a: B) do end
        private fun priB(a: B) do end
 
-       var vpubB: nullable B is writable
-       #alt7#protected var vproB: nullable B is protected writable
-       private var vpriB: nullable B
+       var vpubB: nullable B is writable, noinit
+       #alt7#protected var vproB: nullable B is protected writable, noinit
+       private var vpriB: nullable B is noinit
 
        var vpubB2 = new B is writable
        #alt7#protected var vproB2 = new B is protected writable
        private var vpriB2 = new B
 
-       init do end
+
 end
index 89fff9e..23f8e73 100644 (file)
@@ -20,9 +20,9 @@ class C
        #alt2#protected fun proA(a: A) do end
        private fun priA(a: A) do end
 
-       #alt3#var vpubA: nullable A is writable
-       #alt4#protected var vproA: nullable A is protected writable
-       private var vpriA: nullable A
+       #alt3#var vpubA: nullable A is writable, noinit
+       #alt4#protected var vproA: nullable A is protected writable, noinit
+       private var vpriA: nullable A is noinit
 
        #alt5#var vpubA2 = new A is writable
        #alt6#protected var vproA2 = new A is protected writable
@@ -35,8 +35,8 @@ private class D
        fun pubA(a: A) do end
        private fun priA(a: A) do end
 
-       var vpubA: nullable A is writable
-       private var vpriA: nullable A
+       var vpubA: nullable A is writable, noinit
+       private var vpriA: nullable A is noinit
 
        var vpubA2 = new A is writable
        private var vpriA2 = new A
index a8a645f..76d0dd9 100644 (file)
@@ -33,10 +33,6 @@ class A
        do
                0.output
        end
-
-       init
-       do
-       end
 end
 
 class B
index 545092f..b05b4e8 100644 (file)
@@ -19,10 +19,10 @@ import base_virtual_type2
 
 class C
        super A
-       var tab: nullable Array[E] is writable
-       init do end
+       var tab: nullable Array[E] = null is writable
 end
 
+
 var c = new C
 c.tab = new Array[T]
 c.tab.add(new U)
index e599f1b..cf1dbd9 100644 (file)
@@ -18,13 +18,13 @@ import kernel
 
 class A[E]
        type T: E
-       var t: T
+       var t: T is noinit
        fun foo(t: T) do end
        fun foo2: T do return _t
        fun bar(t: A[T]) do end
        fun bar2: A[T] do return self
 
-       init do end
+
 end
 
 class B
index accbb45..f784635 100644 (file)
@@ -31,8 +31,7 @@ class WakeUpNode
        do
                _scheduler.add_event(self, d)
        end
-       var scheduler: Scheduler
-       init do end
+       var scheduler: Scheduler is noinit
 end
 
 class NodeSource
index 513e78e..1e1c5bd 100644 (file)
@@ -32,12 +32,7 @@ redef class Int
 end
 
 class Integer
-       var value: Int
-
-       init
-       do
-               value = 42
-       end
+       var value: Int = 42
 end
 
 var n = 100
index f5aaf0d..891a3d9 100644 (file)
@@ -208,8 +208,8 @@ end
 
 class Rayon
 private
-       var stock: Array[Produit]               # Des produits en stock
-       var rubrique: String                    # La catégorie des produits stockés
+       var stock: Array[Produit] is noinit             # Des produits en stock
+       var rubrique: String is noinit                  # La catégorie des produits stockés
 
        # Cette fonction est utilisé par to_s pour afficher un petit titre
        fun to_s_head: String
@@ -300,8 +300,6 @@ private
        # pour obtenir la quantité de clous dans le rayon, et :
        #       r.quantite("clous") = 15
        # pour mettre le nombre de clous à 15
-
-       init do end
 end
 
 class RayonNormal
index 744ff2b..99093f7 100644 (file)
@@ -21,7 +21,7 @@ end
 
 class A
        var o: Object = 'c'
-       var a: I
+       var a: I is noinit
        var b: nullable I = null
        #alt2#var c: I = self.a
        #alt3#var d: I = self.b.as(not null)
index 040226a..427d28c 100644 (file)
@@ -21,15 +21,9 @@ import file
 
 class StringTest
 
-       var copied_str: nullable String
+       var copied_str: nullable String = null
 
-       var referenced_str: nullable String
-
-       init
-       do
-               copied_str = null
-               referenced_str = null
-       end
+       var referenced_str: nullable String = null
 
        fun get_c_string import FlatString.items, NativeString.to_s, NativeString.to_s_with_copy, StringTest.ref_test, StringTest.copy_test `{
                char* string = "This is a test string";
index cb33878..c41c81a 100644 (file)
@@ -47,7 +47,7 @@ class Toto
 end
 
 class Test
-       var t: Toto
+       var t: Toto is noinit
 
        init
        do
index 290d4ef..510b5fb 100644 (file)
@@ -19,13 +19,13 @@ import gtk
 class MyApp
        super GtkCallable
 
-       var win : GtkWindow
+       var win : GtkWindow is noinit
 
-       var container : GtkContainer
+       var container : GtkContainer is noinit
 
-       var lbl : GtkLabel
-       var but_ok : GtkButton
-       var but_cancel : GtkButton
+       var lbl : GtkLabel is noinit
+       var but_ok : GtkButton is noinit
+       var but_cancel : GtkButton is noinit
 
        redef fun signal( sender, user_data )
        do
index d88deb2..e00f4d2 100644 (file)
@@ -48,15 +48,7 @@ class Matrice
                row[y] = v
        end
 
-private
-       var tab: Array[Array[Int]] # An array of array to store items
-
-
-       init
-       # Build an empty matrice
-       do
-               _tab = new Array[Array[Int]]
-       end
+       private var tab = new Array[Array[Int]] # An array of array to store items
 end