# This file is part of GNU Mailutils. -*- Autotest -*- # Copyright (C) 2007-2021 Free Software Foundation, Inc. # # GNU Mailutils is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 3, or (at # your option) any later version. # # GNU Mailutils is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Mailutils. If not, see . AT_BANNER(URL) dnl ------------------------------------------------------------ dnl TESTURL([NAME], [KW = `'], [INPUT], [STDOUT = `'], dnl [STDERR = `'], [RUN-IF-FAIL], [RUN-IF-PASS]) dnl m4_pushdef([URL_PARSE_OPTIONS]) m4_pushdef([TESTURL],[ m4_pushdef([MU_TEST_GROUP],[Url]) m4_pushdef([MU_TEST_KEYWORDS],[url]) m4_pushdef([MU_TEST_COMMAND],[url-parse URL_PARSE_OPTIONS]) MU_GENERIC_TEST([$1],[$2 url-m4_translit($3,[ ],[_])],[$3],[],[$4],[$5]) m4_popdef([MU_TEST_COMMAND]) m4_popdef([MU_TEST_KEYWORDS]) m4_popdef([MU_TEST_GROUP]) ]) dnl ------------------------------------------------------------ m4_define([URL_PARSE_OPTIONS],[default dslash_optional]) TESTURL([],[], [scheme:], [scheme user <> passwd <> auth <> host <> port 0 path <> ]) TESTURL([],[], [scheme:/absolute/path], [scheme user <> passwd <> auth <> host <> port 0 path ]) TESTURL([],[], [scheme:relative/path], [scheme user <> passwd <> auth <> host <> port 0 path ]) TESTURL([],[], [scheme:///absolute/path], [scheme user <> passwd <> auth <> host <> port 0 path ]) dnl ------------------------------------------------------------ m4_define([URL_PARSE_OPTIONS],[default]) TESTURL([],[], [scheme://%75%73%65%72:%70%61%73%73@%68%6f%73%74], [scheme user passwd auth <> host port 0 path <> ]) TESTURL([],[], [ftp://user:pass@host//a/path], [scheme user passwd auth <> host port 0 path ]) TESTURL([],[], [ftp://:pass@host//a/path], [scheme user <> passwd auth <> host port 0 path ]) TESTURL([],[], [ftp://user:@host//a/path], [scheme user passwd <> auth <> host port 0 path ]) TESTURL([],[], [ftp://user:pass@//a/path], [scheme user passwd auth <> host <> port 0 path ]) TESTURL([],[], [ftp://user:@//a/path], [scheme user passwd <> auth <> host <> port 0 path ]) TESTURL([],[], [ftp://:@host//a/path], [scheme user <> passwd <> auth <> host port 0 path ]) TESTURL([],[], [ftp://:pass@//a/path], [scheme user <> passwd auth <> host <> port 0 path ]) TESTURL([],[], [ftp://:@//a/path], [scheme user <> passwd <> auth <> host <> port 0 path ]) TESTURL([],[], [ftp://://a/path], [scheme user <> passwd <> auth <> host <> port 0 path ]) TESTURL([],[], [ftp://@//a/path], [scheme user <> passwd <> auth <> host <> port 0 path ]) TESTURL([],[], [ftp:///a/path], [scheme user <> passwd <> auth <> host <> port 0 path ]) TESTURL([],[], [ftp://user:pass@host/a/path], [scheme user passwd auth <> host port 0 path ]) TESTURL([],[], [ftp://:pass@host/a/path], [scheme user <> passwd auth <> host port 0 path ]) TESTURL([],[], [ftp://user:@host/a/path], [scheme user passwd <> auth <> host port 0 path ]) TESTURL([],[], [ftp://user:pass@/a/path], [scheme user passwd auth <> host <> port 0 path ]) TESTURL([],[], [ftp://user:@/a/path], [scheme user passwd <> auth <> host <> port 0 path ]) TESTURL([],[], [ftp://:@host/a/path], [scheme user <> passwd <> auth <> host port 0 path ]) TESTURL([],[], [ftp://:pass@/a/path], [scheme user <> passwd auth <> host <> port 0 path ]) TESTURL([],[], [ftp://:@/a/path], [scheme user <> passwd <> auth <> host <> port 0 path ]) TESTURL([],[], [ftp://:/a/path], [scheme user <> passwd <> auth <> host <> port 0 path ]) TESTURL([],[], [ftp://@/a/path], [scheme user <> passwd <> auth <> host <> port 0 path ]) TESTURL([],[], [ftp:///a/path], [scheme user <> passwd <> auth <> host <> port 0 path ]) TESTURL([],[], [pop://pop.example.net], [scheme user <> passwd <> auth <> host port 0 path <> ]) TESTURL([],[], [pop://user@pop.example.net], [scheme user passwd <> auth <> host port 0 path <> ]) TESTURL([],[], [pop://user:passwd@pop.example.net], [scheme user passwd auth <> host port 0 path <> ]) TESTURL([],[], [pop://user;auth=*@pop.example.net], [scheme user passwd <> auth <*> host port 0 path <> ]) TESTURL([],[], [pop://pop.example.net:111], [scheme user <> passwd <> auth <> host port 111 path <> ]) TESTURL([],[], [pop://user@pop.example.net:111], [scheme user passwd <> auth <> host port 111 path <> ]) TESTURL([],[], [pop://user:passwd@pop.example.net:111], [scheme user passwd auth <> host port 111 path <> ]) TESTURL([],[], [pop://user;auth=*@pop.example.net:111], [scheme user passwd <> auth <*> host port 111 path <> ]) TESTURL([],[], [imap://imap.example.net], [scheme user <> passwd <> auth <> host port 0 path <> ]) TESTURL([],[], [imap://user@imap.example.net], [scheme user passwd <> auth <> host port 0 path <> ]) TESTURL([],[], [imap://user:passwd@imap.example.net], [scheme user passwd auth <> host port 0 path <> ]) TESTURL([],[], [imap://user;auth=*@imap.example.net], [scheme user passwd <> auth <*> host port 0 path <> ]) TESTURL([],[], [imap://imap.example.net:111], [scheme user <> passwd <> auth <> host port 111 path <> ]) TESTURL([],[], [imap://user@imap.example.net:111], [scheme user passwd <> auth <> host port 111 path <> ]) TESTURL([],[], [imap://user:passwd@imap.example.net:111], [scheme user passwd auth <> host port 111 path <> ]) TESTURL([],[], [imap://user;auth=*@imap.example.net:111], [scheme user passwd <> auth <*> host port 111 path <> ]) TESTURL([],[], [imap://imap.example.net/mbox], [scheme user <> passwd <> auth <> host port 0 path ]) TESTURL([],[], [imap://user@imap.example.net/mbox], [scheme user passwd <> auth <> host port 0 path ]) TESTURL([],[], [imap://user:passwd@imap.example.net/mbox], [scheme user passwd auth <> host port 0 path ]) TESTURL([],[], [imap://user;auth=*@imap.example.net/mbox], [scheme user passwd <> auth <*> host port 0 path ]) TESTURL([],[], [imap://imap.example.net:111/mbox], [scheme user <> passwd <> auth <> host port 111 path ]) TESTURL([],[], [imap://user@imap.example.net:111/mbox], [scheme user passwd <> auth <> host port 111 path ]) TESTURL([],[], [imap://user:passwd@imap.example.net:111/mbox], [scheme user passwd auth <> host port 111 path ]) TESTURL([],[], [imap://user;auth=*@imap.example.net:111/mbox], [scheme user passwd <> auth <*> host port 111 path ]) TESTURL([],[], [imap://imap.example.net/mbox/user@host], [scheme user passwd <> auth <> host port 0 path <> ]) TESTURL([],[], [imap://user@imap.example.net/mbox/user@host], [scheme user passwd <> auth <> host port 0 path ]) TESTURL([],[], [imap://user:passwd@imap.example.net/mbox/user@host], [scheme user passwd auth <> host port 0 path ]) TESTURL([],[], [imap://user;auth=*@imap.example.net/mbox/user@host], [scheme user passwd <> auth <*> host port 0 path ]) TESTURL([],[], [imap://imap.example.net:111/mbox/user@host], [scheme user passwd <111/mbox/user> auth <> host port 0 path <> ]) TESTURL([],[], [imap://user@imap.example.net:111/mbox/user@host], [scheme user passwd <> auth <> host port 111 path ]) TESTURL([],[], [imap://user:passwd@imap.example.net:111/mbox/user@host], [scheme user passwd auth <> host port 111 path ]) TESTURL([],[], [imap://user;auth=*@imap.example.net:111/mbox/user@host], [scheme user passwd <> auth <*> host port 111 path ]) TESTURL([],[], [ftp://ftp.example.org/mbox/user%40host], [scheme user <> passwd <> auth <> host port 0 path ]) TESTURL([],[], [ftp://ftp.example.org:111/mbox/user%40host], [scheme user <> passwd <> auth <> host port 111 path ]) TESTURL([],[], [ftp://ftp.example.org:111/mbox/user%40host;type=pass], [[scheme user <> passwd <> auth <> host port 111 path param[0] ]]) m4_pushdef([URL_PARSE_OPTIONS],[default dslash_optional]) TESTURL([],[], [mbox:/var/spool/mail;type=index;param=2;user=gray], [[scheme user <> passwd <> auth <> host <> port 0 path param[0] param[1] param[2] ]]) m4_popdef([URL_PARSE_OPTIONS]) TESTURL([],[], [mbox:///var/spool/mail;type=index;param=2;user=gray], [[scheme user <> passwd <> auth <> host <> port 0 path param[0] param[1] param[2] ]]) TESTURL([],[], [http://gnu.org.ua/home/gray?prog&arg1&arg2], [[scheme user <> passwd <> auth <> host port 0 path query[0] query[1] query[2] ]]) TESTURL([],[], [http://gnu.org.ua/home/gray;foo=bar;baz=qux?prog&arg%201&arg%202], [[scheme user <> passwd <> auth <> host port 0 path param[0] param[1] query[0] query[1] query[2] ]]) TESTURL([],[], [/usr/sbin/sendmail], [scheme user <> passwd <> auth <> host <> port 0 path ]) TESTURL([],[], [/var/spool/mail/gray%40gnu.org], [scheme user <> passwd <> auth <> host <> port 0 path ]) m4_pushdef([URL_PARSE_OPTIONS],[slash]) TESTURL([],[], [./file.db], [scheme user <> passwd <> auth <> host <> port 0 path <./file.db> ]) m4_define([URL_PARSE_OPTIONS],[slash hint=gdbm://]) TESTURL([(gdbm) ./file.db],[], [./file.db], [scheme user <> passwd <> auth <> host <> port 0 path <./file.db> ]) m4_popdef([URL_PARSE_OPTIONS]) m4_pushdef([URL_PARSE_OPTIONS],[local hint=db://]) TESTURL([],[], [local], [scheme user <> passwd <> auth <> host <> port 0 path ]) m4_popdef([URL_PARSE_OPTIONS]) TESTURL([],[], [| /bin/mailman request list%40dom], [[scheme user <> passwd <> auth <> host <> port 0 path query[0] query[1] ]]) m4_pushdef([URL_PARSE_OPTIONS],[pipe hint=ext://]) TESTURL([(ext) | /bin/mailman request list%40dom],[], [| /bin/mailman request list%40dom], [[scheme user <> passwd <> auth <> host <> port 0 path query[0] query[1] ]]) m4_popdef([URL_PARSE_OPTIONS]) TESTURL([],[], [prog:///bin/mailman?request&list%40dom], [[scheme user <> passwd <> auth <> host <> port 0 path query[0] query[1] ]]) m4_popdef([TESTURL]) m4_popdef([URL_PARSE_OPTIONS])