1 | #!/bin/bash |
---|
2 | # ------------------------------------------------------------------------------ |
---|
3 | # (C) British Crown Copyright 2006-17 Met Office. |
---|
4 | # |
---|
5 | # This file is part of FCM, tools for managing and building source code. |
---|
6 | # |
---|
7 | # FCM is free software: you can redistribute it and/or modify |
---|
8 | # it under the terms of the GNU General Public License as published by |
---|
9 | # the Free Software Foundation, either version 3 of the License, or |
---|
10 | # (at your option) any later version. |
---|
11 | # |
---|
12 | # FCM is distributed in the hope that it will be useful, |
---|
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
15 | # GNU General Public License for more details. |
---|
16 | # |
---|
17 | # You should have received a copy of the GNU General Public License |
---|
18 | # along with FCM. If not, see <http://www.gnu.org/licenses/>. |
---|
19 | # ------------------------------------------------------------------------------ |
---|
20 | # Basic tests for "fcm keyword-print". |
---|
21 | #------------------------------------------------------------------------------- |
---|
22 | . $(dirname $0)/test_header |
---|
23 | svnadmin create plants |
---|
24 | URL="file://$PWD/plants" |
---|
25 | svn mkdir --parents -q -m 'test' $URL/{daisy,ivy,holly}/trunk |
---|
26 | mkdir -p conf |
---|
27 | cat >conf/keyword.cfg <<__CFG__ |
---|
28 | location{primary}[daisy]=$URL/daisy/ |
---|
29 | location{primary}[ivy]=$URL/ivy// |
---|
30 | location{primary}[holly]=$URL/holly |
---|
31 | __CFG__ |
---|
32 | export FCM_CONF_PATH=$PWD/conf |
---|
33 | #------------------------------------------------------------------------------- |
---|
34 | tests 21 |
---|
35 | #------------------------------------------------------------------------------- |
---|
36 | TEST_KEY="$TEST_KEY_BASE" # no argument |
---|
37 | run_pass "$TEST_KEY" fcm kp |
---|
38 | file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__ |
---|
39 | location{primary}[daisy] = $URL/daisy |
---|
40 | location{primary}[holly] = $URL/holly |
---|
41 | location{primary}[ivy] = $URL/ivy |
---|
42 | __OUT__ |
---|
43 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
44 | #------------------------------------------------------------------------------- |
---|
45 | for NS in daisy ivy holly; do |
---|
46 | TEST_KEY="$TEST_KEY_BASE-$NS" # normal mode |
---|
47 | run_pass "$TEST_KEY" fcm kp fcm:$NS |
---|
48 | file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__ |
---|
49 | location{primary}[$NS] = $URL/$NS |
---|
50 | __OUT__ |
---|
51 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
52 | |
---|
53 | TEST_KEY="$TEST_KEY_BASE-v-$NS" # verbose mode |
---|
54 | run_pass "$TEST_KEY" fcm kp -v fcm:$NS |
---|
55 | file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__ |
---|
56 | location{primary}[$NS] = $URL/$NS |
---|
57 | location[${NS}-br] = $URL/$NS/branches |
---|
58 | location[${NS}-tg] = $URL/$NS/tags |
---|
59 | location[${NS}-tr] = $URL/$NS/trunk |
---|
60 | location[${NS}_br] = $URL/$NS/branches |
---|
61 | location[${NS}_tg] = $URL/$NS/tags |
---|
62 | location[${NS}_tr] = $URL/$NS/trunk |
---|
63 | __OUT__ |
---|
64 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
65 | done |
---|
66 | #------------------------------------------------------------------------------- |
---|
67 | exit |
---|