Skip to content

Commit

Permalink
I think that the test is in error (#810)
Browse files Browse the repository at this point in the history
  • Loading branch information
lemire authored and anonrig committed Jan 8, 2025
1 parent 6b4104b commit e16ef1d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
6 changes: 3 additions & 3 deletions include/ada/url_pattern_helpers-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ inline void Tokenizer::get_next_code_point() {
ada_log("Tokenizer::get_next_code_point returning ASCII code point=",
uint32_t(code_point));
ada_log("Tokenizer::get_next_code_point next_index =", next_index,
" input.size() =", input.size());
" input.size()=", input.size());
return;
}
ada_log("Tokenizer::get_next_code_point read first byte=",
Expand All @@ -339,7 +339,7 @@ inline void Tokenizer::get_next_code_point() {
number_bytes = 4;
ada_log("Tokenizer::get_next_code_point four bytes");
}
ADA_ASSERT_TRUE(number_bytes + next_index < input.size());
ADA_ASSERT_TRUE(number_bytes + next_index <= input.size());

for (size_t i = 1 + next_index; i < number_bytes + next_index; ++i) {
unsigned char byte = input[i];
Expand All @@ -349,7 +349,7 @@ inline void Tokenizer::get_next_code_point() {
ada_log("Tokenizer::get_next_code_point returning non-ASCII code point=",
uint32_t(code_point));
ada_log("Tokenizer::get_next_code_point next_index =", next_index,
" input.size() =", input.size());
" input.size()=", input.size());
next_index += number_bytes;
}

Expand Down
6 changes: 6 additions & 0 deletions src/url_pattern_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ namespace ada::url_pattern_helpers {

inline std::optional<url_pattern_errors>
constructor_string_parser::compute_protocol_matches_special_scheme_flag() {
ada_log(
"constructor_string_parser::compute_protocol_matches_special_scheme_"
"flag");
// Let protocol string be the result of running make a component string given
// parser.
auto protocol_string = make_component_string();
Expand All @@ -18,6 +21,8 @@ constructor_string_parser::compute_protocol_matches_special_scheme_flag() {
protocol_string, canonicalize_protocol,
url_pattern_compile_component_options::DEFAULT);
if (!protocol_component) {
ada_log("url_pattern_component::compile failed for protocol_string ",
protocol_string);
return protocol_component.error();
}
// If the result of running protocol component matches a special scheme given
Expand Down Expand Up @@ -348,6 +353,7 @@ constructor_string_parser::parse(std::string_view input) {
// Run compute protocol matches a special scheme flag given parser.
if (const auto error =
parser.compute_protocol_matches_special_scheme_flag()) {
ada_log("compute_protocol_matches_special_scheme_flag failed");
return tl::unexpected(*error);
}
// Let next state be "pathname".
Expand Down
2 changes: 1 addition & 1 deletion tests/wpt_urlpattern_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ TEST(wpt_urlpattern_tests, urlpattern_test_data) {

if (!main_object["expected_obj"].get_string().get(expected_obj) &&
expected_obj == "error") {
if (parse_result.has_value()) {
if (parse_result.value().has_value()) {
main_object.reset();
FAIL() << "Test should have failed but it didn't" << std::endl
<< main_object.raw_json().value() << std::endl;
Expand Down

0 comments on commit e16ef1d

Please sign in to comment.