Added $(EXEEXT) for executables.
[elinks.git] / src / protocol / test / test-normalize-uri
blobe9ab258284eade508dd09165a155796d51aceaae
1 #!/bin/sh
4 test_description='Test URI normalizing'
6 . "$TEST_LIB"
8 test_uri_equals () {
9 before="$1"; shift
10 expected="$1"; shift
11 normalized="$(uri-test "$before")"
13 test_expect_success "Normalize $before" "test \"$normalized\" = \"$expected\""
17 ################################################################
19 test_uri_equals "http://example.org/foo/bar/baz?a=1&b=2#frag" \
20 "http://example.org/foo/bar/baz?a=1&b=2#frag"
22 test_uri_equals "http://example.org/foo/bar/../?a=1&b=2#frag" \
23 "http://example.org/foo/?a=1&b=2#frag"
25 test_uri_equals "http://example.org/foo/bar/../../baz?a=1&b=2#frag" \
26 "http://example.org/baz?a=1&b=2#frag"
28 test_uri_equals "http://example.org/foo/bar/.." \
29 "http://example.org/foo/"
31 test_uri_equals "http://example.org/foo/bar;a=1/.." \
32 "http://example.org/foo/"
34 test_uri_equals "http://example.org/foo/bar.." \
35 "http://example.org/foo/bar.."
37 # Bug 744 - ELinks changes "//" to "/" in path component of URI
38 test_uri_equals "http://example.org/foo/bar/baz" \
39 "http://example.org/foo/bar/baz"
41 test_uri_equals "http://example.org/foo/bar/" \
42 "http://example.org/foo/bar/"
44 test_uri_equals "http://example.org/foo//baz" \
45 "http://example.org/foo//baz"
47 test_uri_equals "http://example.org/foo//" \
48 "http://example.org/foo//"
50 test_uri_equals "http://example.org//bar/baz" \
51 "http://example.org//bar/baz"
53 test_uri_equals "http://example.org//bar/" \
54 "http://example.org//bar/"
56 test_uri_equals "http://example.org///baz" \
57 "http://example.org///baz"
59 test_uri_equals "http://example.org///" \
60 "http://example.org///"
62 test_uri_equals "http://example.org/foo/bar/baz/.." \
63 "http://example.org/foo/bar/"
65 test_uri_equals "http://example.org/foo/bar//.." \
66 "http://example.org/foo/bar/"
68 test_uri_equals "http://example.org/foo//baz/.." \
69 "http://example.org/foo//"
71 test_uri_equals "http://example.org/foo///.." \
72 "http://example.org/foo//"
74 test_uri_equals "http://example.org//bar/baz/.." \
75 "http://example.org//bar/"
77 test_uri_equals "http://example.org//bar//.." \
78 "http://example.org//bar/"
80 test_uri_equals "http://example.org///baz/.." \
81 "http://example.org///"
83 test_uri_equals "http://example.org////.." \
84 "http://example.org///"
86 test_uri_equals "http://example.org/foo/..//bar/baz" \
87 "http://example.org//bar/baz"
89 test_uri_equals "http://example.org//.//foo" \
90 "http://example.org///foo"
92 test_uri_equals "http://example.org//./../foo" \
93 "http://example.org/foo"
95 test_uri_equals "http://example.org/gag///./../.." \
96 "http://example.org/gag/"
98 test_done