From 19e6bcffdbf88cf2413699e6cfbd493ca3cba0a8 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 13 Jun 2017 11:53:19 -0400 Subject: Add CFGAS_FormatString helper to extract digits. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This CL adds ExtractCountDigits and ExtractCountDigitsWithOptional to cleanup the digit extraction code. Change-Id: I6c3f4b435ec41b429b18cd9af9be46551a7fa391 Reviewed-on: https://pdfium-review.googlesource.com/6391 Commit-Queue: dsinclair Reviewed-by: Nicolás Peña --- xfa/fgas/crt/cfgas_formatstring_unittest.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'xfa/fgas/crt/cfgas_formatstring_unittest.cpp') diff --git a/xfa/fgas/crt/cfgas_formatstring_unittest.cpp b/xfa/fgas/crt/cfgas_formatstring_unittest.cpp index 32bb23b22c..3adcedf7b2 100644 --- a/xfa/fgas/crt/cfgas_formatstring_unittest.cpp +++ b/xfa/fgas/crt/cfgas_formatstring_unittest.cpp @@ -177,15 +177,18 @@ TEST_F(CFGAS_FormatStringTest, DateTimeFormat) { const wchar_t* input; const wchar_t* pattern; const wchar_t* output; - } tests[] = {{L"en", L"1999-07-16T10:30Z", - L"'At' time{HH:MM Z} 'on' date{MMM DD, YYYY}", - L"At 10:30 GMT on Jul 16, 1999"}, - {L"en", L"1999-07-16T10:30Z", - L"time{'At' HH:MM Z} date{'on' MMM DD, YYYY}", - L"At 10:30 GMT on Jul 16, 1999"}, - {L"en", L"1999-07-16T10:30Z", - L"time{'At 'HH:MM Z}date{' on 'MMM DD, YYYY}", - L"At 10:30 GMT on Jul 16, 1999"}}; + } tests[] = { + {L"en", L"1999-07-16T10:30Z", + L"'At' time{HH:MM Z} 'on' date{MMM DD, YYYY}", + L"At 10:30 GMT on Jul 16, 1999"}, + {L"en", L"1999-07-16T10:30", L"'At' time{HH:MM} 'on' date{MMM DD, YYYY}", + L"At 10:30 on Jul 16, 1999"}, + {L"en", L"1999-07-16T10:30Z", + L"time{'At' HH:MM Z} date{'on' MMM DD, YYYY}", + L"At 10:30 GMT on Jul 16, 1999"}, + {L"en", L"1999-07-16T10:30Z", + L"time{'At 'HH:MM Z}date{' on 'MMM DD, YYYY}", + L"At 10:30 GMT on Jul 16, 1999"}}; for (size_t i = 0; i < FX_ArraySize(tests); ++i) { CFX_WideString result; -- cgit v1.2.3