Fossil SCM

Add some tests for -close and -hide.

andybradford 2015-08-01 06:46 UTC check-in-edit
Commit b1dd95c7d9645bf4d3fca750b7ad99ef7cf76843
1 file changed +50 -1
+50 -1
--- test/amend.test
+++ test/amend.test
@@ -11,10 +11,12 @@
1111
write_file datafile "data"
1212
write_file commitmsg "committed"
1313
1414
fossil add datafile
1515
fossil commit -m "c1"
16
+write_file datafile "data.file"
17
+fossil commit -m "c2"
1618
if {![regexp {^New_Version: ([0-9a-f]{40})$} $RESULT m UUID]} {
1719
test amend-setup-failure false
1820
return
1921
}
2022
@@ -127,7 +129,54 @@
127129
set sc 0
128130
foreach badformat $badformats {
129131
incr sc
130132
set datetime [clock format $timestamp -format $badformat -gmt 1]
131133
fossil amend $UUID -date $datetime
132
- test amend-date-2.$sc {[string first "Unsupported date format, use YYYY-MM-DD HH:MM:SS" $RESULT] != -1}
134
+ test amend-date-2.$sc {[string first "YYYY-MM-DD HH:MM:SS" $RESULT] != -1}
135
+}
136
+
137
+########################################
138
+# Test: -hide #
139
+########################################
140
+fossil amend $UUID -hide
141
+test amend-hide-1.1 {[string match "*uuid:*$UUID*" $RESULT]}
142
+fossil tag ls --raw $UUID
143
+test amend-hide-1.2 {[string first "hidden" $RESULT] != -1}
144
+fossil timeline -n 1
145
+test amend-hide-1.3 {[string match {*Add*propagating*"hidden".*} $RESULT]}
146
+
147
+########################################
148
+# Test: -close #
149
+########################################
150
+fossil amend $UUID -close
151
+test amend-close-1.1 {[string match "*uuid:*$UUID*" $RESULT]}
152
+fossil tag ls --raw $UUID
153
+test amend-close-1.2 {[string first "closed" $RESULT] != -1}
154
+fossil timeline -n 1
155
+test amend-close-1.3 {[string match {*Marked*"Closed".*} $RESULT]}
156
+write_file datafile "changed"
157
+fossil commit -m "should fail"
158
+test amend-close-2 {[string first "closed leaf" $RESULT] != -1}
159
+
160
+fossil revert
161
+fossil update trunk
162
+write_file datafile "cb"
163
+fossil commit -m "closed-branch" --branch "closebranch"
164
+if {![regexp {^New_Version: ([0-9a-f]{40})$} $RESULT m UUID3]} {
165
+ test amend-close-3.all false
166
+} else {
167
+ write_file datafile "b1"
168
+ fossil commit -m "m1"
169
+ write_file datafile "b2"
170
+ fossil commit -m "m2"
171
+ fossil amend $UUID3 --close
172
+ test amend-close-3.1 {[string match "*uuid:*$UUID3*" $RESULT]}
173
+ fossil tag ls --raw current
174
+ test amend-close-3.2 {[string first "closed" $RESULT] != -1}
175
+ fossil timeline -n 1
176
+ test amend-close-3.3 {
177
+ [string match "*Add*propagating*\"closed\".*" $RESULT]
178
+ }
179
+ write_file datafile "changed"
180
+ fossil commit -m "should fail"
181
+ test amend-close-3.4 {[string first "closed leaf" $RESULT] != -1}
133182
}
134183
--- test/amend.test
+++ test/amend.test
@@ -11,10 +11,12 @@
11 write_file datafile "data"
12 write_file commitmsg "committed"
13
14 fossil add datafile
15 fossil commit -m "c1"
 
 
16 if {![regexp {^New_Version: ([0-9a-f]{40})$} $RESULT m UUID]} {
17 test amend-setup-failure false
18 return
19 }
20
@@ -127,7 +129,54 @@
127 set sc 0
128 foreach badformat $badformats {
129 incr sc
130 set datetime [clock format $timestamp -format $badformat -gmt 1]
131 fossil amend $UUID -date $datetime
132 test amend-date-2.$sc {[string first "Unsupported date format, use YYYY-MM-DD HH:MM:SS" $RESULT] != -1}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133 }
134
--- test/amend.test
+++ test/amend.test
@@ -11,10 +11,12 @@
11 write_file datafile "data"
12 write_file commitmsg "committed"
13
14 fossil add datafile
15 fossil commit -m "c1"
16 write_file datafile "data.file"
17 fossil commit -m "c2"
18 if {![regexp {^New_Version: ([0-9a-f]{40})$} $RESULT m UUID]} {
19 test amend-setup-failure false
20 return
21 }
22
@@ -127,7 +129,54 @@
129 set sc 0
130 foreach badformat $badformats {
131 incr sc
132 set datetime [clock format $timestamp -format $badformat -gmt 1]
133 fossil amend $UUID -date $datetime
134 test amend-date-2.$sc {[string first "YYYY-MM-DD HH:MM:SS" $RESULT] != -1}
135 }
136
137 ########################################
138 # Test: -hide #
139 ########################################
140 fossil amend $UUID -hide
141 test amend-hide-1.1 {[string match "*uuid:*$UUID*" $RESULT]}
142 fossil tag ls --raw $UUID
143 test amend-hide-1.2 {[string first "hidden" $RESULT] != -1}
144 fossil timeline -n 1
145 test amend-hide-1.3 {[string match {*Add*propagating*"hidden".*} $RESULT]}
146
147 ########################################
148 # Test: -close #
149 ########################################
150 fossil amend $UUID -close
151 test amend-close-1.1 {[string match "*uuid:*$UUID*" $RESULT]}
152 fossil tag ls --raw $UUID
153 test amend-close-1.2 {[string first "closed" $RESULT] != -1}
154 fossil timeline -n 1
155 test amend-close-1.3 {[string match {*Marked*"Closed".*} $RESULT]}
156 write_file datafile "changed"
157 fossil commit -m "should fail"
158 test amend-close-2 {[string first "closed leaf" $RESULT] != -1}
159
160 fossil revert
161 fossil update trunk
162 write_file datafile "cb"
163 fossil commit -m "closed-branch" --branch "closebranch"
164 if {![regexp {^New_Version: ([0-9a-f]{40})$} $RESULT m UUID3]} {
165 test amend-close-3.all false
166 } else {
167 write_file datafile "b1"
168 fossil commit -m "m1"
169 write_file datafile "b2"
170 fossil commit -m "m2"
171 fossil amend $UUID3 --close
172 test amend-close-3.1 {[string match "*uuid:*$UUID3*" $RESULT]}
173 fossil tag ls --raw current
174 test amend-close-3.2 {[string first "closed" $RESULT] != -1}
175 fossil timeline -n 1
176 test amend-close-3.3 {
177 [string match "*Add*propagating*\"closed\".*" $RESULT]
178 }
179 write_file datafile "changed"
180 fossil commit -m "should fail"
181 test amend-close-3.4 {[string first "closed leaf" $RESULT] != -1}
182 }
183

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button