aboutsummaryrefslogtreecommitdiff
path: root/test/urltest.lua
diff options
context:
space:
mode:
authorDiego Nehab <diego@tecgraf.puc-rio.br>2003-03-20 00:24:44 +0000
committerDiego Nehab <diego@tecgraf.puc-rio.br>2003-03-20 00:24:44 +0000
commit53857360bb1ca9cd2080b69d930763ae59db9b06 (patch)
tree6c1bc6d6462695cf9048801b2244f7fd0cd21ad5 /test/urltest.lua
parent7da19138e37c4e0123860f1fecbceb80c3d2627d (diff)
downloadluasocket-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.lua21
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
1local check_build_url = function(parsed) 4local 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)
9end 12end
10 13
11local check_protect = function(parsed, path, unsafe) 14local 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)
18end 21end
19 22
20local check_invert = function(url) 23local 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)
29end 32end
30 33
31local check_parse_path = function(path, expect) 34local 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)
57end 60end
58 61
59local check_absolute_url = function(base, relative, absolute) 62local 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
68local check_parse_url = function(gaba) 71local 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, " = '",