aboutsummaryrefslogtreecommitdiff
path: root/test/ftptest.lua
diff options
context:
space:
mode:
authorDiego Nehab <diego@tecgraf.puc-rio.br>2001-01-25 21:59:39 +0000
committerDiego Nehab <diego@tecgraf.puc-rio.br>2001-01-25 21:59:39 +0000
commit7096b8df82eebfe857e0043bc8a853353bd78480 (patch)
treef5cdc12138e9526896ff5f8fe9e3ffaa0c47fc0c /test/ftptest.lua
parent68f51243b38bf1e32d471e9cc9ddf12a25110e80 (diff)
downloadluasocket-7096b8df82eebfe857e0043bc8a853353bd78480.tar.gz
luasocket-7096b8df82eebfe857e0043bc8a853353bd78480.tar.bz2
luasocket-7096b8df82eebfe857e0043bc8a853353bd78480.zip
Initial revision
Diffstat (limited to 'test/ftptest.lua')
-rw-r--r--test/ftptest.lua33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/ftptest.lua b/test/ftptest.lua
new file mode 100644
index 0000000..85dc16b
--- /dev/null
+++ b/test/ftptest.lua
@@ -0,0 +1,33 @@
1assert(dofile("../lua/ftp.lua"))
2assert(dofile("auxiliar.lua"))
3
4pdir = "/home/i/diego/public/html/luasocket/test/"
5ldir = "/home/luasocket/"
6adir = "/home/ftp/test/"
7
8-- needs an accound luasocket:password
9-- and a copy of /home/i/diego/public/html/luasocket/test in ~ftp/test
10
11print("testing authenticated upload")
12bf = readfile(pdir .. "index.html")
13e = ftp_put("ftp://luasocket:password@localhost/index.html", bf, "b")
14assert(not e, e)
15assert(compare(ldir .. "index.html", bf), "files differ")
16remove(ldir .. "index.html")
17
18print("testing authenticated download")
19f, e = ftp_get("ftp://luasocket:password@localhost/test/index.html", "b")
20assert(f, e)
21assert(compare(pdir .. "index.html", f), "files differ")
22
23print("testing anonymous download")
24f, e = ftp_get("ftp://localhost/test/index.html", "b")
25assert(f, e)
26assert(compare(adir .. "index.html", f), "files differ")
27
28print("testing directory listing")
29f, e = ftp_get("ftp://localhost/test/")
30assert(f, e)
31assert(f == "index.html\r\n", "files differ")
32
33print("passed all tests")