Parse spaces between JSONPath selectors

This commit is contained in:
Fabrice Reix 2025-11-29 08:40:12 +01:00 committed by hurl-bot
parent 2d1a37d8e8
commit 26323ecac0
No known key found for this signature in database
GPG Key ID: 1283A2B4A0DCAF8D
3 changed files with 7 additions and 2 deletions

View File

@ -21,6 +21,7 @@ use super::ParseResult;
use crate::jsonpath2::ast::segment::{ChildSegment, DescendantSegment, Segment};
use crate::jsonpath2::ast::selector::{NameSelector, Selector, WildcardSelector};
use crate::jsonpath2::parser::primitives::expect_str;
use crate::jsonpath2::parser::primitives::skip_whitespace;
use crate::jsonpath2::parser::{selectors, ParseError, ParseErrorKind};
use hurl_core::reader::Reader;
@ -99,7 +100,9 @@ fn try_descendant_segment(reader: &mut Reader) -> ParseResult<Option<DescendantS
fn try_bracketed_selection(reader: &mut Reader) -> ParseResult<Option<Vec<Selector>>> {
if match_str("[", reader) {
skip_whitespace(reader);
let selectors = selectors::parse(reader)?;
skip_whitespace(reader);
expect_str("]", reader)?;
Ok(Some(selectors))
} else {

View File

@ -22,7 +22,7 @@ use crate::jsonpath2::ast::selector::{
};
use crate::jsonpath2::parser::expr::logical_or_expr;
use crate::jsonpath2::parser::literal::{try_integer, try_string_literal};
use crate::jsonpath2::parser::primitives::match_str;
use crate::jsonpath2::parser::primitives::{match_str, skip_whitespace};
use hurl_core::reader::Reader;
use super::ParseResult;
@ -32,9 +32,11 @@ pub fn parse(reader: &mut Reader) -> ParseResult<Vec<Selector>> {
loop {
let selector = selector(reader)?;
selectors.push(selector);
skip_whitespace(reader);
if !match_str(",", reader) {
break;
}
skip_whitespace(reader);
}
Ok(selectors)
}

View File

@ -273,7 +273,7 @@ fn load_testcases() -> Vec<TestCase> {
fn run() {
let testcases = load_testcases();
// TODO: Remove Limit when spec is fully implemented
let testcases = testcases.iter().take(155);
let testcases = testcases.iter().take(157);
let count_total = testcases.len();
let testcases = testcases.filter(|tc| !IGNORED_TESTS.contains(&tc.name.as_str()));
let count_ignored = count_total - testcases.clone().count();