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 diff". |
---|
21 | #------------------------------------------------------------------------------- |
---|
22 | . $(dirname $0)/test_header |
---|
23 | #------------------------------------------------------------------------------- |
---|
24 | check_svn_version |
---|
25 | tests 3 |
---|
26 | #------------------------------------------------------------------------------- |
---|
27 | setup |
---|
28 | init_repos |
---|
29 | init_branch_wc branch_test $REPOS_URL |
---|
30 | cd $TEST_DIR/wc |
---|
31 | FILE_LIST="./lib/python/info/__init__.py |
---|
32 | ./lib/python/info/poems.py |
---|
33 | ./module/hello_constants.f90 |
---|
34 | ./module/hello_constants.inc |
---|
35 | ./module/hello_constants_dummy.inc |
---|
36 | " |
---|
37 | for FILE in $FILE_LIST; do |
---|
38 | sed -i "s/for/FOR/g; s/fi/end if/g; s/in/IN/g;" $FILE |
---|
39 | sed -i "/#/d; /^ *!/d" $FILE |
---|
40 | sed -i "s/!/!!/g; s/q/\nq/g; s/[(]/(\n/g" $FILE |
---|
41 | done |
---|
42 | FILE_DIR=$(dirname $FILE) |
---|
43 | svn copy -q $FILE added_file |
---|
44 | svn copy -q $FILE_DIR added_directory |
---|
45 | svn delete --force -q $FILE_DIR |
---|
46 | #------------------------------------------------------------------------------- |
---|
47 | # Tests fcm branch-diff |
---|
48 | TEST_KEY=$TEST_KEY_BASE-fcm-diff |
---|
49 | run_pass "$TEST_KEY" fcm diff |
---|
50 | diff_sort "$TEST_DIR/$TEST_KEY.out" "$TEST_DIR/$TEST_KEY.sorted.out" |
---|
51 | file_cmp "$TEST_KEY.sorted.out" "$TEST_KEY.sorted.out" <<'__OUT__' |
---|
52 | |
---|
53 | Index: added_directory/hello_constants.f90 |
---|
54 | =================================================================== |
---|
55 | --- added_directory/hello_constants.f90 (revision 4) |
---|
56 | +++ added_directory/hello_constants.f90 (working copy) |
---|
57 | @@ -1,5 +1,5 @@ |
---|
58 | MODULE Hello_Constants |
---|
59 | |
---|
60 | -INCLUDE 'hello_constants_dummy.inc' |
---|
61 | +INCLUDE 'hello_constants_dummy.INc' |
---|
62 | |
---|
63 | END MODULE Hello_Constants |
---|
64 | Index: added_directory/hello_constants.inc |
---|
65 | =================================================================== |
---|
66 | --- added_directory/hello_constants.inc (revision 4) |
---|
67 | +++ added_directory/hello_constants.inc (working copy) |
---|
68 | @@ -1 +1,2 @@ |
---|
69 | -CHARACTER (LEN=80), PARAMETER :: hello_string = 'Hello Earth!' |
---|
70 | +CHARACTER ( |
---|
71 | +LEN=80), PARAMETER :: hello_strINg = 'Hello Earth!!' |
---|
72 | Index: added_directory/hello_constants_dummy.inc |
---|
73 | =================================================================== |
---|
74 | --- added_directory/hello_constants_dummy.inc (revision 4) |
---|
75 | +++ added_directory/hello_constants_dummy.inc (working copy) |
---|
76 | @@ -1 +1 @@ |
---|
77 | -INCLUDE 'hello_constants.inc' |
---|
78 | +INCLUDE 'hello_constants.INc' |
---|
79 | Index: added_file |
---|
80 | =================================================================== |
---|
81 | --- added_file (revision 4) |
---|
82 | +++ added_file (working copy) |
---|
83 | @@ -1 +1 @@ |
---|
84 | -INCLUDE 'hello_constants.inc' |
---|
85 | +INCLUDE 'hello_constants.INc' |
---|
86 | Index: lib/python/info/poems.py |
---|
87 | =================================================================== |
---|
88 | --- lib/python/info/poems.py (revision 4) |
---|
89 | +++ lib/python/info/poems.py (working copy) |
---|
90 | @@ -1,24 +1,23 @@ |
---|
91 | -#!/usr/bin/env python |
---|
92 | -# -*- coding: utf-8 -*- |
---|
93 | """The Python, by Hilaire Belloc |
---|
94 | |
---|
95 | A Python I should not advise,-- |
---|
96 | -It needs a doctor for its eyes, |
---|
97 | +It needs a doctor FOR its eyes, |
---|
98 | And has the measles yearly. |
---|
99 | -However, if you feel inclined |
---|
100 | -To get one (to improve your mind, |
---|
101 | +However, if you feel INclINed |
---|
102 | +To get one ( |
---|
103 | +to improve your mINd, |
---|
104 | And not from fashion merely), |
---|
105 | Allow no music near its cage; |
---|
106 | -And when it flies into a rage |
---|
107 | +And when it flies INto a rage |
---|
108 | Chastise it, most severely. |
---|
109 | -I had an aunt in Yucatan |
---|
110 | +I had an aunt IN Yucatan |
---|
111 | Who bought a Python from a man |
---|
112 | -And kept it for a pet. |
---|
113 | +And kept it FOR a pet. |
---|
114 | She died, because she never knew |
---|
115 | These simple little rules and few;-- |
---|
116 | -The Snake is living yet. |
---|
117 | +The Snake is livINg yet. |
---|
118 | """ |
---|
119 | |
---|
120 | import this |
---|
121 | |
---|
122 | -print "\n", __doc__ |
---|
123 | +prINt "\n", __doc__ |
---|
124 | Index: module/hello_constants.f90 |
---|
125 | =================================================================== |
---|
126 | --- module/hello_constants.f90 (revision 4) |
---|
127 | +++ module/hello_constants.f90 (working copy) |
---|
128 | @@ -1,5 +0,0 @@ |
---|
129 | -MODULE Hello_Constants |
---|
130 | - |
---|
131 | -INCLUDE 'hello_constants_dummy.inc' |
---|
132 | - |
---|
133 | -END MODULE Hello_Constants |
---|
134 | Index: module/hello_constants.inc |
---|
135 | =================================================================== |
---|
136 | --- module/hello_constants.inc (revision 4) |
---|
137 | +++ module/hello_constants.inc (working copy) |
---|
138 | @@ -1 +0,0 @@ |
---|
139 | -CHARACTER (LEN=80), PARAMETER :: hello_string = 'Hello Earth!' |
---|
140 | Index: module/hello_constants_dummy.inc |
---|
141 | =================================================================== |
---|
142 | --- module/hello_constants_dummy.inc (revision 4) |
---|
143 | +++ module/hello_constants_dummy.inc (working copy) |
---|
144 | @@ -1 +0,0 @@ |
---|
145 | -INCLUDE 'hello_constants.inc' |
---|
146 | __OUT__ |
---|
147 | file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null |
---|
148 | teardown |
---|
149 | #------------------------------------------------------------------------------- |
---|