From 65dd6185533031421fef4a9fb5f1c919124c86a6 Mon Sep 17 00:00:00 2001 From: Diego Nehab Date: Mon, 8 Jul 2002 21:53:33 +0000 Subject: [PATCH] =?UTF-8?q?Using=20noglobals.lua=20Ajeitados=20alguns=20pa?= =?UTF-8?q?ths.=20N=C3=A3o=20carrega=20mais=20os=20modulos.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/ftptest.lua | 26 ++++++-------------------- 1 file 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 @@ -function mysetglobal (varname, oldvalue, newvalue) - print("changing " .. varname) - %rawset(%globals(), varname, newvalue) -end -function mygetglobal (varname, newvalue) - print("checking " .. varname) - return %rawget(%globals(), varname) -end -settagmethod(tag(nil), "setglobal", mysetglobal) -settagmethod(tag(nil), "getglobal", mygetglobal) - -assert(dofile("../lua/ftp.lua")) -assert(dofile("../lua/url.lua")) -assert(dofile("../lua/concat.lua")) -assert(dofile("../lua/code.lua")) +dofile("noglobals.lua") local similar = function(s1, s2) return strlower(gsub(s1, "%s", "")) == strlower(gsub(s2, "%s", "")) @@ -50,9 +36,9 @@ local t = _time() index = readfile("index.html") write("testing file upload: ") -remove("/home/ftp/dir1/index.up.html") +remove("/var/ftp/dir1/index.up.html") err = FTP.put("ftp://localhost/dir1/index.up.html;type=i", index) -saved = readfile("/home/ftp/dir1/index.up.html") +saved = readfile("/var/ftp/dir1/index.up.html") check(not err and saved == index, err) write("testing file download: ") @@ -78,7 +64,7 @@ back, err = FTP.get("ftp://luasocket:password@localhost/index.up.html;type=i") check(not err and back == index, err) write("testing weird-character translation: ") -back, err = FTP.get("ftp://luasocket:password@localhost/%2fhome/ftp/dir1/index.html;type=i") +back, err = FTP.get("ftp://luasocket:password@localhost/%2fvar/ftp/dir1/index.html;type=i") check(not err and back == index, err) write("testing parameter overriding: ") @@ -100,12 +86,12 @@ local c, e = connect("", 21) check(not back and err == e, err) write("testing directory listing: ") -expected = capture("ls -F /home/ftp/dir1 | grep -v /") +expected = capture("ls -F /var/ftp/dir1 | grep -v /") back, err = FTP.get("ftp://localhost/dir1;type=d") check(similar(back, expected)) write("testing home directory listing: ") -expected = capture("ls -F /home/ftp | grep -v /") +expected = capture("ls -F /var/ftp | grep -v /") back, err = FTP.get("ftp://localhost/") check(back and similar(back, expected), nil, err)