@@ -544,6 +544,7 @@ struct slash_test_case {
544
544
};
545
545
546
546
constexpr slash_test_case slashTestCases[] = {
547
+ {L" " sv, L" " sv, L" " sv},
547
548
{L" relative" sv, L" other" sv, LR"( relative\other)" sv},
548
549
{L" //server" sv, L" share" sv, LR"( //server\share)" sv},
549
550
{L" //server/" sv, L" share" sv, LR"( //server/share)" sv},
@@ -555,6 +556,7 @@ constexpr slash_test_case slashTestCases[] = {
555
556
{L" " sv, L" cat" sv, L" cat" sv},
556
557
{L" ./" sv, L" cat" sv, L" ./cat" sv}, // original test case catching a bug in the above
557
558
{L" c:" sv, L" " sv, L" c:" sv},
559
+ {L" c:" sv, L" dog" sv, L" c:dog" sv},
558
560
{L" c:cat" sv, L" /dog" sv, L" c:/dog" sv},
559
561
{L" c:/cat" sv, L" /dog" sv, L" c:/dog" sv},
560
562
{L" c:cat" sv, L" c:dog" sv, LR"( c:cat\dog)" sv},
@@ -568,13 +570,23 @@ constexpr slash_test_case slashTestCases[] = {
568
570
bool run_slash_test_case (const slash_test_case& testCase) {
569
571
path p (testCase.a );
570
572
p /= testCase.b ;
571
- if (p.native () == testCase.expected ) {
572
- return true ;
573
+
574
+ if (p.native () != testCase.expected ) {
575
+ wcerr << L" With operator/=, expected " << testCase.a << L" / " << testCase.b << L" to be " << testCase.expected
576
+ << L" but it was " << p.native () << L" \n " ;
577
+ return false ;
573
578
}
574
579
575
- wcerr << L" Expected " << testCase.a << L" / " << testCase.b << L" to be " << testCase.expected << L" but it was "
576
- << p.native () << L" \n " ;
577
- return false ;
580
+ // Also test operator/, which was optimized by GH-4136.
581
+ p = path{testCase.a } / path{testCase.b };
582
+
583
+ if (p.native () != testCase.expected ) {
584
+ wcerr << L" With operator/, expected " << testCase.a << L" / " << testCase.b << L" to be " << testCase.expected
585
+ << L" but it was " << p.native () << L" \n " ;
586
+ return false ;
587
+ }
588
+
589
+ return true ;
578
590
}
579
591
580
592
void test_iterators () {
0 commit comments