From ff3c88aa38947acb56d0de784d01e8add1235e12 Mon Sep 17 00:00:00 2001 From: Jan Michael Auer Date: Wed, 23 Aug 2017 12:50:09 -0700 Subject: [PATCH] Add tests for flag_if_supported in C++ mode. --- tests/support/mod.rs | 2 +- tests/test.rs | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/tests/support/mod.rs b/tests/support/mod.rs index 54c9ee1..2f3e44c 100644 --- a/tests/support/mod.rs +++ b/tests/support/mod.rs @@ -36,7 +36,7 @@ impl Test { pub fn gnu() -> Test { let t = Test::new(); - t.shim("cc").shim("ar"); + t.shim("cc").shim("c++").shim("ar"); t } diff --git a/tests/test.rs b/tests/test.rs index c538130..dd60f94 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -216,11 +216,29 @@ fn gnu_flag_if_supported() { .file("foo.c") .flag_if_supported("-Wall") .flag_if_supported("-Wflag-does-not-exist") + .flag_if_supported("-std=c++11") .compile("foo"); test.cmd(0) .must_have("-Wall") - .must_not_have("-Wflag-does-not-exist"); + .must_not_have("-Wflag-does-not-exist") + .must_not_have("-std=c++11"); +} + +#[test] +fn gnu_flag_if_supported_cpp() { + if cfg!(windows) { + return + } + let test = Test::gnu(); + test.gcc() + .cpp(true) + .file("foo.cpp") + .flag_if_supported("-std=c++11") + .compile("foo"); + + test.cmd(0) + .must_have("-std=c++11"); } #[test]