diff options
| author | Julio Merino <jmmv@FreeBSD.org> | 2014-10-30 17:14:07 +0000 |
|---|---|---|
| committer | Julio Merino <jmmv@FreeBSD.org> | 2014-10-30 17:14:07 +0000 |
| commit | 94d25974a7773307f930a633881744ad9d6d2777 (patch) | |
| tree | ad1d74d2ba71e1c54c3276bb7c67e257831ec21f /atf-c++/detail/env_test.cpp | |
| parent | 9b3afb9f3c00ca9da97167e29f437bdd3036da1a (diff) | |
Diffstat (limited to 'atf-c++/detail/env_test.cpp')
| -rw-r--r-- | atf-c++/detail/env_test.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/atf-c++/detail/env_test.cpp b/atf-c++/detail/env_test.cpp index a7b681d14e11..91616f38f044 100644 --- a/atf-c++/detail/env_test.cpp +++ b/atf-c++/detail/env_test.cpp @@ -1,6 +1,3 @@ -// -// Automated Testing Framework (atf) -// // Copyright (c) 2007 The NetBSD Foundation, Inc. // All rights reserved. // @@ -25,11 +22,10 @@ // IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN // IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -#include "../macros.hpp" +#include "atf-c++/detail/env.hpp" -#include "env.hpp" +#include <atf-c++.hpp> // ------------------------------------------------------------------------ // Test cases for the free functions. @@ -48,6 +44,19 @@ ATF_TEST_CASE_BODY(has_get) ATF_REQUIRE(!atf::env::has("_UNDEFINED_VARIABLE_")); } +ATF_TEST_CASE(get_with_default); +ATF_TEST_CASE_HEAD(get_with_default) +{ + set_md_var("descr", "Tests the get function with a default value"); +} +ATF_TEST_CASE_BODY(get_with_default) +{ + ATF_REQUIRE(atf::env::has("PATH")); + ATF_REQUIRE(atf::env::get("PATH", "default value") != "default value"); + + ATF_REQUIRE_EQ(atf::env::get("_UNDEFINED_VARIABLE_", "foo bar"), "foo bar"); +} + ATF_TEST_CASE(set); ATF_TEST_CASE_HEAD(set) { @@ -86,6 +95,7 @@ ATF_INIT_TEST_CASES(tcs) { // Add the test cases for the free functions. ATF_ADD_TEST_CASE(tcs, has_get); + ATF_ADD_TEST_CASE(tcs, get_with_default); ATF_ADD_TEST_CASE(tcs, set); ATF_ADD_TEST_CASE(tcs, unset); } |
