]> git.saurik.com Git - wxWidgets.git/blobdiff - tests/cmdline/cmdlinetest.cpp
Try native method first in LoadFile() and SaveFile()
[wxWidgets.git] / tests / cmdline / cmdlinetest.cpp
index 07b030ff375bcb750e9e4271b4ce908725960a9b..2e5728971a894edebfb28a16b5c0baa3e98fe59b 100644 (file)
@@ -3,7 +3,6 @@
 // Purpose:     wxCmdLineParser unit test
 // Author:      Vadim Zeitlin
 // Created:     2008-04-12
 // Purpose:     wxCmdLineParser unit test
 // Author:      Vadim Zeitlin
 // Created:     2008-04-12
-// RCS-ID:      $Id$
 // Copyright:   (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
 ///////////////////////////////////////////////////////////////////////////////
 
 // Copyright:   (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
 ///////////////////////////////////////////////////////////////////////////////
 
@@ -139,6 +138,8 @@ void CmdLineTestCase::ParseSwitches()
     p.AddSwitch("b");
     p.AddSwitch("c");
     p.AddSwitch("d");
     p.AddSwitch("b");
     p.AddSwitch("c");
     p.AddSwitch("d");
+    p.AddSwitch("n", "neg", "Switch that can be negated",
+                wxCMD_LINE_SWITCH_NEGATABLE);
 
     p.SetCmdLine("");
     CPPUNIT_ASSERT_EQUAL(0, p.Parse(false) );
 
     p.SetCmdLine("");
     CPPUNIT_ASSERT_EQUAL(0, p.Parse(false) );
@@ -182,6 +183,23 @@ void CmdLineTestCase::ParseSwitches()
     CPPUNIT_ASSERT( !p.Found("b") );
     CPPUNIT_ASSERT( !p.Found("c") );
     CPPUNIT_ASSERT( p.Found("d") );
     CPPUNIT_ASSERT( !p.Found("b") );
     CPPUNIT_ASSERT( !p.Found("c") );
     CPPUNIT_ASSERT( p.Found("d") );
+
+    p.SetCmdLine("-n");
+    CPPUNIT_ASSERT_EQUAL(0, p.Parse(false) );
+    CPPUNIT_ASSERT_EQUAL(wxCMD_SWITCH_NOT_FOUND, p.FoundSwitch("a") );
+    CPPUNIT_ASSERT_EQUAL(wxCMD_SWITCH_ON, p.FoundSwitch("n") );
+
+    p.SetCmdLine("-n-");
+    CPPUNIT_ASSERT_EQUAL(0, p.Parse(false) );
+    CPPUNIT_ASSERT_EQUAL(wxCMD_SWITCH_OFF, p.FoundSwitch("neg") );
+
+    p.SetCmdLine("--neg");
+    CPPUNIT_ASSERT_EQUAL(0, p.Parse(false) );
+    CPPUNIT_ASSERT_EQUAL(wxCMD_SWITCH_ON, p.FoundSwitch("neg") );
+
+    p.SetCmdLine("--neg-");
+    CPPUNIT_ASSERT_EQUAL(0, p.Parse(false) );
+    CPPUNIT_ASSERT_EQUAL(wxCMD_SWITCH_OFF, p.FoundSwitch("n") );
 }
 
 void CmdLineTestCase::Usage()
 }
 
 void CmdLineTestCase::Usage()