summaryrefslogtreecommitdiff
path: root/rust/bindgen_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'rust/bindgen_test.go')
-rw-r--r--rust/bindgen_test.go44
1 files changed, 44 insertions, 0 deletions
diff --git a/rust/bindgen_test.go b/rust/bindgen_test.go
index 191da9b11..359f28b83 100644
--- a/rust/bindgen_test.go
+++ b/rust/bindgen_test.go
@@ -82,3 +82,47 @@ func TestRustBindgenCustomBindgen(t *testing.T) {
libbindgen.Description)
}
}
+
+func TestRustBindgenStdVersions(t *testing.T) {
+ testRustError(t, "c_std and cpp_std cannot both be defined at the same time.", `
+ rust_bindgen {
+ name: "libbindgen",
+ wrapper_src: "src/any.h",
+ crate_name: "bindgen",
+ stem: "libbindgen",
+ source_stem: "bindings",
+ c_std: "somevalue",
+ cpp_std: "somevalue",
+ }
+ `)
+
+ ctx := testRust(t, `
+ rust_bindgen {
+ name: "libbindgen_cstd",
+ wrapper_src: "src/any.h",
+ crate_name: "bindgen",
+ stem: "libbindgen",
+ source_stem: "bindings",
+ c_std: "foo"
+ }
+ rust_bindgen {
+ name: "libbindgen_cppstd",
+ wrapper_src: "src/any.h",
+ crate_name: "bindgen",
+ stem: "libbindgen",
+ source_stem: "bindings",
+ cpp_std: "foo"
+ }
+ `)
+
+ libbindgen_cstd := ctx.ModuleForTests("libbindgen_cstd", "android_arm64_armv8-a").Output("bindings.rs")
+ libbindgen_cppstd := ctx.ModuleForTests("libbindgen_cppstd", "android_arm64_armv8-a").Output("bindings.rs")
+
+ if !strings.Contains(libbindgen_cstd.Args["cflags"], "-std=foo") {
+ t.Errorf("c_std value not passed in to rust_bindgen as a clang flag")
+ }
+
+ if !strings.Contains(libbindgen_cppstd.Args["cflags"], "-std=foo") {
+ t.Errorf("cpp_std value not passed in to rust_bindgen as a clang flag")
+ }
+}