13
0

fix testPathIsWithin unit-test:

* use absolute path
* fix copy/paste typo: bar->jim for symlink test
This commit is contained in:
Robin Gareus 2015-02-14 05:38:53 +01:00
parent 7f0cdc3967
commit deb4687d5d

View File

@ -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
}