Changeset: bf27cbca113d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/bf27cbca113d
Added Files:
        sql/test/sys-schema/Tests/webExamplesUrlFunctions.test
Modified Files:
        sql/test/sys-schema/Tests/All
Branch: Sep2022
Log Message:

Add tests for URL functions example on website.
Also included tests for new function (added in Sep2022) 
sys.url_extract_host(url string, no_www bool)
It appears to not give the correct result (yet).


diffs (121 lines):

diff --git a/sql/test/sys-schema/Tests/All b/sql/test/sys-schema/Tests/All
--- a/sql/test/sys-schema/Tests/All
+++ b/sql/test/sys-schema/Tests/All
@@ -15,6 +15,7 @@ webExamplesLogicalFunctionsOperators
 webExamplesComparisonFunctionsOperators
 webExamplesCastFunctionsOperators
 webExamplesMathematicalFunctionsOperators
+webExamplesUrlFunctions
 
 utilities
 
diff --git a/sql/test/sys-schema/Tests/webExamplesUrlFunctions.test 
b/sql/test/sys-schema/Tests/webExamplesUrlFunctions.test
new file mode 100644
--- /dev/null
+++ b/sql/test/sys-schema/Tests/webExamplesUrlFunctions.test
@@ -0,0 +1,105 @@
+statement ok
+drop table if exists urlt
+
+statement ok
+create table urlt (c url);
+
+statement ok
+insert into urlt values 
('https://[email protected]:458/Doc/Abc.html?lang=nl&sort=asc#example');
+
+query T nosort
+select c from urlt;
+----
+https://[email protected]:458/Doc/Abc.html?lang=nl&sort=asc#example
+
+query T nosort
+select sys.getanchor(c) from urlt;
+----
+example
+
+query T nosort
+select sys.getbasename(c) from urlt;
+----
+Abc
+
+query T nosort
+select sys.getcontext(c) from urlt;
+----
+/Doc/Abc.html
+
+query T nosort
+select sys.getdomain(c) from urlt;
+----
+org
+
+query T nosort
+select sys.getextension(c) from urlt;
+----
+html
+
+query T nosort
+select sys.getfile(c) from urlt;
+----
+Abc.html
+
+query T nosort
+select sys.gethost(c) from urlt;
+----
+www.monetdb.org
+
+query T nosort
+select sys.getport(c) from urlt;
+----
+458
+
+query T nosort
+select sys.getprotocol(c) from urlt;
+----
+https
+
+query T nosort
+select sys.getquery(c) from urlt;
+----
+lang=nl&sort=asc
+
+query T nosort
+select sys.getroboturl(c) from urlt;
+----
+https://[email protected]:458/robots.txt
+
+query T nosort
+select sys.getuser(c) from urlt;
+----
+me
+
+query I nosort
+select sys.isaurl(c) from urlt;
+----
+1
+
+query T nosort
+select sys.newurl('https', '[email protected]:123', 'docs/index.html');
+----
+https://[email protected]:123/docs/index.html
+
+query T nosort
+select sys.newurl('https', 'www.a.com', 5567, 'docs/index.html');
+----
+https://www.a.com:5567/docs/index.html
+
+
+# new Sep2022 function: sys.url_extract_host(url string, no_www bool)
+query T nosort
+select sys.url_extract_host(c, false) from urlt;
+----
+www.monetdb.org
+
+query T nosort
+select sys.url_extract_host(c, true) from urlt;
+----
+monetdb.org
+
+
+statement ok
+drop table if exists urlt
+
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to