TextFileTestCase: test for correct parsing of empty Mac lines.

(This is failing both with and without r75387.)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75797 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík 2014-02-05 18:28:46 +00:00
parent c866934853
commit 40eed079ec

View File

@ -168,15 +168,19 @@ void TextFileTestCase::ReadUnixLast()
void TextFileTestCase::ReadMac() void TextFileTestCase::ReadMac()
{ {
CreateTestFile("foo\rbar\rbaz"); CreateTestFile("foo\rbar\r\rbaz");
wxTextFile f; wxTextFile f;
CPPUNIT_ASSERT( f.Open(wxString::FromAscii(GetTestFileName())) ); CPPUNIT_ASSERT( f.Open(wxString::FromAscii(GetTestFileName())) );
CPPUNIT_ASSERT_EQUAL( (size_t)3, f.GetLineCount() ); CPPUNIT_ASSERT_EQUAL( (size_t)4, f.GetLineCount() );
CPPUNIT_ASSERT_EQUAL( wxTextFileType_Mac, f.GetLineType(0) ); CPPUNIT_ASSERT_EQUAL( wxTextFileType_Mac, f.GetLineType(0) );
CPPUNIT_ASSERT_EQUAL( wxTextFileType_None, f.GetLineType(2) ); CPPUNIT_ASSERT_EQUAL( wxTextFileType_Mac, f.GetLineType(1) );
CPPUNIT_ASSERT_EQUAL( wxTextFileType_Mac, f.GetLineType(2) );
CPPUNIT_ASSERT_EQUAL( wxTextFileType_None, f.GetLineType(3) );
CPPUNIT_ASSERT_EQUAL( wxString(wxT("foo")), f.GetLine(0) );
CPPUNIT_ASSERT_EQUAL( wxString(wxT("bar")), f.GetLine(1) ); CPPUNIT_ASSERT_EQUAL( wxString(wxT("bar")), f.GetLine(1) );
CPPUNIT_ASSERT_EQUAL( wxString(wxT("")), f.GetLine(2) );
CPPUNIT_ASSERT_EQUAL( wxString(wxT("baz")), f.GetLastLine() ); CPPUNIT_ASSERT_EQUAL( wxString(wxT("baz")), f.GetLastLine() );
} }