diff options
| author | 2021-04-08 08:57:22 +0000 | |
|---|---|---|
| committer | 2021-04-08 08:57:22 +0000 | |
| commit | e54504e19cadbc2ee905a29bf25a92eaa027ec25 (patch) | |
| tree | 878ba04889874e19a86eddb3591b5320dbf3c4b2 /rust/compiler_test.go | |
| parent | 2b9ee14ce0449480d5197a5473110755479139d1 (diff) | |
| parent | c44e7372ed80d334baa0bd51039ccc403e0b7c5b (diff) | |
Merge "rust: Add cfgs property"
Diffstat (limited to 'rust/compiler_test.go')
| -rw-r--r-- | rust/compiler_test.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/rust/compiler_test.go b/rust/compiler_test.go index c75276239..5ca9e7f35 100644 --- a/rust/compiler_test.go +++ b/rust/compiler_test.go @@ -42,6 +42,27 @@ func TestFeaturesToFlags(t *testing.T) { } } +// Test that cfgs flags are being correctly generated. +func TestCfgsToFlags(t *testing.T) { + ctx := testRust(t, ` + rust_library_host { + name: "libfoo", + srcs: ["foo.rs"], + crate_name: "foo", + cfgs: [ + "std", + "cfg1=\"one\"" + ], + }`) + + libfooDylib := ctx.ModuleForTests("libfoo", "linux_glibc_x86_64_dylib").Rule("rustc") + + if !strings.Contains(libfooDylib.Args["rustcFlags"], "cfg 'std'") || + !strings.Contains(libfooDylib.Args["rustcFlags"], "cfg 'cfg1=\"one\"'") { + t.Fatalf("missing std and cfg1 flags for libfoo dylib, rustcFlags: %#v", libfooDylib.Args["rustcFlags"]) + } +} + // Test that we reject multiple source files. func TestEnforceSingleSourceFile(t *testing.T) { |