You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
624 B
29 lines
624 B
4 months ago
|
use cxx_gen::Opt;
|
||
|
use quote::quote;
|
||
|
|
||
|
#[test]
|
||
|
fn test_positive() {
|
||
|
let rs = quote! {
|
||
|
#[cxx::bridge]
|
||
|
mod ffi {
|
||
|
unsafe extern "C++" {
|
||
|
fn in_C();
|
||
|
}
|
||
|
extern "Rust" {
|
||
|
fn in_rs();
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
let opt = Opt::default();
|
||
|
let code = cxx_gen::generate_header_and_cc(rs, &opt).unwrap();
|
||
|
assert!(!code.header.is_empty());
|
||
|
assert!(!code.implementation.is_empty());
|
||
|
}
|
||
|
|
||
|
#[test]
|
||
|
fn test_negative() {
|
||
|
let rs = quote! {};
|
||
|
let opt = Opt::default();
|
||
|
assert!(cxx_gen::generate_header_and_cc(rs, &opt).is_err())
|
||
|
}
|