stanzacmp + tests: Advance through matching stanza on successful match

Thu, 06 Sep 2018 19:13:42 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Thu, 06 Sep 2018 19:13:42 +0100
changeset 101
91a9e557e0e5
parent 100
f2b3e8e6690f
child 102
984b3ba0ea99

stanzacmp + tests: Advance through matching stanza on successful match

scansion/stanzacmp.lua file | annotate | diff | comparison | revisions
spec/stanzacmp_spec.lua file | annotate | diff | comparison | revisions
--- a/scansion/stanzacmp.lua	Thu Sep 06 18:28:27 2018 +0100
+++ b/scansion/stanzacmp.lua	Thu Sep 06 19:13:42 2018 +0100
@@ -63,6 +63,7 @@
 			if not match then
 				return false;
 			end
+			stanza2_pos = stanza2_pos + 1;
 		end
 	end
 	return true;
--- a/spec/stanzacmp_spec.lua	Thu Sep 06 18:28:27 2018 +0100
+++ b/spec/stanzacmp_spec.lua	Thu Sep 06 19:13:42 2018 +0100
@@ -122,4 +122,21 @@
 	it("should be possible to disable ordered matching", function ()
 		yes("<foo><one scansion:strict='no'><a/><b/></one></foo>", "<foo><one><b/><a/></one></foo>");
 	end);
+
+	it("should match when there are many children", function ()
+		yes([[<s>
+			<x>
+				<a/>
+				<b/>
+				<c/>
+			</x>
+		</s>]]
+		, [[<s>
+			<x>
+				<a/>
+				<b/>
+				<c/>
+			</x>
+		</s>]]);
+	end);
 end);

mercurial