diff --git a/tests/expectations/both/mod_2015.c b/tests/expectations/both/mod_2015.c new file mode 100644 index 0000000..489223e --- /dev/null +++ b/tests/expectations/both/mod_2015.c @@ -0,0 +1,12 @@ +#include +#include +#include +#include + +#define EXPORT_ME_TOO 42 + +typedef struct ExportMe { + uint64_t val; +} ExportMe; + +void export_me(ExportMe *val); diff --git a/tests/expectations/both/mod_2015.compat.c b/tests/expectations/both/mod_2015.compat.c new file mode 100644 index 0000000..3f4aa04 --- /dev/null +++ b/tests/expectations/both/mod_2015.compat.c @@ -0,0 +1,20 @@ +#include +#include +#include +#include + +#define EXPORT_ME_TOO 42 + +typedef struct ExportMe { + uint64_t val; +} ExportMe; + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +void export_me(ExportMe *val); + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus diff --git a/tests/expectations/mod_2015.c b/tests/expectations/mod_2015.c new file mode 100644 index 0000000..7ffa5ee --- /dev/null +++ b/tests/expectations/mod_2015.c @@ -0,0 +1,12 @@ +#include +#include +#include +#include + +#define EXPORT_ME_TOO 42 + +typedef struct { + uint64_t val; +} ExportMe; + +void export_me(ExportMe *val); diff --git a/tests/expectations/mod_2015.compat.c b/tests/expectations/mod_2015.compat.c new file mode 100644 index 0000000..1527af6 --- /dev/null +++ b/tests/expectations/mod_2015.compat.c @@ -0,0 +1,20 @@ +#include +#include +#include +#include + +#define EXPORT_ME_TOO 42 + +typedef struct { + uint64_t val; +} ExportMe; + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +void export_me(ExportMe *val); + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus diff --git a/tests/expectations/mod_2015.cpp b/tests/expectations/mod_2015.cpp new file mode 100644 index 0000000..c0bf6e2 --- /dev/null +++ b/tests/expectations/mod_2015.cpp @@ -0,0 +1,16 @@ +#include +#include +#include +#include + +static const uint8_t EXPORT_ME_TOO = 42; + +struct ExportMe { + uint64_t val; +}; + +extern "C" { + +void export_me(ExportMe *val); + +} // extern "C" diff --git a/tests/expectations/tag/mod_2015.c b/tests/expectations/tag/mod_2015.c new file mode 100644 index 0000000..01a8d59 --- /dev/null +++ b/tests/expectations/tag/mod_2015.c @@ -0,0 +1,12 @@ +#include +#include +#include +#include + +#define EXPORT_ME_TOO 42 + +struct ExportMe { + uint64_t val; +}; + +void export_me(struct ExportMe *val); diff --git a/tests/expectations/tag/mod_2015.compat.c b/tests/expectations/tag/mod_2015.compat.c new file mode 100644 index 0000000..097697e --- /dev/null +++ b/tests/expectations/tag/mod_2015.compat.c @@ -0,0 +1,20 @@ +#include +#include +#include +#include + +#define EXPORT_ME_TOO 42 + +struct ExportMe { + uint64_t val; +}; + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +void export_me(struct ExportMe *val); + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus diff --git a/tests/rust/mod_2015/Cargo.lock b/tests/rust/mod_2015/Cargo.lock new file mode 100644 index 0000000..6f0820c --- /dev/null +++ b/tests/rust/mod_2015/Cargo.lock @@ -0,0 +1,6 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "mod_2015" +version = "0.1.0" + diff --git a/tests/rust/mod_2015/Cargo.toml b/tests/rust/mod_2015/Cargo.toml new file mode 100644 index 0000000..94a8f27 --- /dev/null +++ b/tests/rust/mod_2015/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "mod_2015" +version = "0.1.0" +authors = ["cbindgen"] +edition = "2015" + +[lib] +name = "mod_2015" +crate-type = ["lib", "dylib"] diff --git a/tests/rust/mod_2015/cbindgen.toml b/tests/rust/mod_2015/cbindgen.toml new file mode 100644 index 0000000..4e90f53 --- /dev/null +++ b/tests/rust/mod_2015/cbindgen.toml @@ -0,0 +1,2 @@ +[parse] +parse_deps = false diff --git a/tests/rust/mod_2015/src/lib.rs b/tests/rust/mod_2015/src/lib.rs new file mode 100644 index 0000000..e5f480d --- /dev/null +++ b/tests/rust/mod_2015/src/lib.rs @@ -0,0 +1 @@ +pub mod nested; diff --git a/tests/rust/mod_2015/src/nested/mod.rs b/tests/rust/mod_2015/src/nested/mod.rs new file mode 100644 index 0000000..5347ee6 --- /dev/null +++ b/tests/rust/mod_2015/src/nested/mod.rs @@ -0,0 +1 @@ +pub mod other; diff --git a/tests/rust/mod_2015/src/nested/other.rs b/tests/rust/mod_2015/src/nested/other.rs new file mode 100644 index 0000000..baf4a86 --- /dev/null +++ b/tests/rust/mod_2015/src/nested/other.rs @@ -0,0 +1,14 @@ +#[repr(C)] +pub struct ExportMe { + val: u64 +} + +#[repr(C)] +pub struct DoNotExportMe { + val: u64 +} + +pub const EXPORT_ME_TOO: u8 = 0x2a; + +#[no_mangle] +pub unsafe extern "C" fn export_me(val: *mut ExportMe) { }