From 24c40c0e88ce25d79608c09b7dbc6b63009dab24 Mon Sep 17 00:00:00 2001 From: Tim Mayberry Date: Tue, 24 Jun 2014 21:27:37 +1000 Subject: [PATCH] Add simple test for PBD::find_files_matching_pattern This helped fix a silly cut and paste error in pbd/file_utils.cc so might as well included it. --- libs/pbd/test/filesystem_test.cc | 12 ++++++++++++ libs/pbd/test/filesystem_test.h | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/libs/pbd/test/filesystem_test.cc b/libs/pbd/test/filesystem_test.cc index 8fe5afab21..e30aa2b1af 100644 --- a/libs/pbd/test/filesystem_test.cc +++ b/libs/pbd/test/filesystem_test.cc @@ -84,3 +84,15 @@ FilesystemTest::testCopyFileUTF8Filename () CPPUNIT_ASSERT (PBD::copy_file (input_path, output_path)); } } + +void +FilesystemTest::testFindFilesMatchingPattern () +{ + vector patch_files; + + PBD::find_files_matching_pattern (patch_files, test_search_path (), "*PatchFile*"); + + CPPUNIT_ASSERT(test_search_path ().size() == 1); + + CPPUNIT_ASSERT(patch_files.size() == 2); +} diff --git a/libs/pbd/test/filesystem_test.h b/libs/pbd/test/filesystem_test.h index a8b3968f3a..588e731af2 100644 --- a/libs/pbd/test/filesystem_test.h +++ b/libs/pbd/test/filesystem_test.h @@ -7,12 +7,13 @@ class FilesystemTest : public CppUnit::TestFixture CPPUNIT_TEST (testPathIsWithin); CPPUNIT_TEST (testCopyFileASCIIFilename); CPPUNIT_TEST (testCopyFileUTF8Filename); + CPPUNIT_TEST (testFindFilesMatchingPattern); CPPUNIT_TEST_SUITE_END (); public: void testPathIsWithin (); void testCopyFileASCIIFilename (); void testCopyFileUTF8Filename (); - + void testFindFilesMatchingPattern (); };