leptris 1.9.340.0-arm-linux → 1.9.342.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 +31 -0
- data/Rakefile +1 -1
- data/ext/leptris/native/native.c +18 -1
- data/lib/leptris/version.rb +1 -1
- data/lib/leptris/xml/descriptor.rb +39 -3
- data/lib/leptris/xml/element.rb +18 -7
- data/lib/leptris/xml/ffi.rb +20 -0
- data/lib/leptris/xml/native.so +0 -0
- data/lib/leptris/xml/node.rb +22 -0
- data/lib/libleptris.so +0 -0
- data/vendor-src/README.md +1 -1
- data/vendor-src/libleptris/CHANGELOG.md +71 -0
- data/vendor-src/libleptris/CMakeLists.txt +1 -1
- data/vendor-src/libleptris/src/include/leptris/descriptor.h +27 -0
- data/vendor-src/libleptris/src/leptris/descriptor/plan.c +226 -12
- data/vendor-src/libleptris/src/leptris/rng/rng_regex.c +71 -3
- data/vendor-src/libleptris/src/leptris/serialize/serialize.c +38 -0
- data/vendor-src/libleptris/src/leptris/xsd/compile.c +98 -3
- data/vendor-src/libleptris/src/leptris/xsd/datatypes.c +27 -5
- data/vendor-src/libleptris/test/abi/test_descriptor.cpp +120 -0
- data/vendor-src/libleptris/test/dom/test_dom.cpp +77 -0
- data/vendor-src/libleptris/test/serializer/test_serialize.cpp +25 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/import_dag/a1.xsd +5 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/import_dag/a2.xsd +4 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/import_dag/b1.xsd +5 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/import_dag/b2.xsd +4 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/import_dag/s.xsd +3 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/import_dag/w.xsd +5 -0
- data/vendor-src/libleptris/test/xsd/test_xsd_compile.cpp +93 -0
- data/vendor-src/libleptris/vcpkg.json +1 -1
- metadata +8 -2
|
@@ -2231,4 +2231,124 @@ TEST(Plan408, AddChildByAddress) {
|
|
|
2231
2231
|
leptris_document_free(doc);
|
|
2232
2232
|
}
|
|
2233
2233
|
|
|
2234
|
+
/* #425: the ext face — indent on element boundaries, compact
|
|
2235
|
+
* default; the 3-arg face stays byte-identical to before. */
|
|
2236
|
+
TEST(Plan425, SerializeExtIndentsBoundaries) {
|
|
2237
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
2238
|
+
leptris_element_plan plans[2] = {};
|
|
2239
|
+
plans[0].element_name = "r";
|
|
2240
|
+
plans[1].element_name = "a";
|
|
2241
|
+
|
|
2242
|
+
leptris_child_plan kids[2] = {};
|
|
2243
|
+
kids[0].wire_name = "a";
|
|
2244
|
+
kids[0].kind = LEPTRIS_PLAN_KIND_SCALAR;
|
|
2245
|
+
kids[0].child_plan_index = 1;
|
|
2246
|
+
kids[1].wire_name = "b";
|
|
2247
|
+
kids[1].kind = LEPTRIS_PLAN_KIND_SCALAR;
|
|
2248
|
+
|
|
2249
|
+
plans[0].child_count = 2;
|
|
2250
|
+
plans[0].child_plans = kids;
|
|
2251
|
+
|
|
2252
|
+
leptris_plan_spec spec = {};
|
|
2253
|
+
spec.abi_version = leptris_plan_abi_version();
|
|
2254
|
+
spec.plan_count = 2;
|
|
2255
|
+
spec.plans = plans;
|
|
2256
|
+
LeptrisPlan plan = leptris_plan_build(&spec, &st);
|
|
2257
|
+
ASSERT_NE(plan, nullptr);
|
|
2258
|
+
|
|
2259
|
+
leptris_plan_row_op ops[] = {
|
|
2260
|
+
{LEPTRIS_PLAN_OP_ELEMENT, 0, UINT32_MAX, NULL, NULL, 0},
|
|
2261
|
+
{LEPTRIS_PLAN_OP_SCALAR, 0, 0, NULL, "v1", 2},
|
|
2262
|
+
{LEPTRIS_PLAN_OP_SCALAR, 0, 1, NULL, "v2", 2},
|
|
2263
|
+
{LEPTRIS_PLAN_OP_END, 0, 0, NULL, NULL, 0},
|
|
2264
|
+
};
|
|
2265
|
+
LeptrisPlanResult r = leptris_plan_result_build(plan, ops, 4, &st);
|
|
2266
|
+
ASSERT_NE(r, nullptr);
|
|
2267
|
+
|
|
2268
|
+
/* Compact (default) — unchanged shape. */
|
|
2269
|
+
char* compact = leptris_plan_serialize(plan, r, &st);
|
|
2270
|
+
ASSERT_NE(compact, nullptr);
|
|
2271
|
+
EXPECT_STREQ(compact, "<r><a>v1</a><b>v2</b></r>");
|
|
2272
|
+
|
|
2273
|
+
/* Ext: indent=2 — newline+indent before each child open and
|
|
2274
|
+
* before the root close. */
|
|
2275
|
+
leptris_plan_serialize_options opts = {};
|
|
2276
|
+
opts.indent = 2;
|
|
2277
|
+
char* pretty = leptris_plan_serialize_ext(plan, r, &opts,
|
|
2278
|
+
sizeof(opts), &st);
|
|
2279
|
+
ASSERT_NE(pretty, nullptr);
|
|
2280
|
+
EXPECT_STREQ(pretty,
|
|
2281
|
+
"<r>\n <a>v1</a>\n <b>v2</b>\n</r>\n");
|
|
2282
|
+
|
|
2283
|
+
/* Ext with a shorter opts_size than the struct is rejected. */
|
|
2284
|
+
EXPECT_EQ(leptris_plan_serialize_ext(plan, r, &opts, 1, &st),
|
|
2285
|
+
nullptr);
|
|
2286
|
+
|
|
2287
|
+
leptris_free_string(compact);
|
|
2288
|
+
leptris_free_string(pretty);
|
|
2289
|
+
leptris_plan_result_free(r);
|
|
2290
|
+
leptris_plan_free(plan);
|
|
2291
|
+
}
|
|
2292
|
+
|
|
2293
|
+
/* #426: build_result -> native document -> the document writer,
|
|
2294
|
+
* with no string round trip. */
|
|
2295
|
+
TEST(Plan426, FromPlanResultMintsNativeDocument) {
|
|
2296
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
2297
|
+
leptris_element_plan plans[2] = {};
|
|
2298
|
+
plans[0].element_name = "r";
|
|
2299
|
+
plans[1].element_name = "a";
|
|
2300
|
+
|
|
2301
|
+
leptris_child_plan kids[2] = {};
|
|
2302
|
+
kids[0].wire_name = "a";
|
|
2303
|
+
kids[0].kind = LEPTRIS_PLAN_KIND_SCALAR;
|
|
2304
|
+
kids[0].child_plan_index = 1;
|
|
2305
|
+
kids[1].wire_name = "b";
|
|
2306
|
+
kids[1].kind = LEPTRIS_PLAN_KIND_SCALAR;
|
|
2307
|
+
|
|
2308
|
+
plans[0].child_count = 2;
|
|
2309
|
+
plans[0].child_plans = kids;
|
|
2310
|
+
|
|
2311
|
+
leptris_plan_spec spec = {};
|
|
2312
|
+
spec.abi_version = leptris_plan_abi_version();
|
|
2313
|
+
spec.plan_count = 2;
|
|
2314
|
+
spec.plans = plans;
|
|
2315
|
+
LeptrisPlan plan = leptris_plan_build(&spec, &st);
|
|
2316
|
+
ASSERT_NE(plan, nullptr);
|
|
2317
|
+
|
|
2318
|
+
leptris_plan_row_op ops[] = {
|
|
2319
|
+
{LEPTRIS_PLAN_OP_ELEMENT, 0, UINT32_MAX, NULL, NULL, 0},
|
|
2320
|
+
{LEPTRIS_PLAN_OP_ATTR, 0, 0, "k", "1", 1},
|
|
2321
|
+
{LEPTRIS_PLAN_OP_SCALAR, 0, 0, NULL, "v1", 2},
|
|
2322
|
+
{LEPTRIS_PLAN_OP_SCALAR, 0, 1, NULL, "v2", 2},
|
|
2323
|
+
{LEPTRIS_PLAN_OP_END, 0, 0, NULL, NULL, 0},
|
|
2324
|
+
};
|
|
2325
|
+
LeptrisPlanResult r = leptris_plan_result_build(plan, ops, 5, &st);
|
|
2326
|
+
ASSERT_NE(r, nullptr);
|
|
2327
|
+
|
|
2328
|
+
LeptrisDocument doc = leptris_document_from_plan_result(plan, r, &st);
|
|
2329
|
+
ASSERT_NE(doc, nullptr);
|
|
2330
|
+
LeptrisElement root = leptris_document_root(doc);
|
|
2331
|
+
ASSERT_NE(root, nullptr);
|
|
2332
|
+
EXPECT_STREQ(leptris_element_name(root), "r");
|
|
2333
|
+
EXPECT_STREQ(leptris_element_attribute(root, "k"), "1");
|
|
2334
|
+
EXPECT_EQ(leptris_element_child_count(root), 2u);
|
|
2335
|
+
LeptrisElement first = leptris_element_first_child_any(root);
|
|
2336
|
+
ASSERT_NE(first, nullptr);
|
|
2337
|
+
EXPECT_STREQ(leptris_element_name(first), "a");
|
|
2338
|
+
EXPECT_STREQ(leptris_element_text(first), "v1");
|
|
2339
|
+
|
|
2340
|
+
/* Non-ELEMENT roots are rejected. */
|
|
2341
|
+
leptris_plan_row_op scalar_ops[] = {
|
|
2342
|
+
{LEPTRIS_PLAN_OP_SCALAR, 0, 0, NULL, "x", 1}};
|
|
2343
|
+
LeptrisPlanResult scalar_root =
|
|
2344
|
+
leptris_plan_result_build(plan, scalar_ops, 1, &st);
|
|
2345
|
+
EXPECT_EQ(leptris_document_from_plan_result(plan, scalar_root, &st),
|
|
2346
|
+
nullptr);
|
|
2347
|
+
|
|
2348
|
+
leptris_plan_result_free(scalar_root);
|
|
2349
|
+
leptris_plan_result_free(r);
|
|
2350
|
+
leptris_plan_free(plan);
|
|
2351
|
+
leptris_document_free(doc);
|
|
2352
|
+
}
|
|
2353
|
+
|
|
2234
2354
|
} // namespace
|
|
@@ -2959,3 +2959,80 @@ TEST(DomAttachInstalled, NullShapeAndStatusContract) {
|
|
|
2959
2959
|
LEPTRIS_ERROR_NULL_ARG);
|
|
2960
2960
|
leptris_document_free(d);
|
|
2961
2961
|
}
|
|
2962
|
+
|
|
2963
|
+
namespace {
|
|
2964
|
+
/* leptris#1646: reads every element's name, text, attribute names, and
|
|
2965
|
+
* expanded-QName prefix/URI views — the pool-backed views suspected of
|
|
2966
|
+
* dangling once the source document is freed. NULL text is legal; views
|
|
2967
|
+
* must be readable, not necessarily non-empty. */
|
|
2968
|
+
void ReadAllViews(LeptrisElement e) {
|
|
2969
|
+
const char* name = leptris_element_name(e);
|
|
2970
|
+
ASSERT_NE(name, nullptr);
|
|
2971
|
+
if (const char* text = leptris_element_text(e)) (void)strlen(text);
|
|
2972
|
+
const char* px = nullptr;
|
|
2973
|
+
const char* uri = nullptr;
|
|
2974
|
+
leptris_element_expanded_name(e, nullptr, &px, &uri);
|
|
2975
|
+
if (px) (void)strlen(px);
|
|
2976
|
+
if (uri) (void)strlen(uri);
|
|
2977
|
+
for (LeptrisAttribute a = leptris_element_first_attribute(e); a;
|
|
2978
|
+
a = leptris_attribute_next(a)) {
|
|
2979
|
+
const char* an = leptris_attribute_get_name(a);
|
|
2980
|
+
ASSERT_NE(an, nullptr);
|
|
2981
|
+
}
|
|
2982
|
+
for (LeptrisNodeRef c = leptris_node_first_child(leptris_element_as_node(e)); c;
|
|
2983
|
+
c = leptris_node_next_sibling(c)) {
|
|
2984
|
+
if (leptris_node_get_type(c) == LEPTRIS_NODE_TYPE_ELEMENT)
|
|
2985
|
+
ReadAllViews((LeptrisElement)c);
|
|
2986
|
+
}
|
|
2987
|
+
}
|
|
2988
|
+
} // namespace
|
|
2989
|
+
|
|
2990
|
+
/* leptris#1646 — the two attach shapes whose survival the issue asked to
|
|
2991
|
+
* pin at the C level: (A) absorb-move, where dst's document absorbs src's
|
|
2992
|
+
* pool and the source document is then freed; (B) plain cross-document
|
|
2993
|
+
* append, which adopts by copy. In both, everything reachable from dst
|
|
2994
|
+
* must remain readable and serializable after leptris_document_free(src). */
|
|
2995
|
+
TEST(DomAbsorbSurvival, AbsorbedChildrenSurviveSourceFree) {
|
|
2996
|
+
static const char kSrc[] = "<w><a id=\"k1\" xmlns:p=\"urn:p\"><b>p:t</b><c>deep text</c></a></w>";
|
|
2997
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
2998
|
+
LeptrisDocument dst = leptris_parse_string("<r/>", strlen("<r/>"), &st);
|
|
2999
|
+
ASSERT_NE(dst, nullptr);
|
|
3000
|
+
LeptrisDocument src = leptris_parse_string(kSrc, strlen(kSrc), &st);
|
|
3001
|
+
ASSERT_NE(src, nullptr);
|
|
3002
|
+
LeptrisElement droot = leptris_document_root(dst);
|
|
3003
|
+
LeptrisElement sroot = leptris_document_root(src);
|
|
3004
|
+
ASSERT_EQ(leptris_document_absorb(dst, src), LEPTRIS_OK);
|
|
3005
|
+
LeptrisNodeRef moved = leptris_node_first_child(leptris_element_as_node(sroot));
|
|
3006
|
+
ASSERT_NE(moved, nullptr);
|
|
3007
|
+
EXPECT_EQ(leptris_element_append_child(droot, (LeptrisElement)moved), LEPTRIS_OK);
|
|
3008
|
+
|
|
3009
|
+
leptris_document_free(src);
|
|
3010
|
+
char* out = leptris_document_serialize(dst, nullptr);
|
|
3011
|
+
ASSERT_NE(out, nullptr);
|
|
3012
|
+
EXPECT_STREQ(out, "<r><a xmlns:p=\"urn:p\" id=\"k1\"><b>p:t</b><c>deep text</c></a></r>");
|
|
3013
|
+
leptris_free_string(out);
|
|
3014
|
+
ReadAllViews(droot);
|
|
3015
|
+
leptris_document_free(dst);
|
|
3016
|
+
}
|
|
3017
|
+
|
|
3018
|
+
TEST(DomAbsorbSurvival, CopyAttachSurvivesSourceFree) {
|
|
3019
|
+
static const char kSrc[] = "<w><a id=\"k1\" xmlns:p=\"urn:p\"><b>p:t</b><c>deep text</c></a></w>";
|
|
3020
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
3021
|
+
LeptrisDocument dst = leptris_parse_string("<r/>", strlen("<r/>"), &st);
|
|
3022
|
+
ASSERT_NE(dst, nullptr);
|
|
3023
|
+
LeptrisDocument src = leptris_parse_string(kSrc, strlen(kSrc), &st);
|
|
3024
|
+
ASSERT_NE(src, nullptr);
|
|
3025
|
+
LeptrisElement droot = leptris_document_root(dst);
|
|
3026
|
+
LeptrisElement sroot = leptris_document_root(src);
|
|
3027
|
+
LeptrisNodeRef orig = leptris_node_first_child(leptris_element_as_node(sroot));
|
|
3028
|
+
ASSERT_NE(orig, nullptr);
|
|
3029
|
+
EXPECT_EQ(leptris_element_append_child(droot, (LeptrisElement)orig), LEPTRIS_OK);
|
|
3030
|
+
|
|
3031
|
+
leptris_document_free(src);
|
|
3032
|
+
char* out = leptris_document_serialize(dst, nullptr);
|
|
3033
|
+
ASSERT_NE(out, nullptr);
|
|
3034
|
+
EXPECT_STREQ(out, "<r><a xmlns:p=\"urn:p\" id=\"k1\"><b>p:t</b><c>deep text</c></a></r>");
|
|
3035
|
+
leptris_free_string(out);
|
|
3036
|
+
ReadAllViews(droot);
|
|
3037
|
+
leptris_document_free(dst);
|
|
3038
|
+
}
|
|
@@ -802,6 +802,31 @@ TEST(SerializeOptions, IndentHtmlNestsBlockChildren) {
|
|
|
802
802
|
leptris_document_free(doc);
|
|
803
803
|
}
|
|
804
804
|
|
|
805
|
+
/* Issue #1647: the LAST block child of its parent must nest like
|
|
806
|
+
* any other — the pending-indent flush at close-parent has to fire
|
|
807
|
+
* for the trailing block (a following sibling used to mask it). */
|
|
808
|
+
TEST(SerializeOptions, IndentHtmlNestsLastBlockChild) {
|
|
809
|
+
const char xml[] = "<html><head><title>T</title></head><body>"
|
|
810
|
+
"<div id=\"a\"><p>x</p><span>y</span></div></body></html>";
|
|
811
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
812
|
+
LeptrisDocument doc = leptris_parse_string(xml, std::strlen(xml), &st);
|
|
813
|
+
ASSERT_NE(doc, nullptr);
|
|
814
|
+
char* s = html_force_serialize(doc, 2, 1, 0);
|
|
815
|
+
ASSERT_NE(s, nullptr);
|
|
816
|
+
EXPECT_EQ(std::string(s),
|
|
817
|
+
"<html>\n"
|
|
818
|
+
" <head><title>T</title></head>\n"
|
|
819
|
+
" <body>\n"
|
|
820
|
+
" <div id=\"a\">\n"
|
|
821
|
+
" <p>x</p>\n"
|
|
822
|
+
" <span>y</span>\n"
|
|
823
|
+
" </div>\n"
|
|
824
|
+
" </body>\n"
|
|
825
|
+
"</html>");
|
|
826
|
+
leptris_free_string(s);
|
|
827
|
+
leptris_document_free(doc);
|
|
828
|
+
}
|
|
829
|
+
|
|
805
830
|
TEST(SerializeOptions, IndentHtmlLegacyStaysNewlineOnly) {
|
|
806
831
|
const char xml[] = "<html><body><div><p>one</p><p>two</p></div>"
|
|
807
832
|
"</body></html>";
|
|
@@ -152,6 +152,99 @@ TEST(Libxml2Corpus, EveryFixtureCompilesOrFailsCleanly) {
|
|
|
152
152
|
|
|
153
153
|
} // namespace
|
|
154
154
|
|
|
155
|
+
// leptris#1644: a dense include/import DAG must capture each schema
|
|
156
|
+
// unit exactly once. Without a visited set, every path through the
|
|
157
|
+
// DAG re-parses and re-captures the whole subtree (the dml-main
|
|
158
|
+
// blowup: multi-GB / minutes at include_depth 16). Unique captures
|
|
159
|
+
// here: 6 element declarations + 8 include markers = 14;
|
|
160
|
+
// path-enumerated capture reports 21 (a2/b2 twice, s four times).
|
|
161
|
+
TEST(XsdCompile, ImportDagCapturesEachUnitOnce) {
|
|
162
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
163
|
+
LeptrisXsdSchema s = leptris_xsd_compile_file(
|
|
164
|
+
LEPTRIS_XSD_CASES_DIR "/import_dag/w.xsd", &st);
|
|
165
|
+
ASSERT_NE(s, (LeptrisXsdSchema)0) << "status " << (int)st;
|
|
166
|
+
EXPECT_EQ(leptris_xsd_declaration_count(s), 14u);
|
|
167
|
+
leptris_xsd_free(s);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// leptris-ruby#434: the length family counts OCTETS for binary
|
|
171
|
+
// bases (XML Schema Part 2: hexBinary/base64Binary length is in
|
|
172
|
+
// bytes) — the wml ST_LongHexNumber shape (hexBinary + length 4)
|
|
173
|
+
// rejected every canonical 8-digit rsid.
|
|
174
|
+
TEST(XsdDatatypes, LengthFacetCountsOctetsForHexBinary) {
|
|
175
|
+
const char xsd[] =
|
|
176
|
+
"<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">"
|
|
177
|
+
"<xs:simpleType name=\"ST_LongHexNumber\">"
|
|
178
|
+
"<xs:restriction base=\"xs:hexBinary\">"
|
|
179
|
+
"<xs:length value=\"4\"/></xs:restriction>"
|
|
180
|
+
"</xs:simpleType>"
|
|
181
|
+
"<xs:simpleType name=\"ST_Range\">"
|
|
182
|
+
"<xs:restriction base=\"xs:hexBinary\">"
|
|
183
|
+
"<xs:minLength value=\"1\"/><xs:maxLength value=\"4\"/>"
|
|
184
|
+
"</xs:restriction>"
|
|
185
|
+
"</xs:simpleType></xs:schema>";
|
|
186
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
187
|
+
LeptrisXsdSchema s = leptris_xsd_compile(xsd, strlen(xsd), &st);
|
|
188
|
+
ASSERT_EQ(st, LEPTRIS_OK);
|
|
189
|
+
ASSERT_NE(s, (LeptrisXsdSchema)0);
|
|
190
|
+
// 8 hex digits = 4 octets
|
|
191
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "ST_LongHexNumber", "00A1B2C3"), 1);
|
|
192
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "ST_LongHexNumber", "00A1B2C3FF"), 0);
|
|
193
|
+
// 4 hex digits = 2 octets
|
|
194
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "ST_LongHexNumber", "00A1"), 0);
|
|
195
|
+
// min/max in octets: 2..8 hex digits
|
|
196
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "ST_Range", "00A1"), 1);
|
|
197
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "ST_Range", "00A1B2C3"), 1);
|
|
198
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "ST_Range", "0"), 0);
|
|
199
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "ST_Range", "00A1B2C3FF"), 0);
|
|
200
|
+
// string-family length stays in characters
|
|
201
|
+
const char xsd2[] =
|
|
202
|
+
"<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">"
|
|
203
|
+
"<xs:simpleType name=\"T\">"
|
|
204
|
+
"<xs:restriction base=\"xs:string\">"
|
|
205
|
+
"<xs:length value=\"4\"/></xs:restriction>"
|
|
206
|
+
"</xs:simpleType></xs:schema>";
|
|
207
|
+
LeptrisXsdSchema s2 = leptris_xsd_compile(xsd2, strlen(xsd2), &st);
|
|
208
|
+
ASSERT_EQ(st, LEPTRIS_OK);
|
|
209
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s2, "T", "abcd"), 1);
|
|
210
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s2, "T", "abcde"), 0);
|
|
211
|
+
leptris_xsd_free(s);
|
|
212
|
+
leptris_xsd_free(s2);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// leptris-ruby#434: XSD pattern property classes for the Latin-1
|
|
216
|
+
// byte world and character-class SUBTRACTION — the OPC
|
|
217
|
+
// ST_ContentType shape. A pattern that fails to parse rejects
|
|
218
|
+
// everything, so media types failed wholesale.
|
|
219
|
+
TEST(XsdDatatypes, PatternPropertyClassesAndSubtraction) {
|
|
220
|
+
// The OPC ST_ContentType shape, minus the quoted-string member
|
|
221
|
+
// (same property-class + subtraction machinery): type/subtype
|
|
222
|
+
// segments of IsBasicLatin minus Cc controls, split on '/'.
|
|
223
|
+
const char xsd[] =
|
|
224
|
+
"<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">"
|
|
225
|
+
"<xs:simpleType name=\"ST_ContentType\">"
|
|
226
|
+
"<xs:restriction base=\"xs:string\">"
|
|
227
|
+
"<xs:pattern value="
|
|
228
|
+
"\"[\\p{IsBasicLatin}-[\\p{Cc}\\s()<>@,;:]]+/"
|
|
229
|
+
"[\\p{IsBasicLatin}-[\\p{Cc}\\s()<>@,;:]]+\"/>"
|
|
230
|
+
"</xs:restriction></xs:simpleType></xs:schema>";
|
|
231
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
232
|
+
LeptrisXsdSchema s = leptris_xsd_compile(xsd, strlen(xsd), &st);
|
|
233
|
+
ASSERT_EQ(st, LEPTRIS_OK);
|
|
234
|
+
ASSERT_NE(s, (LeptrisXsdSchema)0);
|
|
235
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "ST_ContentType", "application/xml"), 1);
|
|
236
|
+
EXPECT_EQ(leptris_xsd_simple_valid(
|
|
237
|
+
s, "ST_ContentType",
|
|
238
|
+
"application/vnd.openxmlformats-officedocument"
|
|
239
|
+
".wordprocessingml.document+xml"), 1);
|
|
240
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "ST_ContentType", "text/plain"), 1);
|
|
241
|
+
// a control char never matches
|
|
242
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "ST_ContentType", "app\x01xml"), 0);
|
|
243
|
+
// the slash split is required by the pattern's /+ shape
|
|
244
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "ST_ContentType", "application"), 0);
|
|
245
|
+
leptris_xsd_free(s);
|
|
246
|
+
}
|
|
247
|
+
|
|
155
248
|
// ---- slice 2: lexical validation ----------------------------------
|
|
156
249
|
namespace {
|
|
157
250
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json",
|
|
3
3
|
"name": "leptris",
|
|
4
|
-
"version": "1.9.
|
|
4
|
+
"version": "1.9.342",
|
|
5
5
|
"description": "High-performance XML parser and XPath 1.0 engine in C (libleptris)",
|
|
6
6
|
"homepage": "https://github.com/leptris/leptris",
|
|
7
7
|
"license": "MIT",
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: leptris
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.9.
|
|
4
|
+
version: 1.9.342.0
|
|
5
5
|
platform: arm-linux
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-10-
|
|
11
|
+
date: 2026-10-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: ffi
|
|
@@ -1324,6 +1324,12 @@ files:
|
|
|
1324
1324
|
- vendor-src/libleptris/test/xsd/libxml2-cases/import2_0.imp
|
|
1325
1325
|
- vendor-src/libleptris/test/xsd/libxml2-cases/import2_0.xml
|
|
1326
1326
|
- vendor-src/libleptris/test/xsd/libxml2-cases/import2_0.xsd
|
|
1327
|
+
- vendor-src/libleptris/test/xsd/libxml2-cases/import_dag/a1.xsd
|
|
1328
|
+
- vendor-src/libleptris/test/xsd/libxml2-cases/import_dag/a2.xsd
|
|
1329
|
+
- vendor-src/libleptris/test/xsd/libxml2-cases/import_dag/b1.xsd
|
|
1330
|
+
- vendor-src/libleptris/test/xsd/libxml2-cases/import_dag/b2.xsd
|
|
1331
|
+
- vendor-src/libleptris/test/xsd/libxml2-cases/import_dag/s.xsd
|
|
1332
|
+
- vendor-src/libleptris/test/xsd/libxml2-cases/import_dag/w.xsd
|
|
1327
1333
|
- vendor-src/libleptris/test/xsd/libxml2-cases/include1_0.inc
|
|
1328
1334
|
- vendor-src/libleptris/test/xsd/libxml2-cases/include1_0.xml
|
|
1329
1335
|
- vendor-src/libleptris/test/xsd/libxml2-cases/include1_0.xsd
|