Fossil SCM

Add test for newly added code that checks the datetime format is correct.

andybradford 2015-08-01 01:47 UTC check-in-edit
Commit 3740d83f39928e2b7a0ca3225746ac2d95be49e1
1 file changed +14
--- test/amend.test
+++ test/amend.test
@@ -115,5 +115,19 @@
115115
test amend-date-1.1 {[string match "*uuid:*$UUID*$datetime*" $RESULT]}
116116
fossil tag ls --raw $UUID
117117
test amend-date-1.2 {[string first "date=$datetime" $RESULT] != -1}
118118
fossil timeline -n 1
119119
test amend-date-1.3 {[string match "*Timestamp*$date*$time*" $RESULT]}
120
+set badformats {
121
+ "%+"
122
+ "%Y-%m-%d %H:%M%:%S %Z"
123
+ "%d/%m/%Y %H:%M%:%S %Z"
124
+ "%d/%m/%Y %H:%M%:%S"
125
+ "%d/%m/%Y"
126
+}
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
+}
120134
--- test/amend.test
+++ test/amend.test
@@ -115,5 +115,19 @@
115 test amend-date-1.1 {[string match "*uuid:*$UUID*$datetime*" $RESULT]}
116 fossil tag ls --raw $UUID
117 test amend-date-1.2 {[string first "date=$datetime" $RESULT] != -1}
118 fossil timeline -n 1
119 test amend-date-1.3 {[string match "*Timestamp*$date*$time*" $RESULT]}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
--- test/amend.test
+++ test/amend.test
@@ -115,5 +115,19 @@
115 test amend-date-1.1 {[string match "*uuid:*$UUID*$datetime*" $RESULT]}
116 fossil tag ls --raw $UUID
117 test amend-date-1.2 {[string first "date=$datetime" $RESULT] != -1}
118 fossil timeline -n 1
119 test amend-date-1.3 {[string match "*Timestamp*$date*$time*" $RESULT]}
120 set badformats {
121 "%+"
122 "%Y-%m-%d %H:%M%:%S %Z"
123 "%d/%m/%Y %H:%M%:%S %Z"
124 "%d/%m/%Y %H:%M%:%S"
125 "%d/%m/%Y"
126 }
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

Keyboard Shortcuts

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