LP#483502 PGTAP test for evergreen.xml_escape(TEXT)
authorBill Erickson <berickxx@gmail.com>
Fri, 14 Aug 2015 16:02:54 +0000 (12:02 -0400)
committerGalen Charlton <gmc@esilibrary.com>
Tue, 18 Aug 2015 01:49:03 +0000 (01:49 +0000)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Open-ILS/src/sql/Pg/t/xml_escape.pg [new file with mode: 0644]

diff --git a/Open-ILS/src/sql/Pg/t/xml_escape.pg b/Open-ILS/src/sql/Pg/t/xml_escape.pg
new file mode 100644 (file)
index 0000000..5d2c28d
--- /dev/null
@@ -0,0 +1,39 @@
+
+BEGIN;
+
+-- Plan the tests.
+SELECT plan(5);
+
+SELECT is(
+    evergreen.xml_escape('A Song of Ice & Fire'),
+    'A Song of Ice &amp; Fire',
+    'XML-Escape ampersand'
+);
+
+SELECT is(
+    evergreen.xml_escape('A Song of Rice and <<< Fire'),
+    'A Song of Rice and &lt;&lt;&lt; Fire',
+    'XML-Escape less-than'
+);
+
+SELECT is(
+    evergreen.xml_escape('>A Song of Mice and >>> Fire'),
+    '&gt;A Song of Mice and &gt;&gt;&gt; Fire',
+    'XML-Escape greater-than'
+);
+
+SELECT is(
+    evergreen.xml_escape('<A> Song of Vice &&& <<Fire'),
+    '&lt;A&gt; Song of Vice &amp;&amp;&amp; &lt;&lt;Fire',
+    'XML-Escape mixed'
+);
+
+SELECT is(
+    evergreen.xml_escape('åbçdéñœöîøæÇıÂÅÍÎÏÔÔÒÚÆŒè'), 
+    'åbçdéñœöîøæÇıÂÅÍÎÏÔÔÒÚÆŒè',
+    'XML-Escape no changes'
+);
+
+-- Finish the tests and clean up.
+SELECT * FROM finish();
+ROLLBACK;