nix/tests/unit/libutil
John Ericson d17e1d9737 Purify CanonPath
The core `CanonPath` constructors were using `absPath`, but `absPath` in
some situations does IO which is not appropriate. It turns out that
these constructors avoided those situations, and thus were pure, but it
was far from obvious this was the case.

To remedy the situation, abstract the core algorithm from `canonPath` to
use separately in `CanonPath` without any IO. No we know by-construction
that those constructors are pure.

That leaves `CanonPath::fromCWD` as the only operation which uses IO /
is impure. Add docs on it, and `CanonPath` as a whole, explaining the
situation.

This is also necessary to support Windows paths on windows without
messing up `CanonPath`. But, I think it is good even without that.

Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2024-02-16 09:47:25 -05:00
..
data/git Move tests to separate directories, and document 2023-12-01 10:48:58 -05:00
args.cc Move tests to separate directories, and document 2023-12-01 10:48:58 -05:00
canon-path.cc Purify CanonPath 2024-02-16 09:47:25 -05:00
chunked-vector.cc Move tests to separate directories, and document 2023-12-01 10:48:58 -05:00
closure.cc Move tests to separate directories, and document 2023-12-01 10:48:58 -05:00
compression.cc Move tests to separate directories, and document 2023-12-01 10:48:58 -05:00
config.cc Move tests to separate directories, and document 2023-12-01 10:48:58 -05:00
file-content-address.cc Proper parse and render functions for FileIngestionMethod and ContentAddressMethod 2024-02-13 10:30:16 -05:00
git.cc Improve the FileSystemObjectSink interface 2024-01-22 18:01:21 -05:00
hash.cc Renamed HashFormat::Base32 to HashFormat::Nix32 2023-12-06 23:43:42 +01:00
hilite.cc Move tests to separate directories, and document 2023-12-01 10:48:58 -05:00
json-utils.cc Move tests to separate directories, and document 2023-12-01 10:48:58 -05:00
local.mk Move tests to separate directories, and document 2023-12-01 10:48:58 -05:00
logging.cc Rename hintfmt to HintFmt 2024-02-08 11:58:25 -08:00
lru-cache.cc Move tests to separate directories, and document 2023-12-01 10:48:58 -05:00
pool.cc Move tests to separate directories, and document 2023-12-01 10:48:58 -05:00
references.cc Move tests to separate directories, and document 2023-12-01 10:48:58 -05:00
suggestions.cc Move tests to separate directories, and document 2023-12-01 10:48:58 -05:00
tests.cc Move tests to separate directories, and document 2023-12-01 10:48:58 -05:00
url.cc isValidSchemeName: Use regex 2023-12-12 17:46:34 +01:00
xml-writer.cc Move tests to separate directories, and document 2023-12-01 10:48:58 -05:00