From 421274fade3347a7ca7cfea2e86473dab7f8837e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 20 Dec 2005 16:48:41 +0000 Subject: [PATCH] added tests showing that current wxStringTokenizer code doesn't handle multiple delimiters at the end of string properly in mode != wxTOKEN_STRTOK git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36507 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- tests/strings/tokenizer.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/strings/tokenizer.cpp b/tests/strings/tokenizer.cpp index 7d0ebd692a..8394d5a761 100644 --- a/tests/strings/tokenizer.cpp +++ b/tests/strings/tokenizer.cpp @@ -73,6 +73,7 @@ static const struct TokenizerTestData gs_testData[] = { { _T(""), _T(" "), wxTOKEN_DEFAULT , 0 }, + { _T("Hello, world"), _T(" "), wxTOKEN_DEFAULT , 2 }, { _T("Hello, world "), _T(" "), wxTOKEN_DEFAULT , 2 }, { _T("Hello, world"), _T(","), wxTOKEN_DEFAULT , 2 }, @@ -80,11 +81,27 @@ gs_testData[] = { _T("Hello,, world!"), _T(",!"), wxTOKEN_DEFAULT , 3 }, { _T("Hello,, world!"), _T(",!"), wxTOKEN_STRTOK , 2 }, { _T("Hello, world!"), _T(",!"), wxTOKEN_RET_EMPTY_ALL, 3 }, + { _T("username:password:uid:gid:gecos:home:shell"), _T(":"), wxTOKEN_DEFAULT , 7 }, + + { _T("1:2::3:"), _T(":"), wxTOKEN_DEFAULT , 4 }, + { _T("1:2::3:"), _T(":"), wxTOKEN_RET_EMPTY , 4 }, + { _T("1:2::3:"), _T(":"), wxTOKEN_RET_EMPTY_ALL, 5 }, + { _T("1:2::3:"), _T(":"), wxTOKEN_RET_DELIMS , 4 }, + { _T("1:2::3:"), _T(":"), wxTOKEN_STRTOK , 3 }, + + { _T("1:2::3::"), _T(":"), wxTOKEN_DEFAULT , 5 }, + { _T("1:2::3::"), _T(":"), wxTOKEN_RET_EMPTY , 5 }, + { _T("1:2::3::"), _T(":"), wxTOKEN_RET_EMPTY_ALL, 6 }, + { _T("1:2::3::"), _T(":"), wxTOKEN_RET_DELIMS , 5 }, + { _T("1:2::3::"), _T(":"), wxTOKEN_STRTOK , 3 }, + { _T("1 \t3\t4 6 "), wxDEFAULT_DELIMITERS, wxTOKEN_DEFAULT , 4 }, + { _T("1 \t3\t4 6 "), wxDEFAULT_DELIMITERS, wxTOKEN_STRTOK , 4 }, { _T("1 \t3\t4 6 "), wxDEFAULT_DELIMITERS, wxTOKEN_RET_EMPTY , 6 }, { _T("1 \t3\t4 6 "), wxDEFAULT_DELIMITERS, wxTOKEN_RET_EMPTY_ALL, 9 }, + { _T("01/02/99"), _T("/-"), wxTOKEN_DEFAULT , 3 }, { _T("01-02/99"), _T("/-"), wxTOKEN_RET_DELIMS , 3 }, }; -- 2.45.2