mirror of
https://github.com/NixOS/nix
synced 2025-07-07 14:21:48 +02:00
CanonPath, SourcePath: Change operator + to /
This is less confusing and makes it more similar to std::filesystem::path.
This commit is contained in:
parent
6ec08b85f6
commit
a6737b7e17
23 changed files with 48 additions and 47 deletions
|
@ -80,29 +80,29 @@ namespace nix {
|
|||
{
|
||||
CanonPath p1("a//foo/bar//");
|
||||
CanonPath p2("xyzzy/bla");
|
||||
ASSERT_EQ((p1 + p2).abs(), "/a/foo/bar/xyzzy/bla");
|
||||
ASSERT_EQ((p1 / p2).abs(), "/a/foo/bar/xyzzy/bla");
|
||||
}
|
||||
|
||||
{
|
||||
CanonPath p1("/");
|
||||
CanonPath p2("/a/b");
|
||||
ASSERT_EQ((p1 + p2).abs(), "/a/b");
|
||||
ASSERT_EQ((p1 / p2).abs(), "/a/b");
|
||||
}
|
||||
|
||||
{
|
||||
CanonPath p1("/a/b");
|
||||
CanonPath p2("/");
|
||||
ASSERT_EQ((p1 + p2).abs(), "/a/b");
|
||||
ASSERT_EQ((p1 / p2).abs(), "/a/b");
|
||||
}
|
||||
|
||||
{
|
||||
CanonPath p("/foo/bar");
|
||||
ASSERT_EQ((p + "x").abs(), "/foo/bar/x");
|
||||
ASSERT_EQ((p / "x").abs(), "/foo/bar/x");
|
||||
}
|
||||
|
||||
{
|
||||
CanonPath p("/");
|
||||
ASSERT_EQ((p + "foo" + "bar").abs(), "/foo/bar");
|
||||
ASSERT_EQ((p / "foo" / "bar").abs(), "/foo/bar");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue