// test some degenerate cases
CPPUNIT_ASSERT( !dt.ParseFormat("", "%z") );
+ CPPUNIT_ASSERT( !dt.ParseFormat("", "%%") );
// test compilation of some calls which should compile (and not result in
// ambiguity because of char*<->wxCStrData<->wxString conversions)
CPPUNIT_ASSERT( !dt.ParseFormat("foo") );
CPPUNIT_ASSERT( !dt.ParseFormat(wxT("foo")) );
CPPUNIT_ASSERT( !dt.ParseFormat(s) );
- CPPUNIT_ASSERT( !dt.ParseFormat(s.c_str()) );
+ dt.ParseFormat(s.c_str()); // Simply test compilation of this one.
CPPUNIT_ASSERT( !dt.ParseFormat("foo", "%c") );
CPPUNIT_ASSERT( !dt.ParseFormat(wxT("foo"), "%c") );
CPPUNIT_ASSERT( !dt.ParseFormat(s, "%c") );
- CPPUNIT_ASSERT( !dt.ParseFormat(s.c_str(), "%c") );
+ dt.ParseFormat(s.c_str(), "%c");
CPPUNIT_ASSERT( !dt.ParseFormat("foo", wxT("%c")) );
CPPUNIT_ASSERT( !dt.ParseFormat(wxT("foo"), wxT("%c")) );
CPPUNIT_ASSERT( !dt.ParseFormat(s, "%c") );
- CPPUNIT_ASSERT( !dt.ParseFormat(s.c_str(), wxT("%c")) );
+ dt.ParseFormat(s.c_str(), wxT("%c"));
wxString spec("%c");
CPPUNIT_ASSERT( !dt.ParseFormat("foo", spec) );
CPPUNIT_ASSERT( !dt.ParseFormat(wxT("foo"), spec) );
CPPUNIT_ASSERT( !dt.ParseFormat(s, spec) );
- CPPUNIT_ASSERT( !dt.ParseFormat(s.c_str(), spec) );
+ dt.ParseFormat(s.c_str(), spec);
}
void DateTimeTestCase::TestTimeSpanFormat()
);
}
}
+
+ // Check that incomplete parse works correctly.
+ const char* p = dt.ParseFormat("2012-03-23 12:34:56", "%Y-%m-%d");
+ CPPUNIT_ASSERT_EQUAL( " 12:34:56", wxString(p) );
}
void DateTimeTestCase::TestDateParseISO()