X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/390b8241d313ab0a1410b589d5f3d1b75a1cafa0..a25a17732c2d4d34d5d35a5318053dd8c6e29722:/tests/strings/crt.cpp diff --git a/tests/strings/crt.cpp b/tests/strings/crt.cpp index 61dc5afcc6..e4e69caa16 100644 --- a/tests/strings/crt.cpp +++ b/tests/strings/crt.cpp @@ -69,15 +69,24 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( CrtTestCase, "CrtTestCase" ); void CrtTestCase::SetGetEnv() { +#define TESTVAR_NAME _T("WXTESTVAR") + wxString val; - wxSetEnv(_T("TESTVAR"), _T("value")); - CPPUNIT_ASSERT( wxGetEnv(_T("TESTVAR"), &val) == true ); - CPPUNIT_ASSERT( val == _T("value") ); - wxSetEnv(_T("TESTVAR"), _T("something else")); - CPPUNIT_ASSERT( wxGetEnv(_T("TESTVAR"), &val) ); - CPPUNIT_ASSERT( val == _T("something else") ); - CPPUNIT_ASSERT( wxUnsetEnv(_T("TESTVAR")) ); - CPPUNIT_ASSERT( wxGetEnv(_T("TESTVAR"), NULL) == false ); + wxSetEnv(TESTVAR_NAME, _T("value")); + CPPUNIT_ASSERT( wxGetEnv(TESTVAR_NAME, &val) ); + CPPUNIT_ASSERT_EQUAL( "value", val ); + CPPUNIT_ASSERT_EQUAL( "value", wxString(wxGetenv(TESTVAR_NAME)) ); + + wxSetEnv(TESTVAR_NAME, _T("something else")); + CPPUNIT_ASSERT( wxGetEnv(TESTVAR_NAME, &val) ); + CPPUNIT_ASSERT_EQUAL( "something else", val ); + CPPUNIT_ASSERT_EQUAL( "something else", wxString(wxGetenv(TESTVAR_NAME)) ); + + CPPUNIT_ASSERT( wxUnsetEnv(TESTVAR_NAME) ); + CPPUNIT_ASSERT( !wxGetEnv(TESTVAR_NAME, NULL) ); + CPPUNIT_ASSERT( !wxGetenv(TESTVAR_NAME) ); + +#undef TESTVAR_NAME } void CrtTestCase::Strcmp()