Files
Stephen Kitt 5e6ecd6e44 hostpath: use tests with real files where possible
The setup and teardown functions intended for TestOSFileTypeChecker
suggest that it was intended to use real files where possible, but it
doesn't (or no longer does). This reworks the test function to use a
temporary directory and real files for all appropriate tests (based on
directories and files), and adds scenarios to cover the various code
paths in the checkType().

The resulting coverage includes all the code covered by
TestHostPathTypeCheckerInternal, so the latter can be dropped, which
allows checkType() to be simplified and the whole hostPathTypeChecker
interface and implementations to be dropped. Type checks all end up
comparing strings returned by HostUtils, so the IsDir(), IsFile()
etc. functions are also dropped in favour of direct type comparisons.

Overall hostpath test coverage increases from 65.8% to 68.1%, on fewer
lines of code.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
2026-09-01 16:13:30 +02:00
..
2024-12-02 16:59:34 +01:00