From deb4687d5d1d02b631a7c7705a07e9141bd80630 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 14 Feb 2015 05:38:53 +0100 Subject: [PATCH] fix testPathIsWithin unit-test: * use absolute path * fix copy/paste typo: bar->jim for symlink test --- libs/pbd/test/filesystem_test.cc | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/libs/pbd/test/filesystem_test.cc b/libs/pbd/test/filesystem_test.cc index 53ad08196d..2c2de94d02 100644 --- a/libs/pbd/test/filesystem_test.cc +++ b/libs/pbd/test/filesystem_test.cc @@ -52,24 +52,24 @@ FilesystemTest::testPathIsWithin () CPPUNIT_ASSERT (g_mkdir_with_parents ("foo/bar/baz", 0755) == 0); - CPPUNIT_ASSERT (PBD::path_is_within ("foo/bar/baz", "foo/bar/baz")); - CPPUNIT_ASSERT (PBD::path_is_within ("foo/bar", "foo/bar/baz")); - CPPUNIT_ASSERT (PBD::path_is_within ("foo", "foo/bar/baz")); - CPPUNIT_ASSERT (PBD::path_is_within ("foo/bar", "foo/bar/baz")); - CPPUNIT_ASSERT (PBD::path_is_within ("foo/bar", "foo/bar")); + CPPUNIT_ASSERT (PBD::path_is_within (Glib::build_filename(output_path, "foo/bar/baz"), Glib::build_filename(output_path, "foo/bar/baz"))); + CPPUNIT_ASSERT (PBD::path_is_within (Glib::build_filename(output_path, "foo/bar"), Glib::build_filename(output_path, "foo/bar/baz"))); + CPPUNIT_ASSERT (PBD::path_is_within (Glib::build_filename(output_path, "foo"), Glib::build_filename(output_path, "foo/bar/baz"))); + CPPUNIT_ASSERT (PBD::path_is_within (Glib::build_filename(output_path, "foo/bar"), Glib::build_filename(output_path, "foo/bar/baz"))); + CPPUNIT_ASSERT (PBD::path_is_within (Glib::build_filename(output_path, "foo/bar"), Glib::build_filename(output_path, "foo/bar"))); - CPPUNIT_ASSERT (PBD::path_is_within ("foo/bar/baz", "frobozz") == false); + CPPUNIT_ASSERT (PBD::path_is_within (Glib::build_filename(output_path, "foo/bar/baz"), Glib::build_filename(output_path, "frobozz")) == false); int const r = symlink ("bar", "foo/jim"); CPPUNIT_ASSERT (r == 0); - CPPUNIT_ASSERT (PBD::path_is_within ("foo/bar/baz", "foo/bar/baz")); - CPPUNIT_ASSERT (PBD::path_is_within ("foo/bar", "foo/bar/baz")); - CPPUNIT_ASSERT (PBD::path_is_within ("foo", "foo/bar/baz")); - CPPUNIT_ASSERT (PBD::path_is_within ("foo/bar", "foo/bar/baz")); - CPPUNIT_ASSERT (PBD::path_is_within ("foo/bar", "foo/bar")); + CPPUNIT_ASSERT (PBD::path_is_within (Glib::build_filename(output_path, "foo/jim/baz"), Glib::build_filename(output_path, "foo/bar/baz"))); + CPPUNIT_ASSERT (PBD::path_is_within (Glib::build_filename(output_path, "foo/jim"), Glib::build_filename(output_path, "foo/bar/baz"))); + CPPUNIT_ASSERT (PBD::path_is_within (Glib::build_filename(output_path, "foo"), Glib::build_filename(output_path, "foo/bar/baz"))); + CPPUNIT_ASSERT (PBD::path_is_within (Glib::build_filename(output_path, "foo/jim"), Glib::build_filename(output_path, "foo/bar/baz"))); + CPPUNIT_ASSERT (PBD::path_is_within (Glib::build_filename(output_path, "foo/jim"), Glib::build_filename(output_path, "foo/bar"))); - CPPUNIT_ASSERT (PBD::path_is_within ("foo/jim/baz", "frobozz") == false); + CPPUNIT_ASSERT (PBD::path_is_within (Glib::build_filename(output_path, "foo/jim/baz"), Glib::build_filename(output_path, "frobozz")) == false); #endif }