tests: update FFI tests to latest spec
authorAlexis Laferrière <alexis.laf@xymus.net>
Wed, 27 Nov 2013 15:10:39 +0000 (10:10 -0500)
committerJean Privat <jean@pryen.org>
Mon, 17 Feb 2014 18:56:35 +0000 (13:56 -0500)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

tests/string_ffi_ref_test.nit
tests/test_ffi_c_accessor.nit
tests/test_ffi_c_callback_extern_receiver.nit
tests/test_ffi_c_callbacks.nit
tests/test_ffi_c_casts.nit
tests/test_ffi_c_global_ref.nit
tests/test_ffi_c_more.nit
tests/test_ffi_c_more_callbacks.nit
tests/test_ffi_c_operators.nit
tests/test_ffi_c_strings.nit
tests/test_ffi_c_super.nit

index 70977d8..2f8e168 100644 (file)
@@ -28,7 +28,7 @@ class StringTest
                referenced_str = null
        end
 
-       fun get_c_string import String::items, NativeString::to_s, NativeString::to_s_with_copy, StringTest::ref_test, StringTest::copy_test `{
+       fun get_c_string import String.items, NativeString.to_s, NativeString.to_s_with_copy, StringTest.ref_test, StringTest.copy_test `{
                char* string = "This is a test string";
 
                String ref_string = NativeString_to_s(string);
index dbe69c5..ad76c0a 100644 (file)
@@ -19,19 +19,19 @@ class A
        var w : String = "w"
        var rw : String = "rw"
 
-       fun print_all import String::to_cstring, r, rw `{
+       fun print_all import String.to_cstring, r, rw `{
                printf( "%s %s\n",
                        String_to_cstring( A_r( recv ) ),
                        String_to_cstring( A_rw( recv ) ) );
        `}
-       fun modify import NativeString::to_s, w=, rw= `{
+       fun modify import NativeString.to_s, w=, rw= `{
                A_w__assign( recv, NativeString_to_s( "w set from native" ) );
                A_rw__assign( recv, NativeString_to_s( "rw set from native" ) );
        `}
 end
 
 class B
-       fun print_and_modify( a : A ) import A::rw, A::rw=, String::to_cstring, NativeString::to_s `{
+       fun print_and_modify( a : A ) import A.rw, A.rw=, String.to_cstring, NativeString.to_s `{
                printf( "%s\n", String_to_cstring( A_rw( a ) ) );
                A_rw__assign( a, NativeString_to_s( "set from native" ) );
                printf( "%s\n", String_to_cstring( A_rw( a ) ) );
index 1e1e0c5..477dfc1 100644 (file)
@@ -29,7 +29,7 @@ extern Test
         return foobar;
     `}
 
-    fun test_me is extern import Test::foo, NativeString::to_s `{
+    fun test_me is extern import Test.foo, NativeString.to_s `{
         int i;
         for(i = 0; i < 2000; ++i) {
             printf("%d\n", i);
index b4b7cd5..fee35a5 100644 (file)
@@ -24,7 +24,7 @@ fun call_a_fun import foo `{
        Object_foo(recv);
 `}
 
-fun call_a_constructor import A, A::bar `{
+fun call_a_constructor import A, A.bar `{
        A a = new_A();
        A_bar(a);
 `}
index 5646cb0..1511348 100644 (file)
@@ -32,7 +32,7 @@ redef class Int
        redef fun foo do print self
 end
 
-fun callbacks_with_as_casts(a: A, b: B) import B::foo, A::foo, B as(A), A as(B) `{
+fun callbacks_with_as_casts(a: A, b: B) import B.foo, A.foo, B.as(A), A.as(B) `{
        A_foo(a);
        B_foo(b);
 
@@ -47,7 +47,7 @@ fun callbacks_with_as_casts(a: A, b: B) import B::foo, A::foo, B as(A), A as(B)
        B_foo(bb);
 `}
 
-fun callbacks_with_nullable_casts(a: A, b: nullable B) import B as not nullable, A as nullable, A as(nullable B), B::foo `{
+fun callbacks_with_nullable_casts(a: A, b: nullable B) import B as not nullable, A as nullable, A.as(nullable B), B.foo `{
        if (!nullable_B_is_a_B(b)) {
                printf("Instance b is not a B (it is null)\n");
        } else {
@@ -63,7 +63,7 @@ fun callbacks_with_nullable_casts(a: A, b: nullable B) import B as not nullable,
        }
 `}
 
-fun callbacks_with_failed_checks(a: A, b: nullable B) import B as not nullable, B as nullable, A as(B), B as (A) `{
+fun callbacks_with_failed_checks(a: A, b: nullable B) import B as not nullable, B as nullable, A.as(B), B.as(A) `{
        if (!A_is_a_B(a)) {
                printf("Instance of A is not a B.\n");
        }
@@ -72,7 +72,7 @@ fun callbacks_with_failed_checks(a: A, b: nullable B) import B as not nullable,
        }
 `}
 
-fun callbacks_with_primitives(o: Object, i: Int, ni: nullable Int) import Object as(Int), Int as(Object), nullable Int as(Int), Int::foo, Object::foo `{
+fun callbacks_with_primitives(o: Object, i: Int, ni: nullable Int) import Object.as(Int), Int.as(Object), nullable Int.as(Int), Int.foo, Object.foo `{
        Object_foo(o);
        Int_foo(i);
 
index daac6f2..9b90564 100644 (file)
@@ -27,7 +27,7 @@ class ToBePreserved
 end
 
 class A
-       fun save_as_global( tbp : ToBePreserved, i : Int ) import ToBePreserved::output `{
+       fun save_as_global( tbp : ToBePreserved, i : Int ) import ToBePreserved.output `{
                if ( global_tbps[i] != NULL )
                        ToBePreserved_decr_ref( global_tbps[i] );
 
index e795227..04d82a9 100644 (file)
@@ -38,11 +38,11 @@ extern A
 
        fun m : Int is extern `{ return 10; `}
 
-       fun n : String is extern import NativeString::to_s `{
+       fun n : String is extern import NativeString.to_s `{
                return NativeString_to_s( "allo" );
        `}
 
-       fun o ( str : String ) is extern import String::to_cstring `{
+       fun o ( str : String ) is extern import String.to_cstring `{
                f( String_to_cstring( str ) );
        `}
 
index 9a25f36..6be81fe 100644 (file)
@@ -31,7 +31,7 @@ end
 fun in1(i: Int) do print "Back in Nit: in1 {i}"
 fun in2(i: Float) do print "Back in Nit: in2"
 
-fun out(i: Int, f: Float): Int import in1, in2, A, A::alt, A::to_i `{
+fun out(i: Int, f: Float): Int import in1, in2, A, A.alt, A.to_i `{
        printf("From C, beginning out: %ld\n", i);
        Object_in1(recv, i);
        A a = new_A();
index 4c89e6a..3174cb7 100644 (file)
@@ -45,7 +45,7 @@ class A
                return new_A( s / by );
        `}
 
-       redef fun ==( other ) import value, nullable Object as(A) `{
+       redef fun ==( other ) import value, nullable Object.as(A) `{
                if ( nullable_Object_is_a_A( other ) &&
                         A_value( nullable_Object_as_A(other) ) == A_value( recv ) )
                        return 1;
index aad8b05..e4d3fe2 100644 (file)
@@ -22,11 +22,11 @@ fun get_cstring: NativeString `{
        return "char* from C";
 `}
 
-fun print_string(str: String) import String::to_cstring `{
+fun print_string(str: String) import String.to_cstring `{
        printf("str-> %s\n", String_to_cstring(str) );
 `}
 
-fun get_string: String import NativeString::to_s, String::output `{
+fun get_string: String import NativeString.to_s, String.output `{
        String str = NativeString_to_s("Nit string from C");
        String_output(str);
        printf("\n");
index 68c20f8..8b241ff 100644 (file)
@@ -21,7 +21,7 @@ end
 class B
        super A
 
-       redef fun id : String import super, NativeString::to_s, String::to_cstring `{
+       redef fun id : String import super, NativeString.to_s, String.to_cstring `{
                char *new_name;
                char *prefix = "B special ";
                char *super_name = String_to_cstring( B_id___super( recv ) );