source: vendors/FCM-2017.10.0/t/fcm-add/00-simple.t @ 11150

Last change on this file since 11150 was 10672, checked in by nicolasmartin, 3 years ago

Reimport latest FCM release

File size: 5.7 KB
Line 
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 add".
21#-------------------------------------------------------------------------------
22. $(dirname $0)/test_header
23if [[ $? -ne 0 ]]; then
24    exit 1
25fi
26#-------------------------------------------------------------------------------
27check_svn_version
28tests 24
29#-------------------------------------------------------------------------------
30setup
31init_repos
32init_branch_wc add $REPOS_URL
33mkdir $TEST_DIR/wc/added_directory1
34svn add -q $TEST_DIR/wc/added_directory1
35touch $TEST_DIR/wc/added_directory1/added_file1
36mkdir $TEST_DIR/wc/added_directory2
37touch $TEST_DIR/wc/added_directory2/added_file2
38cd $TEST_DIR/wc
39#-------------------------------------------------------------------------------
40# Tests fcm add unversioned file
41TEST_KEY=$TEST_KEY_BASE-fcm-add-file
42run_pass "$TEST_KEY" fcm add added_directory1/added_file1
43file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<'__OUT__'
44A         added_directory1/added_file1
45__OUT__
46file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
47#-------------------------------------------------------------------------------
48# Tests fcm add unversioned directory
49TEST_KEY=$TEST_KEY_BASE-fcm-add-dir
50run_pass "$TEST_KEY" fcm add added_directory2
51# Add produces yet another format of status - just use 'sort'...
52sort "$TEST_DIR/$TEST_KEY.out" -o "$TEST_DIR/$TEST_KEY.sorted.out"
53file_cmp "$TEST_KEY.sorted.out" "$TEST_KEY.sorted.out" <<'__OUT__'
54A         added_directory2
55A         added_directory2/added_file2
56__OUT__
57file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
58cd $TEST_DIR
59teardown
60#-------------------------------------------------------------------------------
61init_repos
62init_branch_wc add_c $REPOS_URL
63touch $TEST_DIR/wc/unversioned_file
64mkdir $TEST_DIR/wc/unversioned_directory
65touch $TEST_DIR/wc/unversioned_directory/unversioned_file_2
66mkdir $TEST_DIR/wc/versioned_directory
67svn add -q $TEST_DIR/wc/versioned_directory
68touch $TEST_DIR/wc/versioned_directory/unversioned_file_3
69cd $TEST_DIR/wc
70#-------------------------------------------------------------------------------
71# Tests fcm add -c unversioned file
72TEST_KEY=$TEST_KEY_BASE-fcm-add-c-file
73run_pass "$TEST_KEY" fcm add -c unversioned_file <<'__EOF__'
74y
75__EOF__
76file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<'__OUT__'
77?       unversioned_file
78Would you like to run "svn add unversioned_file"?
79Enter "y", "n" or "a" (or just press <return> for "n"): A         unversioned_file
80__OUT__
81file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
82#-------------------------------------------------------------------------------
83# Tests fcm add -c unversioned directory
84TEST_KEY=$TEST_KEY_BASE-fcm-add-c-dir
85run_pass "$TEST_KEY" fcm add -c unversioned_directory <<'__EOF__'
86y
87__EOF__
88file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<'__OUT__'
89?       unversioned_directory
90Would you like to run "svn add unversioned_directory"?
91Enter "y", "n" or "a" (or just press <return> for "n"): A         unversioned_directory
92A         unversioned_directory/unversioned_file_2
93__OUT__
94file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
95#-------------------------------------------------------------------------------
96# Tests fcm add -c versioned directory
97TEST_KEY=$TEST_KEY_BASE-fcm-add-c-versioned-dir
98run_pass "$TEST_KEY" fcm add -c versioned_directory <<'__EOF__'
99n
100__EOF__
101file_test "$TEST_KEY.out" "$TEST_KEY.out" -s
102file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
103#-------------------------------------------------------------------------------
104# Tests fcm status after above tests
105TEST_KEY=$TEST_KEY_BASE-fcm-add-c-status
106run_pass "$TEST_KEY" fcm st
107status_sort "$TEST_DIR/$TEST_KEY.out" "$TEST_DIR/$TEST_KEY.sorted.out"
108file_cmp "$TEST_KEY.sorted.out" "$TEST_KEY.sorted.out" <<'__OUT__'
109?       versioned_directory/unversioned_file_3
110A       unversioned_directory
111A       unversioned_directory/unversioned_file_2
112A       unversioned_file
113A       versioned_directory
114__OUT__
115file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
116#-------------------------------------------------------------------------------
117# Tests fcm add -c with no arguments
118TEST_KEY=$TEST_KEY_BASE-fcm-add-c-no-args
119fcm revert -q -R $TEST_DIR/wc/
120run_pass "$TEST_KEY" fcm add -c <<'__EOF__'
121y
122y
123y
124y
125__EOF__
126file_test "$TEST_KEY.out" "$TEST_KEY.out" -s
127file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
128#-------------------------------------------------------------------------------
129# Tests fcm status after above tests
130TEST_KEY=$TEST_KEY_BASE-fcm-add-c-no-args-status
131run_pass "$TEST_KEY" fcm status
132status_sort "$TEST_DIR/$TEST_KEY.out" "$TEST_DIR/$TEST_KEY.sorted.out"
133file_cmp "$TEST_KEY.sorted.out" "$TEST_KEY.sorted.out" <<'__OUT__'
134A       unversioned_directory
135A       unversioned_directory/unversioned_file_2
136A       unversioned_file
137A       versioned_directory
138A       versioned_directory/unversioned_file_3
139__OUT__
140file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
141teardown
142#-------------------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.