diff options
author | 2020-09-25 13:11:34 +0000 | |
---|---|---|
committer | 2020-09-25 13:11:34 +0000 | |
commit | ce2cffd5836f605337babc17858648c0887acf8d (patch) | |
tree | 7f5dcf97d975243ccab87e2b2fa18e2e43635216 /rust/bindgen_test.go | |
parent | 6a94390d2ec0265d1fb9e5836bc4168fd2bc6a3a (diff) | |
parent | 3d94752b34a053af3eeaf00659ccd0761e078a6a (diff) |
Merge "rust: Add rust_bindgen std version w/ cc defaults."
Diffstat (limited to 'rust/bindgen_test.go')
-rw-r--r-- | rust/bindgen_test.go | 44 |
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") + } +} |