From 8a7fbbe1ff21b80afe2ab014e3425b35cca7bbed Mon Sep 17 00:00:00 2001 From: Adrian Wong Date: Mon, 2 Dec 2019 10:53:49 +1100 Subject: [PATCH] Add test for char to char32_t mapping --- tests/expectations/both/char.c | 11 +++++++++++ tests/expectations/both/char.compat.c | 19 +++++++++++++++++++ tests/expectations/char.c | 11 +++++++++++ tests/expectations/char.compat.c | 19 +++++++++++++++++++ tests/expectations/char.cpp | 14 ++++++++++++++ tests/expectations/tag/char.c | 11 +++++++++++ tests/expectations/tag/char.compat.c | 19 +++++++++++++++++++ tests/rust/char.rs | 7 +++++++ 8 files changed, 111 insertions(+) create mode 100644 tests/expectations/both/char.c create mode 100644 tests/expectations/both/char.compat.c create mode 100644 tests/expectations/char.c create mode 100644 tests/expectations/char.compat.c create mode 100644 tests/expectations/char.cpp create mode 100644 tests/expectations/tag/char.c create mode 100644 tests/expectations/tag/char.compat.c create mode 100644 tests/rust/char.rs diff --git a/tests/expectations/both/char.c b/tests/expectations/both/char.c new file mode 100644 index 0000000..3edcc69 --- /dev/null +++ b/tests/expectations/both/char.c @@ -0,0 +1,11 @@ +#include +#include +#include +#include +#include + +typedef struct Foo { + char32_t a; +} Foo; + +void root(Foo a); diff --git a/tests/expectations/both/char.compat.c b/tests/expectations/both/char.compat.c new file mode 100644 index 0000000..0faa811 --- /dev/null +++ b/tests/expectations/both/char.compat.c @@ -0,0 +1,19 @@ +#include +#include +#include +#include +#include + +typedef struct Foo { + char32_t a; +} Foo; + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +void root(Foo a); + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus diff --git a/tests/expectations/char.c b/tests/expectations/char.c new file mode 100644 index 0000000..1bb2526 --- /dev/null +++ b/tests/expectations/char.c @@ -0,0 +1,11 @@ +#include +#include +#include +#include +#include + +typedef struct { + char32_t a; +} Foo; + +void root(Foo a); diff --git a/tests/expectations/char.compat.c b/tests/expectations/char.compat.c new file mode 100644 index 0000000..e9d106b --- /dev/null +++ b/tests/expectations/char.compat.c @@ -0,0 +1,19 @@ +#include +#include +#include +#include +#include + +typedef struct { + char32_t a; +} Foo; + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +void root(Foo a); + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus diff --git a/tests/expectations/char.cpp b/tests/expectations/char.cpp new file mode 100644 index 0000000..34c62b3 --- /dev/null +++ b/tests/expectations/char.cpp @@ -0,0 +1,14 @@ +#include +#include +#include +#include + +struct Foo { + char32_t a; +}; + +extern "C" { + +void root(Foo a); + +} // extern "C" diff --git a/tests/expectations/tag/char.c b/tests/expectations/tag/char.c new file mode 100644 index 0000000..03c8b7b --- /dev/null +++ b/tests/expectations/tag/char.c @@ -0,0 +1,11 @@ +#include +#include +#include +#include +#include + +struct Foo { + char32_t a; +}; + +void root(struct Foo a); diff --git a/tests/expectations/tag/char.compat.c b/tests/expectations/tag/char.compat.c new file mode 100644 index 0000000..99ae871 --- /dev/null +++ b/tests/expectations/tag/char.compat.c @@ -0,0 +1,19 @@ +#include +#include +#include +#include +#include + +struct Foo { + char32_t a; +}; + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +void root(struct Foo a); + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus diff --git a/tests/rust/char.rs b/tests/rust/char.rs new file mode 100644 index 0000000..258e50f --- /dev/null +++ b/tests/rust/char.rs @@ -0,0 +1,7 @@ +#[repr(C)] +struct Foo { + a: char, +} + +#[no_mangle] +pub extern "C" fn root(a: Foo) {}