diff options
author | carregal <carregal> | 2007-05-18 03:08:20 +0400 |
---|---|---|
committer | carregal <carregal> | 2007-05-18 03:08:20 +0400 |
commit | 4e23cb01d902c2e43ed1e2df96f67042962146c2 (patch) | |
tree | c295551ea11652df22a7e0b71030bdc32c233e86 /tests | |
parent | 7ee2d8e1b24a0ae3f671fc852e42301c017f0576 (diff) |
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')
-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") assert (lfs.chdir ("this couldn't be an actual directory") == nil, "could change to a non-existent directory") -- Changing creating and removing directories -local tmpdir = tmp..sep.."lfs_tmp_dir" +local tmpdir = current..sep.."lfs_tmp_dir" local tmpfile = tmpdir..sep.."tmp_file" assert (lfs.mkdir (tmpdir), "could not make a new directory") local attrib, errmsg = lfs.attributes (tmpdir) @@ -45,19 +45,20 @@ local f = io.open(tmpfile, "w") f:close() -- Change access time -assert (lfs.touch (tmpfile, 86401)) +local testdate = os.time({ year = 2007, day = 10, month = 2}) +assert (lfs.touch (tmpfile, testdate)) local new_att = assert (lfs.attributes (tmpfile)) -assert (new_att.access == 86401, "could not set access time") -assert (new_att.modification == 86401, "could not set modification time") +assert (new_att.access == testdate, "could not set access time") +assert (new_att.modification == testdate, "could not set modification time") -- Change access and modification time -assert (lfs.touch (tmpfile, 86403, 86402)) +assert (lfs.touch (tmpfile, testdate + 2, testdate + 1)) local new_att = assert (lfs.attributes (tmpfile)) -assert (new_att.access == 86403, "could not set access time") -assert (new_att.modification == 86402, "could not set modification time") +assert (new_att.access == testdate + 2, "could not set access time") +assert (new_att.modification == testdate + 1, "could not set modification time") -- Restore access time to current value -assert (lfs.touch (tmpfile)) +assert (lfs.touch (tmpfile, attrib.access, attrib.modification)) new_att = assert (lfs.attributes (tmpfile)) assert (new_att.access == attrib.access) assert (new_att.modification == attrib.modification) |