moxml 0.5.125 → 0.5.127
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/Gemfile +1 -1
- data/lib/moxml/version.rb +1 -1
- data/spec/moxml/cycle_rejection_spec.rb +33 -0
- data/spec/moxml/to_html_spec.rb +20 -0
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 01032e6367e81d2b15512e378e32065aaaeda8e0159ab361b1cce56c853483b6
|
|
4
|
+
data.tar.gz: f7ea3e5da35d715e4c0ee624bd34fa2ed2b0e97114941e19aa623e737935ba8a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5738ff3e0b4b905ec4109aa4ec708885d2d901f322ef819bea1e54af264b7494c7f1fd65f58a83545d5a537175657174677970b584ad971b8c850ca3e37e85f1
|
|
7
|
+
data.tar.gz: 346e74335cc99fc6ade2d2502e6c1f628d6f5cf94fe8ac3e3dbe70e54641aff44b7926e0fb0b389ce501ba82633f71c936f1355ce1607ce71bb1c325fb90d265
|
data/Gemfile
CHANGED
data/lib/moxml/version.rb
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "spec_helper"
|
|
4
|
+
|
|
5
|
+
# Engine 1.9.339 (leptris#1640): reparenting a node into its own
|
|
6
|
+
# descendant subtree is rejected (LEPTRIS_ERROR_INVALID_ARG) —
|
|
7
|
+
# previously the edge built a parent cycle and the next serialize
|
|
8
|
+
# recursed unbounded (the windows fast_element_xml segv family,
|
|
9
|
+
# ASAN-reproduced). The moxml contract: the mutation RAISES and the
|
|
10
|
+
# tree is untouched — never a corrupt-then-crash tree.
|
|
11
|
+
RSpec.describe "cycle-creating reparents (engine 1.9.339+)" do
|
|
12
|
+
# Nokogiri raises but MOVES the argument (no tree-intact
|
|
13
|
+
# guarantee) — the untouched-tree contract is the engine's.
|
|
14
|
+
describe "on leptris" do
|
|
15
|
+
let(:ctx) { Moxml.new(:leptris) }
|
|
16
|
+
|
|
17
|
+
it "rejects appending an ancestor into its descendant" do
|
|
18
|
+
doc = ctx.parse("<r><a><b>x</b></a></r>")
|
|
19
|
+
a = doc.at("//a")
|
|
20
|
+
before = doc.to_xml
|
|
21
|
+
expect { a.add_child(doc.root) }.to raise_error(StandardError)
|
|
22
|
+
expect(doc.to_xml).to eq(before)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it "rejects the replace shape of the same cycle" do
|
|
26
|
+
doc = ctx.parse("<r><a><b><c/></b></a></r>")
|
|
27
|
+
b = doc.at("//b")
|
|
28
|
+
before = doc.to_xml
|
|
29
|
+
expect { b.add_child(doc.root) }.to raise_error(StandardError)
|
|
30
|
+
expect(doc.to_xml).to eq(before)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
data/spec/moxml/to_html_spec.rb
CHANGED
|
@@ -65,6 +65,26 @@ RSpec.describe "Moxml::Document#to_html" do
|
|
|
65
65
|
"<body>\n\t\t<div id=\"a\">\n\t\t\t<p>x</p>",
|
|
66
66
|
)
|
|
67
67
|
end
|
|
68
|
+
|
|
69
|
+
it "nests a LAST block child (engine 1.9.341, leptris#1647)" do
|
|
70
|
+
doc2 = Moxml.new(:leptris).parse_html(
|
|
71
|
+
"<html><head><title>T</title></head><body>" \
|
|
72
|
+
"<div id=\"a\"><p>x</p><span>y</span></div></body></html>",
|
|
73
|
+
)
|
|
74
|
+
out = doc2.to_html(indent: 2)
|
|
75
|
+
skip "engine predates leptris#1647" unless out.include?("<body>\n <div")
|
|
76
|
+
expect(out).to eq(
|
|
77
|
+
"<html>\n " \
|
|
78
|
+
"<head><title>T</title></head>\n " \
|
|
79
|
+
"<body>\n " \
|
|
80
|
+
"<div id=\"a\">\n " \
|
|
81
|
+
"<p>x</p>\n " \
|
|
82
|
+
"<span>y</span>\n " \
|
|
83
|
+
"</div>\n " \
|
|
84
|
+
"</body>\n" \
|
|
85
|
+
"</html>",
|
|
86
|
+
)
|
|
87
|
+
end
|
|
68
88
|
end
|
|
69
89
|
|
|
70
90
|
context "when the binding predates the ride" do
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: moxml
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.127
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
@@ -487,6 +487,7 @@ files:
|
|
|
487
487
|
- spec/moxml/comment_spec.rb
|
|
488
488
|
- spec/moxml/config_spec.rb
|
|
489
489
|
- spec/moxml/context_spec.rb
|
|
490
|
+
- spec/moxml/cycle_rejection_spec.rb
|
|
490
491
|
- spec/moxml/declaration_preservation_spec.rb
|
|
491
492
|
- spec/moxml/declaration_spec.rb
|
|
492
493
|
- spec/moxml/doctype_spec.rb
|