Follow upstream changes -- rest
[git-darcs-import.git] / tests / overriding-defaults.sh
blob4621c31ba654df8193a7a8a1adb28670a2bc58e4
1 #!/usr/bin/env bash
2 set -ev
4 ## The builtin ! has the wrong semantics for not.
5 not () { "$@" && exit 1 || :; }
7 rm -rf temp
8 mkdir temp
9 cd temp
10 darcs init
11 darcs setpref test false
12 darcs record --no-test -a -m 'add failing test'
14 # should pass with --no-test
15 darcs check --no-test
17 # should fail when test is run
18 not darcs check --test
20 # should pass with --no-test in defaults
21 echo check --no-test > _darcs/prefs/defaults
22 darcs check
23 not darcs check --test
25 # should fail with --test in defaults
26 echo check --test > _darcs/prefs/defaults
27 not darcs check
28 darcs check --no-test
30 # check global defaults
31 cp ~/.darcs/defaults defaults.backup
32 rm _darcs/prefs/defaults
34 # --no-test works in global defaults
35 echo check --no-test > ~/.darcs/defaults
36 darcs check
37 not darcs check --test
39 # --test works in global defaults
40 echo check --test > ~/.darcs/defaults
41 not darcs check
42 darcs check --no-test
44 # Verify that per-repository defaults override global defaults
46 # --no-test in repository defaults overrides global --test
47 echo check --test > ~/.darcs/defaults
48 echo check --no-test > _darcs/prefs/defaults
49 darcs check
50 not darcs check --test
52 # --test in repository defaults overrides global --no-test
53 echo check --no-test > ~/.darcs/defaults
54 echo check --test > _darcs/prefs/defaults
55 not darcs check
56 darcs check --no-test
58 cp defaults.backup ~/.darcs/defaults
60 cd ..
61 rm -rf temp