summaryrefslogtreecommitdiff
path: root/test.sh
blob: 5d5f48e9a58fdd3626f2bd15ba5d85e3275abb08 (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
31
32
33
34
35
36
#!/usr/bin/env bash
set -e
function prep {
  mkdir -p test/src
  
  touch ./test/src/a.txt
  touch ./test/src/b.txt
  touch ./test/src/c.txt
  touch ./test/src/d.txt
  touch ./test/src/e.txt
  touch ./test/src/f.txt
  
  export TARGET_CNT=$(ls -1 ./test/src/ | wc -l)

  mkdir -p ./test/dest
  rm -f ./test/dest/*.txt
}

function verify {
  CNT=$(ls -1 ./test/dest/ | wc -l)
  if [[ ${CNT} -ne ${TARGET_CNT} ]]; then
    echo "Test failed: expected ${TARGET_CNT} actual: ${CNT}"
    exit 1
  fi
}

function run {
  export AUTOMV_DIR=$PWD/test/confs
  ./automv.sh
}

prep
run
verify

echo "Tests succeeded"