diff options
author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2002-07-08 21:53:33 +0000 |
---|---|---|
committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2002-07-08 21:53:33 +0000 |
commit | 65dd6185533031421fef4a9fb5f1c919124c86a6 (patch) | |
tree | 9c406e76fb3cc09bb1271d9d368f4d1fef4c0666 | |
parent | 5b2a124305f26d36e95b639b1c70a32368f03261 (diff) | |
download | luasocket-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.lua | 26 |
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 @@ | |||
1 | function mysetglobal (varname, oldvalue, newvalue) | 1 | dofile("noglobals.lua") |
2 | print("changing " .. varname) | ||
3 | %rawset(%globals(), varname, newvalue) | ||
4 | end | ||
5 | function mygetglobal (varname, newvalue) | ||
6 | print("checking " .. varname) | ||
7 | return %rawget(%globals(), varname) | ||
8 | end | ||
9 | settagmethod(tag(nil), "setglobal", mysetglobal) | ||
10 | settagmethod(tag(nil), "getglobal", mygetglobal) | ||
11 | |||
12 | assert(dofile("../lua/ftp.lua")) | ||
13 | assert(dofile("../lua/url.lua")) | ||
14 | assert(dofile("../lua/concat.lua")) | ||
15 | assert(dofile("../lua/code.lua")) | ||
16 | 2 | ||
17 | local similar = function(s1, s2) | 3 | local 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() | |||
50 | index = readfile("index.html") | 36 | index = readfile("index.html") |
51 | 37 | ||
52 | write("testing file upload: ") | 38 | write("testing file upload: ") |
53 | remove("/home/ftp/dir1/index.up.html") | 39 | remove("/var/ftp/dir1/index.up.html") |
54 | err = FTP.put("ftp://localhost/dir1/index.up.html;type=i", index) | 40 | err = FTP.put("ftp://localhost/dir1/index.up.html;type=i", index) |
55 | saved = readfile("/home/ftp/dir1/index.up.html") | 41 | saved = readfile("/var/ftp/dir1/index.up.html") |
56 | check(not err and saved == index, err) | 42 | check(not err and saved == index, err) |
57 | 43 | ||
58 | write("testing file download: ") | 44 | write("testing file download: ") |
@@ -78,7 +64,7 @@ back, err = FTP.get("ftp://luasocket:password@localhost/index.up.html;type=i") | |||
78 | check(not err and back == index, err) | 64 | check(not err and back == index, err) |
79 | 65 | ||
80 | write("testing weird-character translation: ") | 66 | write("testing weird-character translation: ") |
81 | back, err = FTP.get("ftp://luasocket:password@localhost/%2fhome/ftp/dir1/index.html;type=i") | 67 | back, err = FTP.get("ftp://luasocket:password@localhost/%2fvar/ftp/dir1/index.html;type=i") |
82 | check(not err and back == index, err) | 68 | check(not err and back == index, err) |
83 | 69 | ||
84 | write("testing parameter overriding: ") | 70 | write("testing parameter overriding: ") |
@@ -100,12 +86,12 @@ local c, e = connect("", 21) | |||
100 | check(not back and err == e, err) | 86 | check(not back and err == e, err) |
101 | 87 | ||
102 | write("testing directory listing: ") | 88 | write("testing directory listing: ") |
103 | expected = capture("ls -F /home/ftp/dir1 | grep -v /") | 89 | expected = capture("ls -F /var/ftp/dir1 | grep -v /") |
104 | back, err = FTP.get("ftp://localhost/dir1;type=d") | 90 | back, err = FTP.get("ftp://localhost/dir1;type=d") |
105 | check(similar(back, expected)) | 91 | check(similar(back, expected)) |
106 | 92 | ||
107 | write("testing home directory listing: ") | 93 | write("testing home directory listing: ") |
108 | expected = capture("ls -F /home/ftp | grep -v /") | 94 | expected = capture("ls -F /var/ftp | grep -v /") |
109 | back, err = FTP.get("ftp://localhost/") | 95 | back, err = FTP.get("ftp://localhost/") |
110 | check(back and similar(back, expected), nil, err) | 96 | check(back and similar(back, expected), nil, err) |
111 | 97 | ||