Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust
Rust ai-agentsai-toolsbrowserbrowser-automationcloud-browserheadlessheadless-browserkitesurfplaywrightpuppeteerrustservoweb-crawlerweb-crawlingweb-scraperweb-scraping
fix(xpath): apply a single leading minus sign
Iainafc28fc39414
diff --git a/moli-xpath/src/parser.rs b/moli-xpath/src/parser.rsindex d4acd5040..d56d8f63e 100644--- a/moli-xpath/src/parser.rs+++ b/moli-xpath/src/parser.rs@@ -138,7 +138,7 @@ whereresult = self.parse_union_expression()?;- if negations > 1 {+ if negations > 0 {if negations % 2 == 0 {result = Expression::Function(CoreFunction::Number(Some(Box::new(result))))} else {@@ -829,4 +829,15 @@ mod tests {Err(e) => panic!("Failed to parse '{}': {:?}", test_case, e),}}++ #[test]+ fn parse_single_unary_minus() {+ let expected = Expression::Negate(Box::new(Expression::Literal(Literal::Decimal(1.5))));+ match parse("-1.5", Some(DummyNamespaceResolver), true) {+ Ok(result) => {+ assert_eq!(result, expected, "{:?} was parsed incorrectly", "-1.5");+ }+ Err(e) => panic!("Failed to parse '{}': {:?}", "-1.5", e),+ }+ }}