Opened 12 years ago

#5317 new Bugs

Path filename(), stem(), and extension() problems

Reported by: Beman Dawes Owned by: Beman Dawes
Milestone: To Be Determined Component: filesystem
Version: Boost 1.46.0 Severity: Problem
Keywords: Cc:

Description

Problem: filename() is specified in terms of *--end(), but path_test.cpp does not actually test this. Since the actual implementation of filename() does not use iteration, such a test should be performed.

Resolution: Add something like BOOST_TEST_EQ(p.filename(), *--p.end()); to the decomposition tests.

Problem: stem() + extension() should == filename(), but path_test.cpp does not actually test this.

Resolution: Add something like BOOST_TEST_EQ(p.filename(), path(p.stem().native() + p.extension().native()));); to the decomposition tests.

Problem: path(".foo") should be a stem, not an extension.

Resolution: Fix specification, implementation, and add test cases.

Problem: Design of Path iterator, and as a consequence, filename(), is too inventive in adding "." KISS. Note that POSIX has similar problems. POSIX dirname() and basename() are not good models; they (1) modify their arguments, and (2) return counter-intuitive results. basename("/foo/") returns "foo", not "" or "."

Resolution: Simplify specification, change implementation and test cases accordingly.

Change History (0)

Note: See TracTickets for help on using tickets.