summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElichai Turkel <elichai.turkel@gmail.com>2019-05-22 11:27:56 +0300
committerEmilio Cobos Álvarez <emilio@crisal.io>2019-05-22 13:45:59 +0200
commitfe9bea0f1bedd73c9bcc4d5cf625660e313997ab (patch)
treec5a1a48ed6f1dc19b773c6f9cde33365419fda08
parentfc762a5a5c4123602fe868b1836f09393dac1abc (diff)
Added tests with typedef for array pointers
-rw-r--r--tests/expectations/tests/with_array_pointers_arguments.rs17
-rw-r--r--tests/expectations/tests/without_array_pointers_arguments.rs17
-rw-r--r--tests/headers/with_array_pointers_arguments.h7
-rw-r--r--tests/headers/without_array_pointers_arguments.h7
4 files changed, 28 insertions, 20 deletions
diff --git a/tests/expectations/tests/with_array_pointers_arguments.rs b/tests/expectations/tests/with_array_pointers_arguments.rs
index eb3300e2..3808e18b 100644
--- a/tests/expectations/tests/with_array_pointers_arguments.rs
+++ b/tests/expectations/tests/with_array_pointers_arguments.rs
@@ -8,14 +8,13 @@
)]
extern "C" {
- pub fn test_fn(
- a: f32,
- arr: *mut [::std::os::raw::c_int; 20usize],
- ) -> ::std::os::raw::c_int;
+ pub fn test_fn(a: f32, arr: *mut [::std::os::raw::c_int; 20usize]) -> ::std::os::raw::c_int;
}
extern "C" {
- pub fn test_fn2(
- arr: *const [f32; 20usize],
- b: ::std::os::raw::c_int,
- ) -> ::std::os::raw::c_int;
-} \ No newline at end of file
+ pub fn test_fn2(arr: *const [f32; 20usize], b: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
+}
+pub type defArr = [::std::os::raw::c_char; 20usize];
+pub type foo = ::std::option::Option<unsafe extern "C" fn(a: *mut defArr)>;
+extern "C" {
+ pub fn bar(a: *mut defArr);
+}
diff --git a/tests/expectations/tests/without_array_pointers_arguments.rs b/tests/expectations/tests/without_array_pointers_arguments.rs
index a8d9990a..b6168937 100644
--- a/tests/expectations/tests/without_array_pointers_arguments.rs
+++ b/tests/expectations/tests/without_array_pointers_arguments.rs
@@ -8,14 +8,13 @@
)]
extern "C" {
- pub fn test_fn(
- a: f32,
- arr: *mut ::std::os::raw::c_int,
- ) -> ::std::os::raw::c_int;
+ pub fn test_fn(a: f32, arr: *mut ::std::os::raw::c_int) -> ::std::os::raw::c_int;
}
extern "C" {
- pub fn test_fn2(
- arr: *const f32,
- b: ::std::os::raw::c_int,
- ) -> ::std::os::raw::c_int;
-} \ No newline at end of file
+ pub fn test_fn2(arr: *const f32, b: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
+}
+pub type defArr = [::std::os::raw::c_char; 20usize];
+pub type foo = ::std::option::Option<unsafe extern "C" fn(a: *mut ::std::os::raw::c_char)>;
+extern "C" {
+ pub fn bar(a: *mut ::std::os::raw::c_char);
+}
diff --git a/tests/headers/with_array_pointers_arguments.h b/tests/headers/with_array_pointers_arguments.h
index 34f669d0..565b3cf6 100644
--- a/tests/headers/with_array_pointers_arguments.h
+++ b/tests/headers/with_array_pointers_arguments.h
@@ -2,4 +2,9 @@
int test_fn(float a, int arr[20]);
-int test_fn2(const float arr[20], int b); \ No newline at end of file
+int test_fn2(const float arr[20], int b);
+
+typedef char defArr[20];
+typedef void foo(defArr a);
+
+void bar(defArr a); \ No newline at end of file
diff --git a/tests/headers/without_array_pointers_arguments.h b/tests/headers/without_array_pointers_arguments.h
index 9028c43d..2f066874 100644
--- a/tests/headers/without_array_pointers_arguments.h
+++ b/tests/headers/without_array_pointers_arguments.h
@@ -1,4 +1,9 @@
int test_fn(float a, int arr[20]);
-int test_fn2(const float arr[20], int b); \ No newline at end of file
+int test_fn2(const float arr[20], int b);
+
+typedef char defArr[20];
+typedef void foo(defArr a);
+
+void bar(defArr a); \ No newline at end of file