@@ -18,7 +18,7 @@ fn test_extern_c_function() {
1818 let output = str:: from_utf8 ( & generated. implementation ) . unwrap ( ) ;
1919 // To avoid continual breakage we won't test every byte.
2020 // Let's look for the major features.
21- assert ! ( output. contains( "void cxxbridge1 $do_cpp_thing(::rust::Str foo)" ) ) ;
21+ assert ! ( output. contains( & format! ( "void {CXXBRIDGE} $do_cpp_thing(::rust::Str foo)" ) ) ) ;
2222}
2323
2424#[ test]
@@ -28,9 +28,13 @@ fn test_impl_annotation() {
2828 let source = BRIDGE0 . parse ( ) . unwrap ( ) ;
2929 let generated = generate_header_and_cc ( source, & opt) . unwrap ( ) ;
3030 let output = str:: from_utf8 ( & generated. implementation ) . unwrap ( ) ;
31- assert ! ( output. contains( "ANNOTATION void cxxbridge1$do_cpp_thing(::rust::Str foo)" ) ) ;
31+ assert ! ( output. contains( & format!(
32+ "ANNOTATION void {CXXBRIDGE}$do_cpp_thing(::rust::Str foo)"
33+ ) ) ) ;
3234}
3335
36+ const CXXBRIDGE : & ' static str = concat ! ( "cxxbridge1_" , env!( "CARGO_PKG_VERSION_PATCH" ) ) ;
37+
3438const BRIDGE1 : & str = r#"
3539 #[cxx::bridge]
3640 mod ffi {
@@ -66,10 +70,13 @@ fn test_extern_rust_method_on_c_type() {
6670 assert ! ( !header. contains( "rust_method_cpp_receiver" ) ) ;
6771
6872 // Check that there is a generated C signature bridging to the Rust method.
69- assert ! ( implementation
70- . contains( "void cxxbridge1$CppType$rust_method_cpp_receiver(::CppType &self) noexcept;" ) ) ;
73+ assert ! ( implementation. contains( & format!(
74+ "void {CXXBRIDGE}$CppType$rust_method_cpp_receiver(::CppType &self) noexcept;"
75+ ) ) ) ;
7176
7277 // Check that there is an implementation on the C++ class calling the Rust method.
7378 assert ! ( implementation. contains( "void CppType::rust_method_cpp_receiver() noexcept {" ) ) ;
74- assert ! ( implementation. contains( "cxxbridge1$CppType$rust_method_cpp_receiver(*this);" ) ) ;
79+ assert ! ( implementation. contains( & format!(
80+ "{CXXBRIDGE}$CppType$rust_method_cpp_receiver(*this);"
81+ ) ) ) ;
7582}
0 commit comments