Fix #10742: withExtension should support ranges with mutable properties (#10737)

This commit is contained in:
Artha 2025-04-06 22:25:01 +02:00 committed by GitHub
parent 393d8264bb
commit 39663ea8fe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -992,7 +992,7 @@ private auto _stripDrive(R)(R path)
Returns:
index of extension separator (the dot), or -1 if not found
*/
private ptrdiff_t extSeparatorPos(R)(const R path)
private ptrdiff_t extSeparatorPos(R)(R path)
if (isRandomAccessRange!R && hasLength!R && isSomeChar!(ElementType!R) ||
isNarrowString!R)
{
@ -1280,6 +1280,11 @@ if (isSomeChar!C1 && isSomeChar!C2)
assert(withExtension("file.ext"w.byWchar, ".").array == "file."w);
}
@safe unittest
{
assert(chainPath("directory", "file").withExtension(".ext").array == buildPath("directory", "file.ext"));
}
@safe unittest
{
import std.algorithm.comparison : equal;