[libxslt] Add EXSLT str:encode-uri and str:decode-uri tests



commit 87735e00336bd2ef0dbba14f24338f97983a1fc3
Author: Afonso Bordado <afonsobordado+gitlab az8 co>
Date:   Sat Nov 23 23:49:57 2019 +0000

    Add EXSLT str:encode-uri and str:decode-uri tests

 tests/exslt/strings/uri.out | 38 ++++++++++++++++++++++++++++++++++++++
 tests/exslt/strings/uri.xml | 10 ++++++++++
 tests/exslt/strings/uri.xsl | 29 +++++++++++++++++++++++++++++
 3 files changed, 77 insertions(+)
---
diff --git a/tests/exslt/strings/uri.out b/tests/exslt/strings/uri.out
new file mode 100644
index 00000000..5fce9d72
--- /dev/null
+++ b/tests/exslt/strings/uri.out
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+<test-results>
+  <test-result>
+    <all/>
+    <no-reserved/>
+    <encode-decode/>
+  </test-result>
+  <test-result>
+    <all>abcdefghijklmnopqrstuvwxyz</all>
+    <no-reserved>abcdefghijklmnopqrstuvwxyz</no-reserved>
+    <encode-decode>abcdefghijklmnopqrstuvwxyz</encode-decode>
+  </test-result>
+  <test-result>
+    <all>%3B%2F%3F%3A%26%3D%5B%5D%2B%24%2C</all>
+    <no-reserved>;/?:&amp;=[]+$,</no-reserved>
+    <encode-decode>;/?:&amp;=[]+$,</encode-decode>
+  </test-result>
+  <test-result>
+    <all>-_.!~*'()</all>
+    <no-reserved>-_.!~*'()</no-reserved>
+    <encode-decode>-_.!~*'()</encode-decode>
+  </test-result>
+  <test-result>
+    <all>%F0%9F%91%8C</all>
+    <no-reserved>%F0%9F%91%8C</no-reserved>
+    <encode-decode>👌</encode-decode>
+  </test-result>
+  <test-result>
+    <all>@</all>
+    <no-reserved>@</no-reserved>
+    <encode-decode>@</encode-decode>
+  </test-result>
+  <test-result>
+    <all>%25</all>
+    <no-reserved>%25</no-reserved>
+    <encode-decode>%</encode-decode>
+  </test-result>
+</test-results>
diff --git a/tests/exslt/strings/uri.xml b/tests/exslt/strings/uri.xml
new file mode 100644
index 00000000..cbc59cc0
--- /dev/null
+++ b/tests/exslt/strings/uri.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<test-cases>
+    <test-case/>
+    <test-case>abcdefghijklmnopqrstuvwxyz</test-case>
+    <test-case><![CDATA[;/?:&=[]+$,]]></test-case>
+    <test-case>-_.!~*'()</test-case>
+    <test-case>👌</test-case>
+    <test-case>@</test-case>
+    <test-case>%</test-case>
+</test-cases>
diff --git a/tests/exslt/strings/uri.xsl b/tests/exslt/strings/uri.xsl
new file mode 100644
index 00000000..948cb512
--- /dev/null
+++ b/tests/exslt/strings/uri.xsl
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
+    xmlns:str="http://exslt.org/strings";
+    exclude-result-prefixes="str">
+
+<xsl:output indent="yes"/>
+
+<xsl:template match="test-cases">
+    <test-results>
+        <xsl:apply-templates select="test-case"/>
+    </test-results>
+</xsl:template>
+
+<xsl:template match="test-case">
+    <test-result>
+        <all>
+            <xsl:value-of select="str:encode-uri(., true())"/>
+        </all>
+        <no-reserved>
+            <xsl:value-of select="str:encode-uri(., false())"/>
+        </no-reserved>
+        <encode-decode>
+            <xsl:value-of select="str:decode-uri(str:encode-uri(., true()))"/>
+        </encode-decode>
+    </test-result>
+</xsl:template>
+
+</xsl:stylesheet>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]