diff --git a/src/bindgen/rename.rs b/src/bindgen/rename.rs index f559289dd..e58b7a5ae 100644 --- a/src/bindgen/rename.rs +++ b/src/bindgen/rename.rs @@ -73,7 +73,7 @@ impl RenameRule { RenameRule::LowerCase => text.to_lowercase(), RenameRule::UpperCase => text.to_uppercase(), RenameRule::PascalCase => text.to_pascal_case(), - RenameRule::CamelCase => text.to_upper_camel_case(), + RenameRule::CamelCase => text.to_lower_camel_case(), RenameRule::SnakeCase => text.to_snake_case(), RenameRule::ScreamingSnakeCase => text.to_shouty_snake_case(), RenameRule::QualifiedScreamingSnakeCase => { diff --git a/tests/expectations/rename_case.c b/tests/expectations/rename_case.c new file mode 100644 index 000000000..c57482319 --- /dev/null +++ b/tests/expectations/rename_case.c @@ -0,0 +1,14 @@ +#include +#include +#include +#include + +void test_camel_case(int32_t fooBar); + +void test_pascal_case(int32_t FooBar); + +void test_snake_case(int32_t foo_bar); + +void test_screaming_snake_case(int32_t FOO_BAR); + +void test_gecko_case(int32_t aFooBar); diff --git a/tests/expectations/rename_case.compat.c b/tests/expectations/rename_case.compat.c new file mode 100644 index 000000000..61e3310e8 --- /dev/null +++ b/tests/expectations/rename_case.compat.c @@ -0,0 +1,22 @@ +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +void test_camel_case(int32_t fooBar); + +void test_pascal_case(int32_t FooBar); + +void test_snake_case(int32_t foo_bar); + +void test_screaming_snake_case(int32_t FOO_BAR); + +void test_gecko_case(int32_t aFooBar); + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus diff --git a/tests/expectations/rename_case.cpp b/tests/expectations/rename_case.cpp new file mode 100644 index 000000000..794fa0cfd --- /dev/null +++ b/tests/expectations/rename_case.cpp @@ -0,0 +1,19 @@ +#include +#include +#include +#include +#include + +extern "C" { + +void test_camel_case(int32_t fooBar); + +void test_pascal_case(int32_t FooBar); + +void test_snake_case(int32_t foo_bar); + +void test_screaming_snake_case(int32_t FOO_BAR); + +void test_gecko_case(int32_t aFooBar); + +} // extern "C" diff --git a/tests/expectations/rename_case.pyx b/tests/expectations/rename_case.pyx new file mode 100644 index 000000000..5fd35fc4c --- /dev/null +++ b/tests/expectations/rename_case.pyx @@ -0,0 +1,17 @@ +from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t +from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t +cdef extern from *: + ctypedef bint bool + ctypedef struct va_list + +cdef extern from *: + + void test_camel_case(int32_t fooBar); + + void test_pascal_case(int32_t FooBar); + + void test_snake_case(int32_t foo_bar); + + void test_screaming_snake_case(int32_t FOO_BAR); + + void test_gecko_case(int32_t aFooBar); diff --git a/tests/rust/rename_case.rs b/tests/rust/rename_case.rs new file mode 100644 index 000000000..e83227d02 --- /dev/null +++ b/tests/rust/rename_case.rs @@ -0,0 +1,19 @@ +/// cbindgen:rename-all=CamelCase +#[no_mangle] +pub extern "C" fn test_camel_case(foo_bar: i32) {} + +/// cbindgen:rename-all=PascalCase +#[no_mangle] +pub extern "C" fn test_pascal_case(foo_bar: i32) {} + +/// cbindgen:rename-all=SnakeCase +#[no_mangle] +pub extern "C" fn test_snake_case(foo_bar: i32) {} + +/// cbindgen:rename-all=ScreamingSnakeCase +#[no_mangle] +pub extern "C" fn test_screaming_snake_case(foo_bar: i32) {} + +/// cbindgen:rename-all=GeckoCase +#[no_mangle] +pub extern "C" fn test_gecko_case(foo_bar: i32) {}