tests: Add a test for #708

This commit is contained in:
Emilio Cobos Álvarez
2021-08-24 11:44:51 +02:00
parent cbd4260bdc
commit 577b041933
10 changed files with 60 additions and 9 deletions
+6 -1
View File
@@ -3,10 +3,15 @@
#include <stdint.h>
#include <stdlib.h>
typedef enum Bar {
BarSome,
BarThing,
} Bar;
typedef struct FooU8 {
uint8_t a;
} FooU8;
typedef struct FooU8 Boo;
void root(Boo x);
void root(Boo x, enum Bar y);
+6 -1
View File
@@ -3,6 +3,11 @@
#include <stdint.h>
#include <stdlib.h>
typedef enum Bar {
BarSome,
BarThing,
} Bar;
typedef struct FooU8 {
uint8_t a;
} FooU8;
@@ -13,7 +18,7 @@ typedef struct FooU8 Boo;
extern "C" {
#endif // __cplusplus
void root(Boo x);
void root(Boo x, enum Bar y);
#ifdef __cplusplus
} // extern "C"
+6 -1
View File
@@ -3,10 +3,15 @@
#include <stdint.h>
#include <stdlib.h>
typedef enum {
BarSome,
BarThing,
} Bar;
typedef struct {
uint8_t a;
} FooU8;
typedef FooU8 Boo;
void root(Boo x);
void root(Boo x, Bar y);
+6 -1
View File
@@ -3,6 +3,11 @@
#include <stdint.h>
#include <stdlib.h>
typedef enum {
BarSome,
BarThing,
} Bar;
typedef struct {
uint8_t a;
} FooU8;
@@ -13,7 +18,7 @@ typedef FooU8 Boo;
extern "C" {
#endif // __cplusplus
void root(Boo x);
void root(Boo x, Bar y);
#ifdef __cplusplus
} // extern "C"
+6 -1
View File
@@ -4,6 +4,11 @@
#include <ostream>
#include <new>
enum class Bar {
BarSome,
BarThing,
};
template<typename T>
struct Foo {
T a;
@@ -13,6 +18,6 @@ using Boo = Foo<uint8_t>;
extern "C" {
void root(Boo x);
void root(Boo x, Bar y);
} // extern "C"
+5 -1
View File
@@ -6,9 +6,13 @@ cdef extern from *:
cdef extern from *:
ctypedef enum Bar:
BarSome,
BarThing,
ctypedef struct FooU8:
uint8_t a;
ctypedef FooU8 Boo;
void root(Boo x);
void root(Boo x, Bar y);
+6 -1
View File
@@ -3,10 +3,15 @@
#include <stdint.h>
#include <stdlib.h>
enum Bar {
BarSome,
BarThing,
};
struct FooU8 {
uint8_t a;
};
typedef struct FooU8 Boo;
void root(Boo x);
void root(Boo x, enum Bar y);
+6 -1
View File
@@ -3,6 +3,11 @@
#include <stdint.h>
#include <stdlib.h>
enum Bar {
BarSome,
BarThing,
};
struct FooU8 {
uint8_t a;
};
@@ -13,7 +18,7 @@ typedef struct FooU8 Boo;
extern "C" {
#endif // __cplusplus
void root(Boo x);
void root(Boo x, enum Bar y);
#ifdef __cplusplus
} // extern "C"
+5 -1
View File
@@ -6,9 +6,13 @@ cdef extern from *:
cdef extern from *:
cdef enum Bar:
BarSome,
BarThing,
cdef struct FooU8:
uint8_t a;
ctypedef FooU8 Boo;
void root(Boo x);
void root(Boo x, Bar y);
+8
View File
@@ -5,7 +5,15 @@ pub struct Foo<T> {
pub type Boo = Foo<u8>;
/// cbindgen:prefix-with-name=true
#[repr(C)]
pub enum Bar {
Some,
Thing,
}
#[no_mangle]
pub extern "C" fn root(
x: Boo,
y: Bar,
) { }