From 8bf9b5e6552abf871fa39f26948e865c9952c8dc Mon Sep 17 00:00:00 2001 From: galtm <40716346+galtm@users.noreply.github.com> Date: Wed, 8 Jan 2025 09:34:44 -0500 Subject: [PATCH] Sample code for "Interpreting XML Diffs in XSpec Test Reports" --- README.md | 3 ++- pom.xml | 1 + src/diff-colors/README.md | 9 ++++++++ src/diff-colors/diff-colors.xqm | 32 ++++++++++++++++++++++++++ src/diff-colors/diff-colors.xspec | 38 +++++++++++++++++++++++++++++++ 5 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 src/diff-colors/README.md create mode 100644 src/diff-colors/diff-colors.xqm create mode 100644 src/diff-colors/diff-colors.xspec diff --git a/README.md b/README.md index 0064b8c..ed241d2 100644 --- a/README.md +++ b/README.md @@ -18,12 +18,13 @@ Each post corresponds to a [subfolder under `src/`](https://github.com/galtm/xsp * [How to Test Error Handling in XSpec](https://github.com/galtm/xspectacles/tree/main/src/catch-error) * [Ignoring Code Comments During XSpec Testing](https://github.com/galtm/xspectacles/tree/main/src/helper-comments) * [Inheritance as a Form of Reuse in XSpec](https://github.com/galtm/xspectacles/tree/main/src/code-reuse-call) +* **(NEW!)** [Interpreting XML Diffs in XSpec Test Reports](https://github.com/galtm/xspectacles/tree/main/src/diff-colors) * [Multiple Cases in One XSpec Scenario](https://github.com/galtm/xspectacles/tree/main/src/context-sequence) * [My XML Content in XSpec Causes an Error](https://github.com/galtm/xspectacles/tree/main/src/xml-content-error) * [One-or-More Ways to Foil Empty-Sequence Surprises in XSpec](https://github.com/galtm/xspectacles/tree/main/src/one-or-more) * [Overriding Global XSLT Variables in XSpec, Part 1](https://github.com/galtm/xspectacles/tree/main/src/override-global-var-part1) * [Overriding Global XSLT Variables in XSpec, Part 2](https://github.com/galtm/xspectacles/tree/main/src/override-global-var-part2) -* **(NEW!)** [Overriding Global XSLT Variables in XSpec, Part 3](https://github.com/galtm/xspectacles/tree/main/src/override-global-var-part3) +* [Overriding Global XSLT Variables in XSpec, Part 3](https://github.com/galtm/xspectacles/tree/main/src/override-global-var-part3) * [Saying "Almost Valid" or "Beyond Valid" in XSpec Tests for Schematron](https://github.com/galtm/xspectacles/tree/main/src/almost-valid) * [Saying "Not Yet" in XSpec](https://github.com/galtm/xspectacles/tree/main/src/pending) * [Saying "Whatever" in XSpec: How, Why, When](https://github.com/galtm/xspectacles/tree/main/src/three-dots) diff --git a/pom.xml b/pom.xml index 9d30b03..eecebc7 100644 --- a/pom.xml +++ b/pom.xml @@ -85,6 +85,7 @@ ${project.basedir}/src + diff-colors/diff-colors.xspec pending/pending-error-xq.xspec schxslt-in-xspec/schxslt-in-xspec-mistakes.xspec space-actual/problem/space-actual-problem.xspec diff --git a/src/diff-colors/README.md b/src/diff-colors/README.md new file mode 100644 index 0000000..6dfd3d9 --- /dev/null +++ b/src/diff-colors/README.md @@ -0,0 +1,9 @@ +# Sample code for "Interpreting XML Diffs in XSpec Test Reports" + +Example files: + +* `diff-colors.xqm` +* `diff-colors.xspec` + +#### Link to Topic +[Interpreting XML Diffs in XSpec Test Reports](https://medium.com/@xspectacles/interpreting-xml-diffs-in-xspec-test-reports-ce37358ac2bd) diff --git a/src/diff-colors/diff-colors.xqm b/src/diff-colors/diff-colors.xqm new file mode 100644 index 0000000..5c0ddbd --- /dev/null +++ b/src/diff-colors/diff-colors.xqm @@ -0,0 +1,32 @@ +xquery version "1.0"; +module namespace mf = "urn:x-xspectacles:functions:diff-colors"; + +(: + Sample Code for "Interpreting XML Diffs in XSpec Test Reports" + https://medium.com/@xspectacles/interpreting-xml-diffs-in-xspec-test-reports-ce37358ac2bd +:) + +declare function mf:make-doc() as document-node(element(doc)) { + document{ + +
+ Elements + Alpha + Beta +
+
+ Text + Some text + More text +
+
+ Attributes + First + Second + Third +
+
+ } +}; + +(: Copyright © 2025 by Amanda Galtman. :) \ No newline at end of file diff --git a/src/diff-colors/diff-colors.xspec b/src/diff-colors/diff-colors.xspec new file mode 100644 index 0000000..29d36f7 --- /dev/null +++ b/src/diff-colors/diff-colors.xspec @@ -0,0 +1,38 @@ + + + + + + + + + +
+ Elements + Alpha + Beta + Gamma +
+
+ Text + Some text + More interesting text +
+
+ Attributes + First + Second + Third +
+
+
+
+
+ + \ No newline at end of file