]> git.saurik.com Git - wxWidgets.git/blob - tests/strings/crt.cpp
removed src/gtk/eggtrayicon.h
[wxWidgets.git] / tests / strings / crt.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: tests/strings/crt.cpp
3 // Purpose: Test for wx C runtime functions wrappers
4 // Author: Vaclav Slavik
5 // Created: 2004-06-03
6 // RCS-ID: $Id$
7 // Copyright: (c) 2004 Vaclav Slavik
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
10
11 // ----------------------------------------------------------------------------
12 // headers
13 // ----------------------------------------------------------------------------
14
15 #include "wx/wxprec.h"
16
17 #ifdef __BORLANDC__
18 #pragma hdrstop
19 #endif
20
21 #ifndef WX_PRECOMP
22 #include "wx/wx.h"
23 #endif // WX_PRECOMP
24
25 #include "wx/textfile.h"
26
27 #include "wx/cppunit.h"
28
29 // ----------------------------------------------------------------------------
30 // test class
31 // ----------------------------------------------------------------------------
32
33 class CrtTestCase : public CppUnit::TestCase
34 {
35 public:
36 CrtTestCase() {}
37
38 private:
39 CPPUNIT_TEST_SUITE( CrtTestCase );
40 CPPUNIT_TEST( SetGetEnv );
41 CPPUNIT_TEST_SUITE_END();
42
43 void SetGetEnv();
44
45 DECLARE_NO_COPY_CLASS(CrtTestCase)
46 };
47
48 // register in the unnamed registry so that these tests are run by default
49 CPPUNIT_TEST_SUITE_REGISTRATION( CrtTestCase );
50
51 // also include in it's own registry so that these tests can be run alone
52 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( CrtTestCase, "CrtTestCase" );
53
54 void CrtTestCase::SetGetEnv()
55 {
56 wxString val;
57 wxSetEnv(_T("TESTVAR"), _T("value"));
58 CPPUNIT_ASSERT( wxGetEnv(_T("TESTVAR"), &val) == true );
59 CPPUNIT_ASSERT( val == _T("value") );
60 wxSetEnv(_T("TESTVAR"), _T("something else"));
61 CPPUNIT_ASSERT( wxGetEnv(_T("TESTVAR"), &val) );
62 CPPUNIT_ASSERT( val == _T("something else") );
63 CPPUNIT_ASSERT( wxUnsetEnv(_T("TESTVAR")) );
64 CPPUNIT_ASSERT( wxGetEnv(_T("TESTVAR"), NULL) == false );
65 }