diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2021-01-23 15:13:48 -0300 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2021-01-23 15:49:05 -0300 |
| commit | d68db4ca79b31c923442fcc5013e92473309f8c2 (patch) | |
| tree | 47e50f5e3e593db23e8944b7cfbfb90839b1e2a2 /tests | |
| parent | 6adf412a256181e07b4859c3703fb4dc6023007e (diff) | |
| download | luafilesystem-high-precision-times.tar.gz luafilesystem-high-precision-times.tar.bz2 luafilesystem-high-precision-times.zip | |
accept high-precision timestamps in lfs.touchhigh-precision-times
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test.lua | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/test.lua b/tests/test.lua index 3ace810..5d00e44 100644 --- a/tests/test.lua +++ b/tests/test.lua | |||
| @@ -79,6 +79,19 @@ assert (new_att.modification == testdate, "could not set modification time") | |||
| 79 | io.write(".") | 79 | io.write(".") |
| 80 | io.flush() | 80 | io.flush() |
| 81 | 81 | ||
| 82 | -- High-precision attributes | ||
| 83 | local testdate_hi = os.time({ year = 2021, day = 1, month = 23, hour=0}) + 0.5555 | ||
| 84 | assert (lfs.touch (tmpfile, testdate_hi)) | ||
| 85 | local new_att_hi = assert (lfs.attributes (tmpfile)) | ||
| 86 | if new_att_hi.modification ~= testdate_hi then | ||
| 87 | io.write("\n") | ||
| 88 | io.write("warning: no support for high-precision timestamps\n") | ||
| 89 | io.flush() | ||
| 90 | end | ||
| 91 | |||
| 92 | io.write(".") | ||
| 93 | io.flush() | ||
| 94 | |||
| 82 | -- Change access and modification time | 95 | -- Change access and modification time |
| 83 | local testdate1 = os.time({ year = 2007, day = 10, month = 2, hour=0}) | 96 | local testdate1 = os.time({ year = 2007, day = 10, month = 2, hour=0}) |
| 84 | local testdate2 = os.time({ year = 2007, day = 11, month = 2, hour=0}) | 97 | local testdate2 = os.time({ year = 2007, day = 11, month = 2, hour=0}) |
| @@ -194,7 +207,7 @@ io.write(".") | |||
| 194 | io.flush() | 207 | io.flush() |
| 195 | 208 | ||
| 196 | -- Stressing directory iterator | 209 | -- Stressing directory iterator |
| 197 | count = 0 | 210 | local count = 0 |
| 198 | for i = 1, 4000 do | 211 | for i = 1, 4000 do |
| 199 | for file in lfs.dir (tmp) do | 212 | for file in lfs.dir (tmp) do |
| 200 | count = count + 1 | 213 | count = count + 1 |
