Commit Graph

6 Commits

Author SHA1 Message Date
Edward Thomson
ed39bcee40 fs: improved executable-in-path location tests
Ensure that our `find_executable` behaves as expected:

* When the executable contains a fully- or partially-qualified filename
  component (eg, `foo/bar`) that `PATH` is not searched; these paths are
  relative to the current working directory.
* An empty segment in `PATH` (on POSIX systems) is treated as the
  current directory; this is for compatibility with Bourne shells.
* When a file exists in `PATH`, it is actually executable (on POSIX)
2025-11-29 12:50:44 +00:00
Edward Thomson
57870e9f4d util: clean up test resources in the sandbox
Ensure that we clean up cruft that we create for testing, so that future
tests don't have troubles.
2024-02-19 09:06:57 -08:00
Edward Thomson
bdf4d70a13 util: update win32 p_realpath to canonicalize case
The POSIX `realpath` function canonicalizes relative paths, symbolic links,
and case (on case-insensitive filesystems). For example, on macOS, if you
create some file `/private/tmp/FOO`, and you call `realpath("/tmp/foo")`,
you get _the real path_ returned of `/private/tmp/FOO`.

To emulate this behavior on win32, we call `GetFullPathName` to handle the
relative to absolute path conversion, then call `GetLongPathName` to handle
the case canonicalization.
2024-02-19 09:06:57 -08:00
Edward Thomson
f43aa1adb5 util: move path tests to path::core
Clar handles multiple levels of hierarchy in a test name _but_ it does so
assuming that there are not tests at a parent folder level. In other words,
if you have some tests at path/core.c and path/win32.c, then you cannot have
tests in path.c. If you have tests in path.c, then the things in path/*.c
will be ignored.

Move the tests in path.c into path/core.c.
2024-02-19 16:41:31 +00:00
Edward Thomson
beea99b082 path: provide an is_root helper method
We may quickly want to determine if the given path is the root path
('/') on POSIX, or the root of a drive letter (eg, 'A:/', 'C:\') on
Windows.
2024-02-19 16:41:31 +00:00
Edward Thomson
e6d93612e8 refactor: move utility tests into util 2022-02-22 22:07:45 -05:00