tests: add test for locale decimal processing
[coreutils.git] / tests / misc / test-N.sh
blob348139b9f15d2f0fd6456fb0c139d18cd1195b54
1 #!/bin/sh
2 # Test 'test -N file'.
4 # Copyright (C) 2018-2019 Free Software Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <https://www.gnu.org/licenses/>.
19 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
20 print_ver_ test
22 # For a freshly touched file, atime should equal mtime: 'test -N' returns 1.
23 touch file || framework_failure_
24 stat file
25 returns_ 1 env test -N file || fail=1
27 # Set access time to 2 days ago: 'test -N' returns 0.
28 touch -a -d "12:00 today -2 days" file || framework_failure_
29 stat file
30 env test -N file || fail=1
32 # Set mtime to 2 days before atime: 'test -N' returns 1;
33 touch -m -d "12:00 today -4 days" file || framework_failure_
34 stat file
35 returns_ 1 env test -N file || fail=1
37 # Now modify the file: 'test -N' returns 0.
38 > file || framework_failure_
39 stat file
40 env test -N file || fail=1
42 Exit $fail