OutpostUniverse / OP2Utility

C++ library for working with Outpost 2 related files and tasks.
MIT License
4 stars 0 forks source link

XFile::Append unit test failure #340

Open DanRStevens opened 3 years ago

DanRStevens commented 3 years ago

Unit tests for XFile::Append are failing on Ubuntu 20.04, with both GCC and Clang:

[ RUN ] XFile.Append test/XFile.test.cpp:39: Failure Expected equality of these values: "a/b/" XFile::Append("a/", "b/") Which is: "a/b/." test/XFile.test.cpp:40: Failure Expected equality of these values: "/a/b/" XFile::Append("/a/", "b/") Which is: "/a/b/." test/XFile.test.cpp:42: Failure Expected equality of these values: "C:a/b/" XFile::Append("C:a/", "b/") Which is: "C:a/b/." test/XFile.test.cpp:43: Failure Expected equality of these values: "C:/a/b/" XFile::Append("C:/a/", "b/") Which is: "C:/a/b/." [ FAILED ] XFile.Append (0 ms)

It seems that paths representing folders are marked with a . for the final component, rather than ending with /. This looks odd and may be unexpected. It's also inconsistent with behaviour on Windows, where paths do end with a /. Perhaps we should look at special casing this to ensure paths representing a folder end with /.

As a potential workaround for unit test failures, we can update the unit tests to use paths with filenames. That will avoid triggering the inconsistent behavior. It's not really a solution though, since it ignores the problem case, leaving it untested. Effectively we can hold off on defining how the problem case should be resolved.