Fix bug where accessed times were wrong!

It used the mtime, rather than the atime. Copy and paste error. Whoops!
This commit is contained in:
Benjamin Sago 2017-07-05 22:07:03 +01:00
parent ba335bb6e7
commit 5bdf6304bb
5 changed files with 16 additions and 1 deletions

2
Vagrantfile vendored
View File

@ -320,6 +320,8 @@ Vagrant.configure(2) do |config|
touch -t #{old} -a "#{test_dir}/dates/plum" touch -t #{old} -a "#{test_dir}/dates/plum"
touch -t #{med} -a "#{test_dir}/dates/pear" touch -t #{med} -a "#{test_dir}/dates/pear"
touch -t #{new} -a "#{test_dir}/dates/peach" touch -t #{new} -a "#{test_dir}/dates/peach"
sudo chown #{user}:#{user} -R "#{test_dir}/dates"
EOF EOF

View File

@ -282,7 +282,7 @@ impl<'dir> File<'dir> {
} }
pub fn accessed_time(&self) -> f::Time { pub fn accessed_time(&self) -> f::Time {
f::Time(self.metadata.mtime()) f::Time(self.metadata.atime())
} }
/// This file's 'type'. /// This file's 'type'.

4
xtests/dates_accessed Normal file
View File

@ -0,0 +1,4 @@
Permissions Size User Date Accessed Name
.rw-rw-r-- 0 cassowary  3 Mar 2003 plum
.rw-rw-r-- 0 cassowary 15 Jun 2006 pear
.rw-rw-r-- 0 cassowary 22 Jul 2009 peach

4
xtests/dates_modified Normal file
View File

@ -0,0 +1,4 @@
Permissions Size User Date Modified Name
.rw-rw-r-- 0 cassowary  3 Mar 2003 pear
.rw-rw-r-- 0 cassowary 15 Jun 2006 peach
.rw-rw-r-- 0 cassowary 22 Jul 2009 plum

View File

@ -107,6 +107,11 @@ $exa $testcases/file-names-exts/music.* -I "*.OGG" -1 2>&1 | diff -q - $re
$exa $testcases/file-names-exts/music.* -I "*.OGG|*.mp3" -1 2>&1 | diff -q - $results/empty || exit 1 $exa $testcases/file-names-exts/music.* -I "*.OGG|*.mp3" -1 2>&1 | diff -q - $results/empty || exit 1
# Dates and times
$exa $testcases/dates -lh --accessed --sort=accessed 2>&1 | diff -q - $results/dates_accessed || exit 1
$exa $testcases/dates -lh --sort=modified 2>&1 | diff -q - $results/dates_modified || exit 1
# Paths and directories # Paths and directories
# These directories are created in the VM users home directory (the default # These directories are created in the VM users home directory (the default
# location) when a Cargo build is done. # location) when a Cargo build is done.