aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Nehab <diego@tecgraf.puc-rio.br>2002-07-08 21:53:33 +0000
committerDiego Nehab <diego@tecgraf.puc-rio.br>2002-07-08 21:53:33 +0000
commit65dd6185533031421fef4a9fb5f1c919124c86a6 (patch)
tree9c406e76fb3cc09bb1271d9d368f4d1fef4c0666
parent5b2a124305f26d36e95b639b1c70a32368f03261 (diff)
downloadluasocket-65dd6185533031421fef4a9fb5f1c919124c86a6.tar.gz
luasocket-65dd6185533031421fef4a9fb5f1c919124c86a6.tar.bz2
luasocket-65dd6185533031421fef4a9fb5f1c919124c86a6.zip
Using noglobals.lua
Ajeitados alguns paths. Não carrega mais os modulos.
-rw-r--r--test/ftptest.lua26
1 files changed, 6 insertions, 20 deletions
diff --git a/test/ftptest.lua b/test/ftptest.lua
index 7fc1917..34cccf1 100644
--- a/test/ftptest.lua
+++ b/test/ftptest.lua
@@ -1,18 +1,4 @@
1function mysetglobal (varname, oldvalue, newvalue) 1dofile("noglobals.lua")
2 print("changing " .. varname)
3 %rawset(%globals(), varname, newvalue)
4end
5function mygetglobal (varname, newvalue)
6 print("checking " .. varname)
7 return %rawget(%globals(), varname)
8end
9settagmethod(tag(nil), "setglobal", mysetglobal)
10settagmethod(tag(nil), "getglobal", mygetglobal)
11
12assert(dofile("../lua/ftp.lua"))
13assert(dofile("../lua/url.lua"))
14assert(dofile("../lua/concat.lua"))
15assert(dofile("../lua/code.lua"))
16 2
17local similar = function(s1, s2) 3local similar = function(s1, s2)
18 return strlower(gsub(s1, "%s", "")) == strlower(gsub(s2, "%s", "")) 4 return strlower(gsub(s1, "%s", "")) == strlower(gsub(s2, "%s", ""))
@@ -50,9 +36,9 @@ local t = _time()
50index = readfile("index.html") 36index = readfile("index.html")
51 37
52write("testing file upload: ") 38write("testing file upload: ")
53remove("/home/ftp/dir1/index.up.html") 39remove("/var/ftp/dir1/index.up.html")
54err = FTP.put("ftp://localhost/dir1/index.up.html;type=i", index) 40err = FTP.put("ftp://localhost/dir1/index.up.html;type=i", index)
55saved = readfile("/home/ftp/dir1/index.up.html") 41saved = readfile("/var/ftp/dir1/index.up.html")
56check(not err and saved == index, err) 42check(not err and saved == index, err)
57 43
58write("testing file download: ") 44write("testing file download: ")
@@ -78,7 +64,7 @@ back, err = FTP.get("ftp://luasocket:password@localhost/index.up.html;type=i")
78check(not err and back == index, err) 64check(not err and back == index, err)
79 65
80write("testing weird-character translation: ") 66write("testing weird-character translation: ")
81back, err = FTP.get("ftp://luasocket:password@localhost/%2fhome/ftp/dir1/index.html;type=i") 67back, err = FTP.get("ftp://luasocket:password@localhost/%2fvar/ftp/dir1/index.html;type=i")
82check(not err and back == index, err) 68check(not err and back == index, err)
83 69
84write("testing parameter overriding: ") 70write("testing parameter overriding: ")
@@ -100,12 +86,12 @@ local c, e = connect("", 21)
100check(not back and err == e, err) 86check(not back and err == e, err)
101 87
102write("testing directory listing: ") 88write("testing directory listing: ")
103expected = capture("ls -F /home/ftp/dir1 | grep -v /") 89expected = capture("ls -F /var/ftp/dir1 | grep -v /")
104back, err = FTP.get("ftp://localhost/dir1;type=d") 90back, err = FTP.get("ftp://localhost/dir1;type=d")
105check(similar(back, expected)) 91check(similar(back, expected))
106 92
107write("testing home directory listing: ") 93write("testing home directory listing: ")
108expected = capture("ls -F /home/ftp | grep -v /") 94expected = capture("ls -F /var/ftp | grep -v /")
109back, err = FTP.get("ftp://localhost/") 95back, err = FTP.get("ftp://localhost/")
110check(back and similar(back, expected), nil, err) 96check(back and similar(back, expected), nil, err)
111 97