leptris 1.9.231.1-arm-linux → 1.9.232.0-arm-linux
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +19 -0
- data/Rakefile +1 -1
- data/ext/leptris/native/native.c +35 -4
- data/lib/leptris/version.rb +1 -1
- data/lib/leptris/xml/ffi.rb +4 -0
- data/lib/leptris/xml/native.so +0 -0
- data/lib/leptris/xml/node.rb +28 -0
- data/lib/libleptris.so +0 -0
- data/vendor-src/README.md +1 -1
- data/vendor-src/libleptris/CHANGELOG.md +15 -0
- data/vendor-src/libleptris/CMakeLists.txt +1 -1
- data/vendor-src/libleptris/src/include/leptris/descriptor.h +5 -1
- data/vendor-src/libleptris/src/include/leptris.h +17 -0
- data/vendor-src/libleptris/src/leptris/descriptor/plan.c +26 -6
- data/vendor-src/libleptris/src/leptris/dom/node.c +24 -7
- data/vendor-src/libleptris/src/leptris/xpath/evaluator_operators.c +22 -8
- data/vendor-src/libleptris/src/leptris/xpath/functions.c +29 -8
- data/vendor-src/libleptris/src/leptris/xpath/functions_ext31.c +30 -1
- data/vendor-src/libleptris/src/leptris/xpath/parser.c +106 -6
- data/vendor-src/libleptris/test/abi/test_descriptor.cpp +68 -0
- data/vendor-src/libleptris/test/dom/test_dom.cpp +56 -0
- data/vendor-src/libleptris/test/xquery/qt3/fn/codepoints-to-string.xml +808 -0
- data/vendor-src/libleptris/test/xquery/qt3/fn/deep-equal.xml +2709 -0
- data/vendor-src/libleptris/test/xquery/qt3/fn/distinct-values.xml +1223 -0
- data/vendor-src/libleptris/test/xquery/qt3/fn/index-of.xml +493 -0
- data/vendor-src/libleptris/test/xquery/qt3/fn/insert-before.xml +399 -0
- data/vendor-src/libleptris/test/xquery/qt3/fn/remove.xml +480 -0
- data/vendor-src/libleptris/test/xquery/qt3/fn/reverse.xml +653 -0
- data/vendor-src/libleptris/test/xquery/qt3/fn/string-to-codepoints.xml +452 -0
- data/vendor-src/libleptris/test/xquery/qt3/fn/subsequence.xml +1041 -0
- data/vendor-src/libleptris/test/xquery/test_qt3.cpp +179 -1
- data/vendor-src/libleptris/test/xquery/test_xquery.cpp +27 -0
- data/vendor-src/libleptris/vcpkg.json +1 -1
- metadata +11 -2
|
@@ -386,6 +386,74 @@ TEST(PlanWalk, NamespaceFormsAndLeniency) {
|
|
|
386
386
|
leptris_document_free(doc);
|
|
387
387
|
}
|
|
388
388
|
|
|
389
|
+
/* XSD-002 fallout class: child rows whose wire_name is the PREFIXED
|
|
390
|
+
* form ("w:b") — exactly what the ABI doc promises ("XML element
|
|
391
|
+
* name as it appears on the wire") — must bind namespaced elements.
|
|
392
|
+
* The matcher historically compared the LOCAL name only, so every
|
|
393
|
+
* prefixed row silently matched nothing: hosts hydrated empty
|
|
394
|
+
* subtrees (attributes read NULL, elements fell back to defaults)
|
|
395
|
+
* and re-serialized without them. Local-name rows keep binding. */
|
|
396
|
+
TEST(PlanWalk, PrefixedWireNamesBindNamespacedElements) {
|
|
397
|
+
LeptrisDocument doc = parse(
|
|
398
|
+
"<w:document xmlns:w=\"urn:w\">"
|
|
399
|
+
"<w:r><w:b w:val=\"false\"/></w:r>"
|
|
400
|
+
"</w:document>");
|
|
401
|
+
ASSERT_NE(doc, nullptr);
|
|
402
|
+
LeptrisElement root = leptris_document_root(doc);
|
|
403
|
+
|
|
404
|
+
leptris_attr_plan b_attrs[] = {
|
|
405
|
+
{"w:val", LEPTRIS_PLAN_KIND_SCALAR, 7, 0, 0, nullptr},
|
|
406
|
+
};
|
|
407
|
+
leptris_child_plan b_row = {};
|
|
408
|
+
b_row.wire_name = "w:b";
|
|
409
|
+
b_row.kind = LEPTRIS_PLAN_KIND_NESTED;
|
|
410
|
+
b_row.child_plan_index = 2;
|
|
411
|
+
b_row.ns_form = LEPTRIS_PLAN_NS_ANY;
|
|
412
|
+
leptris_child_plan r_row = {};
|
|
413
|
+
r_row.wire_name = "w:r";
|
|
414
|
+
r_row.kind = LEPTRIS_PLAN_KIND_NESTED;
|
|
415
|
+
r_row.child_plan_index = 1;
|
|
416
|
+
r_row.ns_form = LEPTRIS_PLAN_NS_ANY;
|
|
417
|
+
leptris_element_plan plans[3] = {};
|
|
418
|
+
plans[0].element_name = "document";
|
|
419
|
+
plans[0].ns_form = LEPTRIS_PLAN_NS_ANY;
|
|
420
|
+
plans[0].child_count = 1;
|
|
421
|
+
plans[0].child_plans = &r_row;
|
|
422
|
+
plans[1].element_name = "r";
|
|
423
|
+
plans[1].ns_form = LEPTRIS_PLAN_NS_ANY;
|
|
424
|
+
plans[1].child_count = 1;
|
|
425
|
+
plans[1].child_plans = &b_row;
|
|
426
|
+
plans[2].element_name = "b";
|
|
427
|
+
plans[2].ns_form = LEPTRIS_PLAN_NS_ANY;
|
|
428
|
+
plans[2].attribute_count = 1;
|
|
429
|
+
plans[2].attribute_plans = b_attrs;
|
|
430
|
+
|
|
431
|
+
leptris_plan_spec spec = {};
|
|
432
|
+
spec.abi_version = leptris_plan_abi_version();
|
|
433
|
+
spec.plan_count = 3;
|
|
434
|
+
spec.plans = plans;
|
|
435
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
436
|
+
LeptrisPlan plan = leptris_plan_build(&spec, &st);
|
|
437
|
+
ASSERT_NE(plan, nullptr);
|
|
438
|
+
LeptrisPlanResult r = leptris_plan_walk(doc, root, plan, &st);
|
|
439
|
+
ASSERT_NE(r, nullptr);
|
|
440
|
+
ASSERT_EQ(leptris_plan_value_count(r), 1u);
|
|
441
|
+
LeptrisPlanResult rcoll = leptris_plan_value_at(r, 0);
|
|
442
|
+
ASSERT_NE(rcoll, nullptr);
|
|
443
|
+
/* the nested w:r row binds its element value */
|
|
444
|
+
ASSERT_EQ(leptris_plan_value_kind(rcoll), LEPTRIS_PLAN_VALUE_ELEMENT);
|
|
445
|
+
ASSERT_EQ(leptris_plan_value_count(rcoll), 1u);
|
|
446
|
+
LeptrisPlanResult bval = leptris_plan_value_at(rcoll, 0);
|
|
447
|
+
ASSERT_NE(bval, nullptr);
|
|
448
|
+
ASSERT_EQ(leptris_plan_value_kind(bval), LEPTRIS_PLAN_VALUE_ELEMENT);
|
|
449
|
+
const char* val = leptris_plan_value_attribute(bval, "w:val");
|
|
450
|
+
ASSERT_NE(val, nullptr);
|
|
451
|
+
EXPECT_STREQ(val, "false");
|
|
452
|
+
leptris_plan_result_free(r);
|
|
453
|
+
leptris_plan_free(plan);
|
|
454
|
+
leptris_document_free(doc);
|
|
455
|
+
}
|
|
456
|
+
|
|
389
457
|
TEST(PlanBuild, CopiesTheSpecStrings) {
|
|
390
458
|
LeptrisDocument doc = parse("<doc><t>v</t></doc>");
|
|
391
459
|
ASSERT_NE(doc, nullptr);
|
|
@@ -2234,6 +2234,62 @@ TEST(DomBasics, NodeVisitWalksSubtreeEnterLeave) {
|
|
|
2234
2234
|
leptris_document_free(doc);
|
|
2235
2235
|
}
|
|
2236
2236
|
|
|
2237
|
+
/* Issue #1332: entering-only visit mode — one callback per node, on
|
|
2238
|
+
* entering. Halves the C-callback invocations for consumers that
|
|
2239
|
+
* discard the leaving half (family walks bind lazily on enter).
|
|
2240
|
+
* Same walk order and depths as leptris_node_visit. */
|
|
2241
|
+
TEST(DomBasics, NodeVisitEnteringFiresOncePerNode) {
|
|
2242
|
+
const char xml[] = "<r><a>t1</a><b><!--c--></b></r>";
|
|
2243
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
2244
|
+
LeptrisDocument doc = leptris_parse_string(xml, std::strlen(xml), &st);
|
|
2245
|
+
ASSERT_NE(doc, nullptr);
|
|
2246
|
+
LeptrisElement root = leptris_document_root(doc);
|
|
2247
|
+
ASSERT_NE(root, nullptr);
|
|
2248
|
+
|
|
2249
|
+
VisitLog log;
|
|
2250
|
+
leptris_node_visit_entering((LeptrisNodeRef)root, &VisitLog::visit,
|
|
2251
|
+
&log);
|
|
2252
|
+
/* 5 nodes (r, a, text, b, comment) — the 3 leaving events of
|
|
2253
|
+
* the full mode are gone. The event list has no L* entries. */
|
|
2254
|
+
ASSERT_EQ(log.events.size(), 5u);
|
|
2255
|
+
EXPECT_EQ(log.events[0], "Er:0");
|
|
2256
|
+
EXPECT_EQ(log.events[1], "Ea:1");
|
|
2257
|
+
EXPECT_EQ(log.events[2], "T:2");
|
|
2258
|
+
EXPECT_EQ(log.events[3], "Eb:1");
|
|
2259
|
+
EXPECT_EQ(log.events[4], "O:2");
|
|
2260
|
+
|
|
2261
|
+
/* Document-node walk behaves identically to the full mode. */
|
|
2262
|
+
VisitLog dlog;
|
|
2263
|
+
leptris_node_visit_entering(leptris_document_node(doc),
|
|
2264
|
+
&VisitLog::visit, &dlog);
|
|
2265
|
+
ASSERT_EQ(dlog.events.size(), 5u);
|
|
2266
|
+
EXPECT_EQ(dlog.events[0], "Er:0");
|
|
2267
|
+
leptris_document_free(doc);
|
|
2268
|
+
}
|
|
2269
|
+
|
|
2270
|
+
TEST(DomBasics, NodeVisitEnteringHalvesTheCallbackCount) {
|
|
2271
|
+
/* The moxml-walk contract (#1332): elements visit TWICE in the
|
|
2272
|
+
* full mode, ONCE here. */
|
|
2273
|
+
const char xml[] =
|
|
2274
|
+
"<r><a><b/><c><d/></c></a><e/><f><g><h/></g></f></r>";
|
|
2275
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
2276
|
+
LeptrisDocument doc = leptris_parse_string(xml, std::strlen(xml), &st);
|
|
2277
|
+
ASSERT_NE(doc, nullptr);
|
|
2278
|
+
|
|
2279
|
+
int full_calls = 0, entering_calls = 0;
|
|
2280
|
+
auto counter = +[](void* ud, LeptrisNodeRef, int, int) {
|
|
2281
|
+
++*static_cast<int*>(ud);
|
|
2282
|
+
};
|
|
2283
|
+
leptris_node_visit((LeptrisNodeRef)leptris_document_root(doc),
|
|
2284
|
+
counter, &full_calls);
|
|
2285
|
+
leptris_node_visit_entering(
|
|
2286
|
+
(LeptrisNodeRef)leptris_document_root(doc), counter,
|
|
2287
|
+
&entering_calls);
|
|
2288
|
+
EXPECT_EQ(full_calls, 18); /* 9 elements * 2 */
|
|
2289
|
+
EXPECT_EQ(entering_calls, 9); /* 9 elements, once */
|
|
2290
|
+
leptris_document_free(doc);
|
|
2291
|
+
}
|
|
2292
|
+
|
|
2237
2293
|
TEST(DomBasics, NodeChildrenExCarriesKinds) {
|
|
2238
2294
|
const char xml[] =
|
|
2239
2295
|
"<r>text<!--c--><a/><?pi x?></r>";
|