diff options
author | carregal <carregal> | 2007-05-17 23:08:20 +0000 |
---|---|---|
committer | carregal <carregal> | 2007-05-17 23:08:20 +0000 |
commit | 4e23cb01d902c2e43ed1e2df96f67042962146c2 (patch) | |
tree | c295551ea11652df22a7e0b71030bdc32c233e86 /tests/test.lua | |
parent | 7ee2d8e1b24a0ae3f671fc852e42301c017f0576 (diff) | |
download | luafilesystem-4e23cb01d902c2e43ed1e2df96f67042962146c2.tar.gz luafilesystem-4e23cb01d902c2e43ed1e2df96f67042962146c2.tar.bz2 luafilesystem-4e23cb01d902c2e43ed1e2df96f67042962146c2.zip |
Corrected 1 of 2 bugs on the test script found by Shmuel Zeigerman: the use of /tmp as a necessary directory.
Corrected a bug on the test script on slow fliesystems due to the reliance on close times
Diffstat (limited to 'tests/test.lua')
-rw-r--r-- | tests/test.lua | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/tests/test.lua b/tests/test.lua index 70f90d5..cf1e573 100644 --- a/tests/test.lua +++ b/tests/test.lua | |||
@@ -34,7 +34,7 @@ assert (lfs.currentdir() == current, "error trying to change directories") | |||
34 | assert (lfs.chdir ("this couldn't be an actual directory") == nil, "could change to a non-existent directory") | 34 | assert (lfs.chdir ("this couldn't be an actual directory") == nil, "could change to a non-existent directory") |
35 | 35 | ||
36 | -- Changing creating and removing directories | 36 | -- Changing creating and removing directories |
37 | local tmpdir = tmp..sep.."lfs_tmp_dir" | 37 | local tmpdir = current..sep.."lfs_tmp_dir" |
38 | local tmpfile = tmpdir..sep.."tmp_file" | 38 | local tmpfile = tmpdir..sep.."tmp_file" |
39 | assert (lfs.mkdir (tmpdir), "could not make a new directory") | 39 | assert (lfs.mkdir (tmpdir), "could not make a new directory") |
40 | local attrib, errmsg = lfs.attributes (tmpdir) | 40 | local attrib, errmsg = lfs.attributes (tmpdir) |
@@ -45,19 +45,20 @@ local f = io.open(tmpfile, "w") | |||
45 | f:close() | 45 | f:close() |
46 | 46 | ||
47 | -- Change access time | 47 | -- Change access time |
48 | assert (lfs.touch (tmpfile, 86401)) | 48 | local testdate = os.time({ year = 2007, day = 10, month = 2}) |
49 | assert (lfs.touch (tmpfile, testdate)) | ||
49 | local new_att = assert (lfs.attributes (tmpfile)) | 50 | local new_att = assert (lfs.attributes (tmpfile)) |
50 | assert (new_att.access == 86401, "could not set access time") | 51 | assert (new_att.access == testdate, "could not set access time") |
51 | assert (new_att.modification == 86401, "could not set modification time") | 52 | assert (new_att.modification == testdate, "could not set modification time") |
52 | 53 | ||
53 | -- Change access and modification time | 54 | -- Change access and modification time |
54 | assert (lfs.touch (tmpfile, 86403, 86402)) | 55 | assert (lfs.touch (tmpfile, testdate + 2, testdate + 1)) |
55 | local new_att = assert (lfs.attributes (tmpfile)) | 56 | local new_att = assert (lfs.attributes (tmpfile)) |
56 | assert (new_att.access == 86403, "could not set access time") | 57 | assert (new_att.access == testdate + 2, "could not set access time") |
57 | assert (new_att.modification == 86402, "could not set modification time") | 58 | assert (new_att.modification == testdate + 1, "could not set modification time") |
58 | 59 | ||
59 | -- Restore access time to current value | 60 | -- Restore access time to current value |
60 | assert (lfs.touch (tmpfile)) | 61 | assert (lfs.touch (tmpfile, attrib.access, attrib.modification)) |
61 | new_att = assert (lfs.attributes (tmpfile)) | 62 | new_att = assert (lfs.attributes (tmpfile)) |
62 | assert (new_att.access == attrib.access) | 63 | assert (new_att.access == attrib.access) |
63 | assert (new_att.modification == attrib.modification) | 64 | assert (new_att.modification == attrib.modification) |