Line data Source code
1 : /* SPDX-License-Identifier: LGPL-2.1+ */ 2 : 3 : #include "macro.h" 4 : #include "web-util.h" 5 : 6 1 : static void test_is_valid_documentation_url(void) { 7 1 : assert_se(documentation_url_is_valid("http://www.freedesktop.org/wiki/Software/systemd")); 8 1 : assert_se(documentation_url_is_valid("https://www.kernel.org/doc/Documentation/binfmt_misc.txt")); /* dead */ 9 1 : assert_se(documentation_url_is_valid("https://www.kernel.org/doc/Documentation/admin-guide/binfmt-misc.rst")); 10 1 : assert_se(documentation_url_is_valid("https://www.kernel.org/doc/html/latest/admin-guide/binfmt-misc.html")); 11 1 : assert_se(documentation_url_is_valid("file:/foo/foo")); 12 1 : assert_se(documentation_url_is_valid("man:systemd.special(7)")); 13 1 : assert_se(documentation_url_is_valid("info:bar")); 14 : 15 1 : assert_se(!documentation_url_is_valid("foo:")); 16 1 : assert_se(!documentation_url_is_valid("info:")); 17 1 : assert_se(!documentation_url_is_valid("")); 18 1 : } 19 : 20 1 : int main(int argc, char *argv[]) { 21 1 : test_is_valid_documentation_url(); 22 : 23 1 : return 0; 24 : }