aboutsummaryrefslogtreecommitdiff
path: root/tests/touch.test
blob: d6430d0d359ee8929a6a4304b042e3bdf580fea0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash

[ -f testing.sh ] && . testing.sh

#testing "name" "command" "result" "infile" "stdin"

testing "touch" "touch walrus && [ -e walrus ] && echo yes" "yes\n" "" ""
testing "touch 1 2 3" "touch one two three && rm one two three && echo yes" "yes\n" \
  "" ""
testing "touch -c" "touch -c walrus && [ -e walrus ] && echo yes" "yes\n" "" ""
testing "touch -c missing" "touch -c warrus && [ ! -e warrus ] && echo yes" \
  "yes\n" "" ""

testing "touch -d" \
  "touch -d 2009-02-13T23:31:30Z walrus && date -r walrus +%s" \
  "1234567890\n" "" ""

testing "touch -d nanoseconds" \
  "touch -d 2009-02-13T23:31:30.123456789Z walrus && date -r walrus +%s.%N" \
  "1234567890.123456789\n" "" ""

testing "touch -r" \
  "touch -r walrus walrus2 && date -r walrus2 +%s.%N" \
   "1234567890.123456789\n" "" ""

#testing "touch -a"
#testing "touch -m"
#testing "touch -am"
#testing "touch -t"
rm walrus walrus2