Brian Silverman | 4e662aa | 2022-05-11 23:10:19 -0700 | [diff] [blame^] | 1 | // Copyright 2020 Google LLC |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or |
| 4 | // https://www.apache.org/licenses/LICENSE-2.0> or the MIT license |
| 5 | // <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your |
| 6 | // option. This file may not be copied, modified, or distributed |
| 7 | // except according to those terms. |
| 8 | |
| 9 | use autocxx_parser::UnsafePolicy; |
| 10 | #[allow(unused_imports)] |
| 11 | use syn::parse_quote; |
| 12 | use syn::ItemMod; |
| 13 | |
| 14 | use crate::CppCodegenOptions; |
| 15 | |
| 16 | use super::BridgeConverter; |
| 17 | |
| 18 | // This mod is for tests which take bindgen output directly. |
| 19 | // This should be avoided where possible, since these tests will |
| 20 | // become obsolete or have to change if and when we update |
| 21 | // bindgen. Instead, please add tests working directly from |
| 22 | // the original C++ in integration_tests.rs if possible. |
| 23 | // Also, if you're pasting in code from github issues, it's |
| 24 | // important to make sure that the underlying code has an |
| 25 | // acceptable license. That's why this file is currently blank. |
| 26 | |
| 27 | #[allow(dead_code)] |
| 28 | fn do_test(input: ItemMod) { |
| 29 | let tc = parse_quote! {}; |
| 30 | let bc = BridgeConverter::new(&[], &tc); |
| 31 | let inclusions = "".into(); |
| 32 | bc.convert( |
| 33 | input, |
| 34 | UnsafePolicy::AllFunctionsSafe, |
| 35 | inclusions, |
| 36 | &CppCodegenOptions::default(), |
| 37 | ) |
| 38 | .unwrap(); |
| 39 | } |
| 40 | |
| 41 | // How to add a test here |
| 42 | // |
| 43 | // #[test] |
| 44 | // fn test_xyz() { |
| 45 | // do_test(parse_quote!{ /* paste bindgen output here */}) |
| 46 | // } |