Skip to content

Commit 01e0571

Browse files
committed
fix: ensure decode_view is complete for pct_string_view::operator*()
fix #937
1 parent 3228399 commit 01e0571

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

include/boost/url/pct_string_view.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,4 +464,7 @@ to_sv(pct_string_view const& s) noexcept
464464
} // urls
465465
} // boost
466466

467+
// Ensure decode_view is complete for operator*()
468+
#include <boost/url/decode_view.hpp>
469+
467470
#endif

test/unit/pct_string_view.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,37 @@ struct pct_string_view_test
133133

134134
}
135135

136+
void
137+
testOperatorStar()
138+
{
139+
// Basic usage
140+
{
141+
pct_string_view psv("Program%20Files");
142+
decode_view dv = *psv;
143+
BOOST_TEST(dv == "Program Files");
144+
}
145+
146+
// Empty string
147+
{
148+
pct_string_view psv("");
149+
decode_view dv = *psv;
150+
BOOST_TEST(dv.empty());
151+
}
152+
153+
// No encoding
154+
{
155+
pct_string_view psv("simple");
156+
decode_view dv = *psv;
157+
BOOST_TEST(dv == "simple");
158+
}
159+
}
160+
136161
void
137162
run()
138163
{
139164
testSpecial();
140165
testRelation();
166+
testOperatorStar();
141167
}
142168
};
143169

0 commit comments

Comments
 (0)