1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #include <sal/config.h>
12 #include <sal/types.h>
13 #include <cppunit/TestAssert.h>
14 #include <cppunit/TestFixture.h>
15 #include <cppunit/extensions/HelperMacros.h>
16 #include <tools/wldcrd.hxx>
20 class Test
: public CppUnit::TestFixture
25 CPPUNIT_TEST_SUITE(Test
);
26 CPPUNIT_TEST(test_Wildcard
);
27 CPPUNIT_TEST_SUITE_END();
30 void Test::test_Wildcard()
32 WildCard
wildcard(u
"*.html;*??a;*\\*abc;*\\?xyz", ';'); // tdf#148253
33 CPPUNIT_ASSERT(wildcard
.Matches(u
"foo.html"));
34 CPPUNIT_ASSERT(wildcard
.Matches(u
"foo.ht.html")); // test stepping back after partial match
35 CPPUNIT_ASSERT(wildcard
.Matches(u
"foo.html.html")); // test stepping back after full match
36 CPPUNIT_ASSERT(wildcard
.Matches(u
"??aa")); // test stepping back with question marks
37 CPPUNIT_ASSERT(wildcard
.Matches(u
"111*abc")); // test escaped asterisk
38 CPPUNIT_ASSERT(!wildcard
.Matches(u
"111-abc")); // test escaped asterisk
39 CPPUNIT_ASSERT(wildcard
.Matches(u
"111?xyz")); // test escaped question mark
40 CPPUNIT_ASSERT(!wildcard
.Matches(u
"111-xyz")); // test escaped question mark
43 CPPUNIT_TEST_SUITE_REGISTRATION(Test
);
46 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */