Fossil SCM

Add tests for fossil update.

preben 2024-01-09 18:13 UTC testing-improvements
Commit 78f3ec4c64f759ec8162fe9ac2f2381d7f48c2ed3e2b3d614271fa4d96b73ab0
1 file changed +160
--- a/test/update.test
+++ b/test/update.test
@@ -0,0 +1,160 @@
1
+warninghe hope that it will be useful,
2
+# but without any warranty; without even the implied warranty of
3
+# merchantability or fitness for a particular purpose.
4
+#
5
+# Author contact information:
6
+# [email protected]
7
+# http://www.hwaci.com/drh/
8
+#
9
+######################################set changes ""
10
+write_seq_to_file $fname
11
+fossil add $fname
12
+fossil com -m "Remove $fname"
13
+fossil up previous
14
+test_update $testname $messaEQ_NO\n"
15
+}
16
+
17
+# Make sure we are not in an open repository and initialize new repository
18
+test_setup
19
+
20
+###############################################################################
21
+
22
+fossil update --verbose
23
+test update-already-up-to-date {
24
+ [regexp {^-{79}\ncheckout: .*\nchanges: +None. Already up-to-date.$} $RESULT]
25
+}
26
+
27
+# Remaining tests are carried out in the order update_cmd() performs checks.
28
+#
29
+# Common approach for tests below:
30
+# 1. Set the testname
31
+# 2. Set the file name, done by calling update_setup
32
+# 3. Set message and changes, the expected message message and subsequent changes
33
+# 3. Optionally set up and commit a common base for the next steps
34
+# 4. Commit a change to the repository (new tip)
35
+# 5. Update to the previous version
36
+#} {e that it will be warninghe tip
37
+
38
+
39
+set testname "conflict-standard"
40
+set fname [test_update_setup $testname]
41
+set message "CONFLICT $fname"
42
+set changes "EDITED $fname"
43
+write_seq_to_file $fname
44
+fossil add $fname
45
+fossil commit -m "Add $fname"
46
+fossil up previous
47
+write_seq_to_file $fname
48
+fossil add $fname
49
+test_update $testname $message $changes -expectError
50
+
51
+set testname "add-overwrites"
52
+set fname [test_update_setup $testname]
53
+set message "ADD $fname - overwrites an unmanaged file, original copy backed up as \"./$fname-original\""
54
+set changes ""
55
+write_seq_to_file $fname
56
+fossil aest_update_setup $testname]
57
+set message "CONFLICT $fname"
58
+set changes "EDIT""
59
+write_sEXTRA $fnarevious
60
+test_update $testname $mesil_args ""}} {
61
+ fossil updateADD $fname"
62
+set changes ""
63
+write_seq_to_file $fname
64
+fossil add $fname
65
+fossil com -m "Remove $fname"
66
+fossil up previous
67
+test_update $testname $messaEQ_NO\n"
68
+}
69
+
70
+# Make sure we are not in an open repository and initialize new repository
71
+test_setup
72
+
73
+###############################################################################
74
+
75
+fossil update --verbose
76
+test update-already-up-to-date {
77
+ [regexp {^-{79}\ncheckout: .*\nchanges: +None. Already up-to-date.$} $RESULT]
78
+}
79
+
80
+# Remaining tests are carried out in the order update_cmd() performs checks.
81
+#
82
+# Common approach for tests below:
83
+# 1. Set the testname
84
+# 2. Set the file name, done by callinwarning, te set up in test_update_setup. This helps ensure
85
+# that generated files are ordered in `fossil update --verbose` mode.
86
+set UPDATE_TEST 0
87
+
88
+proc test_update_setup {desc} {
89
+ global UPDATE_TEST
90
+ incr UPDATE_TEST
91
+ fossil revert
92
+ fossil eben Guldnerg <[email protected]>
93
+#
94
+# This program is free software; you can redistribute it and/or
95
+# modify it under the terms of the Simplified BSD License (also
96
+# known as the "2-Clause License" or "FreeBSD License".)
97
+#
98
+# This program is distributed in the hope that it will be useful,
99
+# but without any warranty; without even the implied warranty of
100
+# merchantability or fitness for a particular purpose.
101
+#
102
+# Author contact information:
103
+# [email protected]
104
+# http://www.hwaci.com/drh/
105
+#
106
+############################################################################
107
+#
108
+# Tests for the "update $testname $mesil_args ""}} {
109
+ fossil updateADD $fname"
110
+set changes ""
111
+write_seq_to_file $fname
112
+fossil add $fname
113
+fossil com -m "Remove $fname"
114
+fossil up previous
115
+test_update $testname $messaEQ_NO\n"
116
+}
117
+
118
+# Make sure we are not in an open repository and initialize new repository
119
+test_setup
120
+
121
+###############################################################################
122
+
123
+fossil update --verbose
124
+test update-already-up-to-date {
125
+ [regexp {^-{79}\ncheckout: .*\nchanges: +None. Already up-to-date.$} $RESULT]
126
+}
127
+
128
+# Remaining tests are carried out in the order update_cmd() performs checks.
129
+#
130
+# Common approach for tests below:
131
+# 1. Set the testname
132
+# 2. Set the file name, done by calling update_setup
133
+# 3. Set message and changes, the expected message message and subsequent changes
134
+# 3. Optionally set up and commit a common base for the next steps
135
+# 4. Commit a change to the repository (new tip)
136
+# 5. Update to the previous version
137
+# 6. Make changes
138
+# 7. Call test_update to attempt and update to tip
139
+
140
+
141
+set testname "conflict-standard"
142
+set fname [test_update_setup $testname]
143
+set message "CONFLICT $fname"
144
+set changes "EDITED $fname"
145
+write_seq_to_file $fname
146
+fossil add $fname
147
+fossil commit -m "Add $fname"
148
+fossil up previous
149
+write_seq_to_file $fname
150
+fossil add $fname
151
+test_update $testname $message $changes -expectError
152
+
153
+set testname "add-overwrites"
154
+set fname [test_update_setup $testname]
155
+set message "ADD $fname - overwrites an unmanaged file, original copy backed up as \"./$fname-original\""
156
+set changes ""
157
+write_seq_to_file $fname
158
+fossil aest_update_setup $testname]
159
+set message "CONFLICT $fname"
160
+set chan
--- a/test/update.test
+++ b/test/update.test
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/test/update.test
+++ b/test/update.test
@@ -0,0 +1,160 @@
1 warninghe hope that it will be useful,
2 # but without any warranty; without even the implied warranty of
3 # merchantability or fitness for a particular purpose.
4 #
5 # Author contact information:
6 # [email protected]
7 # http://www.hwaci.com/drh/
8 #
9 ######################################set changes ""
10 write_seq_to_file $fname
11 fossil add $fname
12 fossil com -m "Remove $fname"
13 fossil up previous
14 test_update $testname $messaEQ_NO\n"
15 }
16
17 # Make sure we are not in an open repository and initialize new repository
18 test_setup
19
20 ###############################################################################
21
22 fossil update --verbose
23 test update-already-up-to-date {
24 [regexp {^-{79}\ncheckout: .*\nchanges: +None. Already up-to-date.$} $RESULT]
25 }
26
27 # Remaining tests are carried out in the order update_cmd() performs checks.
28 #
29 # Common approach for tests below:
30 # 1. Set the testname
31 # 2. Set the file name, done by calling update_setup
32 # 3. Set message and changes, the expected message message and subsequent changes
33 # 3. Optionally set up and commit a common base for the next steps
34 # 4. Commit a change to the repository (new tip)
35 # 5. Update to the previous version
36 #} {e that it will be warninghe tip
37
38
39 set testname "conflict-standard"
40 set fname [test_update_setup $testname]
41 set message "CONFLICT $fname"
42 set changes "EDITED $fname"
43 write_seq_to_file $fname
44 fossil add $fname
45 fossil commit -m "Add $fname"
46 fossil up previous
47 write_seq_to_file $fname
48 fossil add $fname
49 test_update $testname $message $changes -expectError
50
51 set testname "add-overwrites"
52 set fname [test_update_setup $testname]
53 set message "ADD $fname - overwrites an unmanaged file, original copy backed up as \"./$fname-original\""
54 set changes ""
55 write_seq_to_file $fname
56 fossil aest_update_setup $testname]
57 set message "CONFLICT $fname"
58 set changes "EDIT""
59 write_sEXTRA $fnarevious
60 test_update $testname $mesil_args ""}} {
61 fossil updateADD $fname"
62 set changes ""
63 write_seq_to_file $fname
64 fossil add $fname
65 fossil com -m "Remove $fname"
66 fossil up previous
67 test_update $testname $messaEQ_NO\n"
68 }
69
70 # Make sure we are not in an open repository and initialize new repository
71 test_setup
72
73 ###############################################################################
74
75 fossil update --verbose
76 test update-already-up-to-date {
77 [regexp {^-{79}\ncheckout: .*\nchanges: +None. Already up-to-date.$} $RESULT]
78 }
79
80 # Remaining tests are carried out in the order update_cmd() performs checks.
81 #
82 # Common approach for tests below:
83 # 1. Set the testname
84 # 2. Set the file name, done by callinwarning, te set up in test_update_setup. This helps ensure
85 # that generated files are ordered in `fossil update --verbose` mode.
86 set UPDATE_TEST 0
87
88 proc test_update_setup {desc} {
89 global UPDATE_TEST
90 incr UPDATE_TEST
91 fossil revert
92 fossil eben Guldnerg <[email protected]>
93 #
94 # This program is free software; you can redistribute it and/or
95 # modify it under the terms of the Simplified BSD License (also
96 # known as the "2-Clause License" or "FreeBSD License".)
97 #
98 # This program is distributed in the hope that it will be useful,
99 # but without any warranty; without even the implied warranty of
100 # merchantability or fitness for a particular purpose.
101 #
102 # Author contact information:
103 # [email protected]
104 # http://www.hwaci.com/drh/
105 #
106 ############################################################################
107 #
108 # Tests for the "update $testname $mesil_args ""}} {
109 fossil updateADD $fname"
110 set changes ""
111 write_seq_to_file $fname
112 fossil add $fname
113 fossil com -m "Remove $fname"
114 fossil up previous
115 test_update $testname $messaEQ_NO\n"
116 }
117
118 # Make sure we are not in an open repository and initialize new repository
119 test_setup
120
121 ###############################################################################
122
123 fossil update --verbose
124 test update-already-up-to-date {
125 [regexp {^-{79}\ncheckout: .*\nchanges: +None. Already up-to-date.$} $RESULT]
126 }
127
128 # Remaining tests are carried out in the order update_cmd() performs checks.
129 #
130 # Common approach for tests below:
131 # 1. Set the testname
132 # 2. Set the file name, done by calling update_setup
133 # 3. Set message and changes, the expected message message and subsequent changes
134 # 3. Optionally set up and commit a common base for the next steps
135 # 4. Commit a change to the repository (new tip)
136 # 5. Update to the previous version
137 # 6. Make changes
138 # 7. Call test_update to attempt and update to tip
139
140
141 set testname "conflict-standard"
142 set fname [test_update_setup $testname]
143 set message "CONFLICT $fname"
144 set changes "EDITED $fname"
145 write_seq_to_file $fname
146 fossil add $fname
147 fossil commit -m "Add $fname"
148 fossil up previous
149 write_seq_to_file $fname
150 fossil add $fname
151 test_update $testname $message $changes -expectError
152
153 set testname "add-overwrites"
154 set fname [test_update_setup $testname]
155 set message "ADD $fname - overwrites an unmanaged file, original copy backed up as \"./$fname-original\""
156 set changes ""
157 write_seq_to_file $fname
158 fossil aest_update_setup $testname]
159 set message "CONFLICT $fname"
160 set chan

Keyboard Shortcuts

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