diff options
author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2003-03-20 00:24:44 +0000 |
---|---|---|
committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2003-03-20 00:24:44 +0000 |
commit | 53857360bb1ca9cd2080b69d930763ae59db9b06 (patch) | |
tree | 6c1bc6d6462695cf9048801b2244f7fd0cd21ad5 /test/urltest.lua | |
parent | 7da19138e37c4e0123860f1fecbceb80c3d2627d (diff) | |
download | luasocket-53857360bb1ca9cd2080b69d930763ae59db9b06.tar.gz luasocket-53857360bb1ca9cd2080b69d930763ae59db9b06.tar.bz2 luasocket-53857360bb1ca9cd2080b69d930763ae59db9b06.zip |
Finish port to Lua 5. Everything is working fine.
Still doesn't work in Windows.
Diffstat (limited to 'test/urltest.lua')
-rw-r--r-- | test/urltest.lua | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/test/urltest.lua b/test/urltest.lua index 8ca36fe..b97844d 100644 --- a/test/urltest.lua +++ b/test/urltest.lua | |||
@@ -1,5 +1,8 @@ | |||
1 | |||
2 | |||
3 | |||
1 | local check_build_url = function(parsed) | 4 | local check_build_url = function(parsed) |
2 | local built = URL.build_url(parsed) | 5 | local built = socket.url.build(parsed) |
3 | if built ~= parsed.url then | 6 | if built ~= parsed.url then |
4 | print("built is different from expected") | 7 | print("built is different from expected") |
5 | print(built) | 8 | print(built) |
@@ -9,7 +12,7 @@ local check_build_url = function(parsed) | |||
9 | end | 12 | end |
10 | 13 | ||
11 | local check_protect = function(parsed, path, unsafe) | 14 | local check_protect = function(parsed, path, unsafe) |
12 | local built = URL.build_path(parsed, unsafe) | 15 | local built = socket.url.build_path(parsed, unsafe) |
13 | if built ~= path then | 16 | if built ~= path then |
14 | print(built, path) | 17 | print(built, path) |
15 | print("path composition failed.") | 18 | print("path composition failed.") |
@@ -18,9 +21,9 @@ local check_protect = function(parsed, path, unsafe) | |||
18 | end | 21 | end |
19 | 22 | ||
20 | local check_invert = function(url) | 23 | local check_invert = function(url) |
21 | local parsed = URL.parse_url(url) | 24 | local parsed = socket.url.parse(url) |
22 | parsed.path = URL.build_path(URL.parse_path(parsed.path)) | 25 | parsed.path = socket.url.build_path(socket.url.parse_path(parsed.path)) |
23 | local rebuilt = URL.build_url(parsed) | 26 | local rebuilt = socket.url.build(parsed) |
24 | if rebuilt ~= url then | 27 | if rebuilt ~= url then |
25 | print(url, rebuilt) | 28 | print(url, rebuilt) |
26 | print("original and rebuilt are different") | 29 | print("original and rebuilt are different") |
@@ -29,7 +32,7 @@ local check_invert = function(url) | |||
29 | end | 32 | end |
30 | 33 | ||
31 | local check_parse_path = function(path, expect) | 34 | local check_parse_path = function(path, expect) |
32 | local parsed = URL.parse_path(path) | 35 | local parsed = socket.url.parse_path(path) |
33 | for i = 1, math.max(table.getn(parsed), table.getn(expect)) do | 36 | for i = 1, math.max(table.getn(parsed), table.getn(expect)) do |
34 | if parsed[i] ~= expect[i] then | 37 | if parsed[i] ~= expect[i] then |
35 | print(path) | 38 | print(path) |
@@ -48,7 +51,7 @@ local check_parse_path = function(path, expect) | |||
48 | print("is_absolute mismatch") | 51 | print("is_absolute mismatch") |
49 | exit() | 52 | exit() |
50 | end | 53 | end |
51 | local built = URL.build_path(expect) | 54 | local built = socket.url.build_path(expect) |
52 | if built ~= path then | 55 | if built ~= path then |
53 | print(built, path) | 56 | print(built, path) |
54 | print("path composition failed.") | 57 | print("path composition failed.") |
@@ -57,7 +60,7 @@ local check_parse_path = function(path, expect) | |||
57 | end | 60 | end |
58 | 61 | ||
59 | local check_absolute_url = function(base, relative, absolute) | 62 | local check_absolute_url = function(base, relative, absolute) |
60 | local res = URL.absolute_url(base, relative) | 63 | local res = socket.url.absolute(base, relative) |
61 | if res ~= absolute then | 64 | if res ~= absolute then |
62 | write("absolute: In test for '", relative, "' expected '", | 65 | write("absolute: In test for '", relative, "' expected '", |
63 | absolute, "' but got '", res, "'\n") | 66 | absolute, "' but got '", res, "'\n") |
@@ -68,7 +71,7 @@ end | |||
68 | local check_parse_url = function(gaba) | 71 | local check_parse_url = function(gaba) |
69 | local url = gaba.url | 72 | local url = gaba.url |
70 | gaba.url = nil | 73 | gaba.url = nil |
71 | local parsed = URL.parse_url(url) | 74 | local parsed = socket.url.parse(url) |
72 | for i, v in gaba do | 75 | for i, v in gaba do |
73 | if v ~= parsed[i] then | 76 | if v ~= parsed[i] then |
74 | write("parse: In test for '", url, "' expected ", i, " = '", | 77 | write("parse: In test for '", url, "' expected ", i, " = '", |