Fossil SCM

Tidy test files: remove unused/duplicated code, fix no-ops, wrap long lines, ensure some tests are run for every file at level smoke, etc.

danshearer 2026-11-26 18:32 UTC test-suite-new
Commit 5c86b2ed386f5ffb0ce2eb6a2114bcd3e425b6642a313b489e64de5bf1e93059
+50 -24
--- test/README.md
+++ test/README.md
@@ -85,16 +85,18 @@
8585
* Tcl 8.6 or later, we also test with Tcl 9.0 which is now common. `configure` finds `tclsh`, and `make test` fails if it finds none.
8686
* A writable temporary directory, from `TMPDIR`, `TEMP` or `TMP`, falling back to `/tmp`. All writes are made to the temporary directory, except with `-prot`
8787
which writes a session log to wherever it was started from.
8888
* `src/` which must be at the same level in the same directory as `test/`, reflecting the source tree layout. The tests (at least) `settings.test` and `settings-repo.test` need the source to do their job.
8989
90
-The following tests are skipped when their requirements are missing:
90
+Tests are skipped when their requirements are missing:
9191
9292
| Needs | Test files |
9393
| --- | --- |
94
-| a TCP connection over the loopback interface | `unversioned`, and the HTTP clone in `powerloss` |
94
+| a TCP connection over the loopback interface | `http`, `unversioned`, the HTTP tests in `sync`, and the HTTP clone in `powerloss` |
9595
| `-assurance ci` or `stress` | `powerloss` |
96
+| `openssl` and a Fossil built with TLS support | the HTTPS tests in `http` |
97
+| `python3` | the tests in `http` that run `http-relay.py` |
9698
| a C compiler (`cc`, or `CC`), `LD_PRELOAD`, `tools/powerloss/powerloss.c` from the source tree, and a Fossil that isn't statically linked | `powerloss` |
9799
| `configure --json` | `json` |
98100
| `configure --with-th1-docs` | `th1-docs` |
99101
| `configure --with-th1-hooks` | `th1-hooks` |
100102
| `configure --with-tcl` | `th1-tcl` |
@@ -104,37 +106,65 @@
104106
None of the tests need network access. That doesn't mean all network-related tests will work, because some isolated environments don't even have loopback and
105107
the test suite detects this.
106108
107109
## Coverage
108110
109
-| Area | Test files |
110
-| --- | --- |
111
-| Check-ins and the working tree | `amend`, `clean`, `commit-warning`, `mv-rm`, `revert`, `stash`, `symlinks`, `unicode-pathnames`, `update` |
112
-| Branches and tags | `branch-tag` |
113
-| Merges, cherrypicks, backouts, and annotate and blame after them | `merge1` to `merge6`, `merge-history`, `merge_exe`, `merge_renames`, `merge_renames_2`, `merge_warn` |
114
-| Commands interrupted by a power loss or a killed process | `powerloss` |
111
+The last column is the lowest `-assurance` level that runs the files: `smoke`
112
+means every run, and `ci` means `ci` and `stress`.
113
+
114
+| Area | Test files | Runs at |
115
+| --- | --- | --- |
116
+| Check-ins and the working tree | `amend`, `clean`, `commit-warning`, `mv-rm`, `revert`, `stash`, `symlinks`, `unicode-pathnames`, `update` | `smoke` |
117
+| Branches and tags | `branch-tag` | `smoke` |
118
+| Merges, cherrypicks, backouts, and annotate and blame after them | `merge1` to `merge6`, `merge-history`, `merge_exe`, `merge_renames`, `merge_renames_2`, `merge_warn` | `smoke` |
119
+| HTTP and HTTPS client | `http` | `smoke` |
120
+| Commands interrupted by a power loss or a killed process | `powerloss` | `ci` |
121
+| Diffs and deltas | `delta1`, `diff` | `smoke` |
122
+| Settings | `settings`, `settings-repo`, `set-manifest` | `smoke` |
123
+| Wiki, attachments and unversioned files | `wiki`, `unversioned` | `smoke` |
124
+| TH1 scripting | `th1`, `th1-docs`, `th1-hooks`, `th1-repo`, `th1-taint`, `th1-tcl` | `smoke` |
125
+| JSON API | `json` | `smoke` |
126
+| Parsing and file utilities | `cmdline`, `contains-selector`, `file1`, `glob`, `reserved-names`, `utf` | `smoke` |
115127
| Git export and import, bundles, patches, ZIP and tarball archives | `roundtrip` |
116
-| Diffs and deltas | `delta1`, `diff` |
117
-| Settings | `settings`, `settings-repo`, `set-manifest` |
118
-| Wiki, attachments and unversioned files | `wiki`, `unversioned` |
119
-| TH1 scripting | `th1`, `th1-docs`, `th1-hooks`, `th1-repo`, `th1-taint`, `th1-tcl` |
120
-| JSON API | `json` |
121
-| Parsing and file utilities | `cmdline`, `contains-selector`, `file1`, `glob`, `reserved-names`, `utf` |
122128
123129
## Writing new tests
124130
125131
Each `NAME.test` file is a Tcl script sourced by `tester.tcl`. `test_setup` creates and opens a repository in a temporary directory. `fossil ARGS` runs the
126132
executable being tested and sets `RESULT` to its output and `CODE` to 0 if the command succeeded and did not write anything to standard error, or 1 otherwise. `test_eq NAME ACTUAL EXPECTED` and `test_match NAME ACTUAL PATTERN`
127133
report both values when they fail, and `test NAME EXPRESSION` gives the report. `test_skip REASON` skips the rest of the file, `test_skip_part REASON`
128134
reports a few skipped tests while the file continues, and `test_fail_then_return NAME
129
-REASON` records a failed setup step and stops the file. A last argument of `knownBug` to any of the `test` procedures marks a known bug as described above.
135
+REASON` records a failed setup step and stops the file.
136
+
137
+A test file looks like this:
138
+
139
+```tcl
140
+#
141
+# What this file tests, in a sentence or two.
142
+#
143
+
144
+require_no_open_checkout
145
+
146
+test_setup
147
+
148
+write_file a.txt "one\n"
149
+fossil add a.txt
150
+fossil commit -m one
151
+test example-commit {$CODE == 0}
152
+
153
+test_cleanup
154
+```
155
+
156
+* Start each test name and each procedure name with the file's name or a short form of it, such as `sync-clone-artifacts` and `sync_commit`. A failure report then says which file to open.
157
+* Comment a procedure only if its name and arguments don't say what it does. Don't repeat the code in a comment.
158
+* Call your global variables what you like. `tester.tcl` removes them when your file ends, so two files can't collide. Don't set a variable that `tester.tcl` owns, such as `RESULT`, `CODE`, `testdir` or `fossilexe`.
159
+* If the file needs something the system might not have, call `test_skip` near the top so the summary shows it.
160
+* `fossil ARGS` counts output on standard error as a failure and can't tell a crash from an error. If your test expects either, reads the output as bytes, gives `fossil` input or needs a time limit, use `fossil_raw ARGS`, which sets `CODE` to the exit status, `crash` or `timeout`. Don't call `exec $::fossilexe` yourself.
161
+* Read a file with `read_file` and write one with `write_file`.
162
+* Keep lines within 80 columns.
130163
131
-`fossil_raw ARGS` also runs the executable, for the tests `fossil` can't
132
-do. It sets `RESULT` to standard output and standard error together, as
133
-bytes, and `CODE` to the exit status, to `crash` if a signal ended the
134
-command, or to `timeout`. A failed command isn't reported as an error, so
135
-check `CODE` yourself. Use it when you need:
164
+A command that fails under `fossil_raw` isn't reported as an error, so
165
+check `CODE` yourself. Use `fossil_raw` when you need:
136166
137167
* the output byte for byte, such as CRLF line endings or binary content
138168
* the exit status, or to tell a crash from a failure
139169
* text on standard error from a command that succeeds
140170
* standard input, with `-input TEXT`
@@ -159,17 +189,13 @@
159189
160190
A test marked `knownBug` should fail on every applicable system. If the fault only shows up in some environments, the test must set up the relevant environment. If Fossil really does behave differently on some system depending how the system is configured (for example decomposed pathnames on macOS, which vary depending whether the filesystem is HFS+ or APFS) the test must check the behavior. The test suite avoids operating system names by testing for behaviors instead, wherever possible. If a test needs something the system might not have, that becomes a requirement and you can use `test_skip` for.
161191
162192
`fixed_word_lines NLINE` is a procedure in `tester.tcl` that returns generated text as a string, the same text on every run. `delta1.test` and `merge2.test` use it for their input. If your new test needs text to work on start with this. Look at delta and merge tests for examples of how to use this with character encodings.
163193
164
-Beware of global variables! `tester.tcl` removes on exit any globals a test file
165
-creates. A global defined by `tester.tcl`, such as `RESULT`, is still shared, so
166
-don't reuse one of those.
167
-
168194
`make test` runs only the `.test` files. The other scripts in `test/` are run by hand:
169195
170196
* `release-checklist.wiki` lists the checks to make before a release, with the `.wiki` and `.md` pages they use.
171197
* `many-www.tcl` requests about 10,000 web pages from an open checkout with `fossil test-http` and times each, to find crashes and slow pages. `valgrind-www.tcl` requests hundreds of pages under valgrind to find memory errors.
172198
* `update-test-1.sh` and `update-test-2.sh` run `fossil update` scenarios in an empty directory.
173199
* `link-tester.html` steps through a list of links in `fossil ui`, for checking each page by eye.
174200
175201
The remaining files are helper scripts and test data.
176202
--- test/README.md
+++ test/README.md
@@ -85,16 +85,18 @@
85 * Tcl 8.6 or later, we also test with Tcl 9.0 which is now common. `configure` finds `tclsh`, and `make test` fails if it finds none.
86 * A writable temporary directory, from `TMPDIR`, `TEMP` or `TMP`, falling back to `/tmp`. All writes are made to the temporary directory, except with `-prot`
87 which writes a session log to wherever it was started from.
88 * `src/` which must be at the same level in the same directory as `test/`, reflecting the source tree layout. The tests (at least) `settings.test` and `settings-repo.test` need the source to do their job.
89
90 The following tests are skipped when their requirements are missing:
91
92 | Needs | Test files |
93 | --- | --- |
94 | a TCP connection over the loopback interface | `unversioned`, and the HTTP clone in `powerloss` |
95 | `-assurance ci` or `stress` | `powerloss` |
 
 
96 | a C compiler (`cc`, or `CC`), `LD_PRELOAD`, `tools/powerloss/powerloss.c` from the source tree, and a Fossil that isn't statically linked | `powerloss` |
97 | `configure --json` | `json` |
98 | `configure --with-th1-docs` | `th1-docs` |
99 | `configure --with-th1-hooks` | `th1-hooks` |
100 | `configure --with-tcl` | `th1-tcl` |
@@ -104,37 +106,65 @@
104 None of the tests need network access. That doesn't mean all network-related tests will work, because some isolated environments don't even have loopback and
105 the test suite detects this.
106
107 ## Coverage
108
109 | Area | Test files |
110 | --- | --- |
111 | Check-ins and the working tree | `amend`, `clean`, `commit-warning`, `mv-rm`, `revert`, `stash`, `symlinks`, `unicode-pathnames`, `update` |
112 | Branches and tags | `branch-tag` |
113 | Merges, cherrypicks, backouts, and annotate and blame after them | `merge1` to `merge6`, `merge-history`, `merge_exe`, `merge_renames`, `merge_renames_2`, `merge_warn` |
114 | Commands interrupted by a power loss or a killed process | `powerloss` |
 
 
 
 
 
 
 
 
 
 
115 | Git export and import, bundles, patches, ZIP and tarball archives | `roundtrip` |
116 | Diffs and deltas | `delta1`, `diff` |
117 | Settings | `settings`, `settings-repo`, `set-manifest` |
118 | Wiki, attachments and unversioned files | `wiki`, `unversioned` |
119 | TH1 scripting | `th1`, `th1-docs`, `th1-hooks`, `th1-repo`, `th1-taint`, `th1-tcl` |
120 | JSON API | `json` |
121 | Parsing and file utilities | `cmdline`, `contains-selector`, `file1`, `glob`, `reserved-names`, `utf` |
122
123 ## Writing new tests
124
125 Each `NAME.test` file is a Tcl script sourced by `tester.tcl`. `test_setup` creates and opens a repository in a temporary directory. `fossil ARGS` runs the
126 executable being tested and sets `RESULT` to its output and `CODE` to 0 if the command succeeded and did not write anything to standard error, or 1 otherwise. `test_eq NAME ACTUAL EXPECTED` and `test_match NAME ACTUAL PATTERN`
127 report both values when they fail, and `test NAME EXPRESSION` gives the report. `test_skip REASON` skips the rest of the file, `test_skip_part REASON`
128 reports a few skipped tests while the file continues, and `test_fail_then_return NAME
129 REASON` records a failed setup step and stops the file. A last argument of `knownBug` to any of the `test` procedures marks a known bug as described above.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
131 `fossil_raw ARGS` also runs the executable, for the tests `fossil` can't
132 do. It sets `RESULT` to standard output and standard error together, as
133 bytes, and `CODE` to the exit status, to `crash` if a signal ended the
134 command, or to `timeout`. A failed command isn't reported as an error, so
135 check `CODE` yourself. Use it when you need:
136
137 * the output byte for byte, such as CRLF line endings or binary content
138 * the exit status, or to tell a crash from a failure
139 * text on standard error from a command that succeeds
140 * standard input, with `-input TEXT`
@@ -159,17 +189,13 @@
159
160 A test marked `knownBug` should fail on every applicable system. If the fault only shows up in some environments, the test must set up the relevant environment. If Fossil really does behave differently on some system depending how the system is configured (for example decomposed pathnames on macOS, which vary depending whether the filesystem is HFS+ or APFS) the test must check the behavior. The test suite avoids operating system names by testing for behaviors instead, wherever possible. If a test needs something the system might not have, that becomes a requirement and you can use `test_skip` for.
161
162 `fixed_word_lines NLINE` is a procedure in `tester.tcl` that returns generated text as a string, the same text on every run. `delta1.test` and `merge2.test` use it for their input. If your new test needs text to work on start with this. Look at delta and merge tests for examples of how to use this with character encodings.
163
164 Beware of global variables! `tester.tcl` removes on exit any globals a test file
165 creates. A global defined by `tester.tcl`, such as `RESULT`, is still shared, so
166 don't reuse one of those.
167
168 `make test` runs only the `.test` files. The other scripts in `test/` are run by hand:
169
170 * `release-checklist.wiki` lists the checks to make before a release, with the `.wiki` and `.md` pages they use.
171 * `many-www.tcl` requests about 10,000 web pages from an open checkout with `fossil test-http` and times each, to find crashes and slow pages. `valgrind-www.tcl` requests hundreds of pages under valgrind to find memory errors.
172 * `update-test-1.sh` and `update-test-2.sh` run `fossil update` scenarios in an empty directory.
173 * `link-tester.html` steps through a list of links in `fossil ui`, for checking each page by eye.
174
175 The remaining files are helper scripts and test data.
176
--- test/README.md
+++ test/README.md
@@ -85,16 +85,18 @@
85 * Tcl 8.6 or later, we also test with Tcl 9.0 which is now common. `configure` finds `tclsh`, and `make test` fails if it finds none.
86 * A writable temporary directory, from `TMPDIR`, `TEMP` or `TMP`, falling back to `/tmp`. All writes are made to the temporary directory, except with `-prot`
87 which writes a session log to wherever it was started from.
88 * `src/` which must be at the same level in the same directory as `test/`, reflecting the source tree layout. The tests (at least) `settings.test` and `settings-repo.test` need the source to do their job.
89
90 Tests are skipped when their requirements are missing:
91
92 | Needs | Test files |
93 | --- | --- |
94 | a TCP connection over the loopback interface | `http`, `unversioned`, the HTTP tests in `sync`, and the HTTP clone in `powerloss` |
95 | `-assurance ci` or `stress` | `powerloss` |
96 | `openssl` and a Fossil built with TLS support | the HTTPS tests in `http` |
97 | `python3` | the tests in `http` that run `http-relay.py` |
98 | a C compiler (`cc`, or `CC`), `LD_PRELOAD`, `tools/powerloss/powerloss.c` from the source tree, and a Fossil that isn't statically linked | `powerloss` |
99 | `configure --json` | `json` |
100 | `configure --with-th1-docs` | `th1-docs` |
101 | `configure --with-th1-hooks` | `th1-hooks` |
102 | `configure --with-tcl` | `th1-tcl` |
@@ -104,37 +106,65 @@
106 None of the tests need network access. That doesn't mean all network-related tests will work, because some isolated environments don't even have loopback and
107 the test suite detects this.
108
109 ## Coverage
110
111 The last column is the lowest `-assurance` level that runs the files: `smoke`
112 means every run, and `ci` means `ci` and `stress`.
113
114 | Area | Test files | Runs at |
115 | --- | --- | --- |
116 | Check-ins and the working tree | `amend`, `clean`, `commit-warning`, `mv-rm`, `revert`, `stash`, `symlinks`, `unicode-pathnames`, `update` | `smoke` |
117 | Branches and tags | `branch-tag` | `smoke` |
118 | Merges, cherrypicks, backouts, and annotate and blame after them | `merge1` to `merge6`, `merge-history`, `merge_exe`, `merge_renames`, `merge_renames_2`, `merge_warn` | `smoke` |
119 | HTTP and HTTPS client | `http` | `smoke` |
120 | Commands interrupted by a power loss or a killed process | `powerloss` | `ci` |
121 | Diffs and deltas | `delta1`, `diff` | `smoke` |
122 | Settings | `settings`, `settings-repo`, `set-manifest` | `smoke` |
123 | Wiki, attachments and unversioned files | `wiki`, `unversioned` | `smoke` |
124 | TH1 scripting | `th1`, `th1-docs`, `th1-hooks`, `th1-repo`, `th1-taint`, `th1-tcl` | `smoke` |
125 | JSON API | `json` | `smoke` |
126 | Parsing and file utilities | `cmdline`, `contains-selector`, `file1`, `glob`, `reserved-names`, `utf` | `smoke` |
127 | Git export and import, bundles, patches, ZIP and tarball archives | `roundtrip` |
 
 
 
 
 
 
128
129 ## Writing new tests
130
131 Each `NAME.test` file is a Tcl script sourced by `tester.tcl`. `test_setup` creates and opens a repository in a temporary directory. `fossil ARGS` runs the
132 executable being tested and sets `RESULT` to its output and `CODE` to 0 if the command succeeded and did not write anything to standard error, or 1 otherwise. `test_eq NAME ACTUAL EXPECTED` and `test_match NAME ACTUAL PATTERN`
133 report both values when they fail, and `test NAME EXPRESSION` gives the report. `test_skip REASON` skips the rest of the file, `test_skip_part REASON`
134 reports a few skipped tests while the file continues, and `test_fail_then_return NAME
135 REASON` records a failed setup step and stops the file.
136
137 A test file looks like this:
138
139 ```tcl
140 #
141 # What this file tests, in a sentence or two.
142 #
143
144 require_no_open_checkout
145
146 test_setup
147
148 write_file a.txt "one\n"
149 fossil add a.txt
150 fossil commit -m one
151 test example-commit {$CODE == 0}
152
153 test_cleanup
154 ```
155
156 * Start each test name and each procedure name with the file's name or a short form of it, such as `sync-clone-artifacts` and `sync_commit`. A failure report then says which file to open.
157 * Comment a procedure only if its name and arguments don't say what it does. Don't repeat the code in a comment.
158 * Call your global variables what you like. `tester.tcl` removes them when your file ends, so two files can't collide. Don't set a variable that `tester.tcl` owns, such as `RESULT`, `CODE`, `testdir` or `fossilexe`.
159 * If the file needs something the system might not have, call `test_skip` near the top so the summary shows it.
160 * `fossil ARGS` counts output on standard error as a failure and can't tell a crash from an error. If your test expects either, reads the output as bytes, gives `fossil` input or needs a time limit, use `fossil_raw ARGS`, which sets `CODE` to the exit status, `crash` or `timeout`. Don't call `exec $::fossilexe` yourself.
161 * Read a file with `read_file` and write one with `write_file`.
162 * Keep lines within 80 columns.
163
164 A command that fails under `fossil_raw` isn't reported as an error, so
165 check `CODE` yourself. Use `fossil_raw` when you need:
 
 
 
166
167 * the output byte for byte, such as CRLF line endings or binary content
168 * the exit status, or to tell a crash from a failure
169 * text on standard error from a command that succeeds
170 * standard input, with `-input TEXT`
@@ -159,17 +189,13 @@
189
190 A test marked `knownBug` should fail on every applicable system. If the fault only shows up in some environments, the test must set up the relevant environment. If Fossil really does behave differently on some system depending how the system is configured (for example decomposed pathnames on macOS, which vary depending whether the filesystem is HFS+ or APFS) the test must check the behavior. The test suite avoids operating system names by testing for behaviors instead, wherever possible. If a test needs something the system might not have, that becomes a requirement and you can use `test_skip` for.
191
192 `fixed_word_lines NLINE` is a procedure in `tester.tcl` that returns generated text as a string, the same text on every run. `delta1.test` and `merge2.test` use it for their input. If your new test needs text to work on start with this. Look at delta and merge tests for examples of how to use this with character encodings.
193
 
 
 
 
194 `make test` runs only the `.test` files. The other scripts in `test/` are run by hand:
195
196 * `release-checklist.wiki` lists the checks to make before a release, with the `.wiki` and `.md` pages they use.
197 * `many-www.tcl` requests about 10,000 web pages from an open checkout with `fossil test-http` and times each, to find crashes and slow pages. `valgrind-www.tcl` requests hundreds of pages under valgrind to find memory errors.
198 * `update-test-1.sh` and `update-test-2.sh` run `fossil update` scenarios in an empty directory.
199 * `link-tester.html` steps through a list of links in `fossil ui`, for checking each page by eye.
200
201 The remaining files are helper scripts and test data.
202
+36 -32
--- test/clean.test
+++ test/clean.test
@@ -21,28 +21,28 @@
2121
test_setup
2222
2323
###############################################################################
2424
2525
fossil extra
26
-test clean-0 {[normalize_result] eq {}}
26
+test_eq clean-0 [normalize_result] {}
2727
2828
###############################################################################
2929
3030
commit_file f1 "f1 line" "base file"
3131
fossil ls
32
-test clean-1 {[normalize_result] eq {f1}}
32
+test_eq clean-1 [normalize_result] {f1}
3333
3434
###############################################################################
3535
3636
fossil extra
37
-test clean-2 {[normalize_result] eq {}}
37
+test_eq clean-2 [normalize_result] {}
3838
3939
###############################################################################
4040
4141
write_file f2 "f2 line"
4242
fossil extra
43
-test clean-3 {[normalize_result] eq {f2}}
43
+test_eq clean-3 [normalize_result] {f2}
4444
4545
###############################################################################
4646
4747
# clean w/undo enabled, should not prompt, 1 file < 10MiB
4848
fossil clean
@@ -50,29 +50,30 @@
5050
{"fossil undo" is available to undo changes to the working checkout.}}
5151
5252
###############################################################################
5353
5454
fossil extra
55
-test clean-5 {[normalize_result] eq {}}
55
+test_eq clean-5 [normalize_result] {}
5656
5757
###############################################################################
5858
5959
fossil undo
60
-test clean-6 {[normalize_result] eq {NEW f2}}
61
-test clean-7 {[read_file f2] eq "f2 line"}
60
+test_eq clean-6 [normalize_result] {NEW f2}
61
+test_eq clean-7 [read_file f2] "f2 line"
6262
6363
###############################################################################
6464
6565
fossil extra
66
-test clean-8 {[normalize_result] eq {f2}}
66
+test_eq clean-8 [normalize_result] {f2}
6767
6868
###############################################################################
6969
7070
write_file f3 [string repeat ABCDEFGHIJK 1048576]
7171
fossil extra
72
-test clean-9 {[normalize_result] eq {f2
73
-f3}}
72
+test_eq clean-9 [normalize_result] \
73
+ {f2
74
+f3}
7475
7576
###############################################################################
7677
7778
# clean w/undo enabled, no prompt, 1 file < 10MiB, 1 file > 10MiB
7879
fossil clean --no-prompt
@@ -80,24 +81,25 @@
8081
{"fossil undo" is available to undo changes to the working checkout.}}
8182
8283
###############################################################################
8384
8485
fossil extra
85
-test clean-11 {[normalize_result] eq {f3}}
86
+test_eq clean-11 [normalize_result] {f3}
8687
8788
###############################################################################
8889
8990
fossil undo
90
-test clean-12 {[normalize_result] eq {NEW f2}}
91
-test clean-13 {[read_file f2] eq "f2 line"}
92
-test clean-14 {[read_file f3] eq [string repeat ABCDEFGHIJK 1048576]}
91
+test_eq clean-12 [normalize_result] {NEW f2}
92
+test_eq clean-13 [read_file f2] "f2 line"
93
+test_eq clean-14 [read_file f3] [string repeat ABCDEFGHIJK 1048576]
9394
9495
###############################################################################
9596
9697
fossil extra
97
-test clean-15 {[normalize_result] eq {f2
98
-f3}}
98
+test_eq clean-15 [normalize_result] \
99
+ {f2
100
+f3}
99101
100102
###############################################################################
101103
102104
# clean w/undo enabled, force, 1 file < 10MiB, 1 file > 10MiB
103105
fossil clean --force
@@ -105,63 +107,65 @@
105107
{"fossil undo" is available to undo changes to the working checkout.}}
106108
107109
###############################################################################
108110
109111
fossil extra
110
-test clean-17 {[normalize_result] eq {}}
112
+test_eq clean-17 [normalize_result] {}
111113
112114
###############################################################################
113115
114116
fossil undo
115
-test clean-18 {[normalize_result] eq {NEW f2}}
116
-test clean-19 {[read_file f2] eq "f2 line"}
117
+test_eq clean-18 [normalize_result] {NEW f2}
118
+test_eq clean-19 [read_file f2] "f2 line"
117119
118120
###############################################################################
119121
120122
write_file f4 [string repeat KJIHGFEDCBA 1048576]
121123
fossil extra
122
-test clean-20 {[normalize_result] eq {f2
123
-f4}}
124
+test_eq clean-20 [normalize_result] \
125
+ {f2
126
+f4}
124127
125128
###############################################################################
126129
127130
# clean w/undo disabled, no prompt, 1 file < 10MiB, 1 file > 10MiB
128131
fossil clean --disable-undo --no-prompt
129
-test clean-21 {[normalize_result] eq {}}
132
+test_eq clean-21 [normalize_result] {}
130133
131134
###############################################################################
132135
133136
fossil extra
134
-test clean-22 {[normalize_result] eq {f2
135
-f4}}
137
+test_eq clean-22 [normalize_result] \
138
+ {f2
139
+f4}
136140
137141
###############################################################################
138142
139143
fossil undo -expectError
140
-test clean-23 {[normalize_result] eq {nothing to undo}}
144
+test_eq clean-23 [normalize_result] {nothing to undo}
141145
142146
###############################################################################
143147
144148
# clean w/undo disabled, force, 1 file < 10MiB, 1 file > 10MiB
145149
fossil clean --disable-undo --force
146
-test clean-24 {[normalize_result] eq {}}
150
+test_eq clean-24 [normalize_result] {}
147151
148152
###############################################################################
149153
150154
fossil extra
151
-test clean-25 {[normalize_result] eq {}}
155
+test_eq clean-25 [normalize_result] {}
152156
153157
###############################################################################
154158
155159
fossil undo -expectError
156
-test clean-26 {[normalize_result] eq {nothing to undo}}
160
+test_eq clean-26 [normalize_result] {nothing to undo}
157161
158162
###############################################################################
159163
160164
write_file f5 "f5 line"
161165
fossil extra
162
-test clean-27 {[normalize_result] eq {f5}}
166
+test_eq clean-27 [normalize_result] {f5}
163167
164168
###############################################################################
165169
166170
# clean w/undo disabled, should prompt, 1 file < 10MiB
167171
fossil_maybe_answer Y clean --disable-undo
@@ -172,20 +176,20 @@
172176
Remove unmanaged file "f5" (a=all/y/N)?}}
173177
174178
###############################################################################
175179
176180
fossil extra
177
-test clean-29 {[normalize_result] eq {}}
181
+test_eq clean-29 [normalize_result] {}
178182
179183
###############################################################################
180184
181185
fossil undo -expectError
182
-test clean-30 {[normalize_result] eq {nothing to undo}}
186
+test_eq clean-30 [normalize_result] {nothing to undo}
183187
184188
###############################################################################
185189
186190
fossil extra
187
-test clean-31 {[normalize_result] eq {}}
191
+test_eq clean-31 [normalize_result] {}
188192
189193
###############################################################################
190194
191195
test_cleanup
192196
--- test/clean.test
+++ test/clean.test
@@ -21,28 +21,28 @@
21 test_setup
22
23 ###############################################################################
24
25 fossil extra
26 test clean-0 {[normalize_result] eq {}}
27
28 ###############################################################################
29
30 commit_file f1 "f1 line" "base file"
31 fossil ls
32 test clean-1 {[normalize_result] eq {f1}}
33
34 ###############################################################################
35
36 fossil extra
37 test clean-2 {[normalize_result] eq {}}
38
39 ###############################################################################
40
41 write_file f2 "f2 line"
42 fossil extra
43 test clean-3 {[normalize_result] eq {f2}}
44
45 ###############################################################################
46
47 # clean w/undo enabled, should not prompt, 1 file < 10MiB
48 fossil clean
@@ -50,29 +50,30 @@
50 {"fossil undo" is available to undo changes to the working checkout.}}
51
52 ###############################################################################
53
54 fossil extra
55 test clean-5 {[normalize_result] eq {}}
56
57 ###############################################################################
58
59 fossil undo
60 test clean-6 {[normalize_result] eq {NEW f2}}
61 test clean-7 {[read_file f2] eq "f2 line"}
62
63 ###############################################################################
64
65 fossil extra
66 test clean-8 {[normalize_result] eq {f2}}
67
68 ###############################################################################
69
70 write_file f3 [string repeat ABCDEFGHIJK 1048576]
71 fossil extra
72 test clean-9 {[normalize_result] eq {f2
73 f3}}
 
74
75 ###############################################################################
76
77 # clean w/undo enabled, no prompt, 1 file < 10MiB, 1 file > 10MiB
78 fossil clean --no-prompt
@@ -80,24 +81,25 @@
80 {"fossil undo" is available to undo changes to the working checkout.}}
81
82 ###############################################################################
83
84 fossil extra
85 test clean-11 {[normalize_result] eq {f3}}
86
87 ###############################################################################
88
89 fossil undo
90 test clean-12 {[normalize_result] eq {NEW f2}}
91 test clean-13 {[read_file f2] eq "f2 line"}
92 test clean-14 {[read_file f3] eq [string repeat ABCDEFGHIJK 1048576]}
93
94 ###############################################################################
95
96 fossil extra
97 test clean-15 {[normalize_result] eq {f2
98 f3}}
 
99
100 ###############################################################################
101
102 # clean w/undo enabled, force, 1 file < 10MiB, 1 file > 10MiB
103 fossil clean --force
@@ -105,63 +107,65 @@
105 {"fossil undo" is available to undo changes to the working checkout.}}
106
107 ###############################################################################
108
109 fossil extra
110 test clean-17 {[normalize_result] eq {}}
111
112 ###############################################################################
113
114 fossil undo
115 test clean-18 {[normalize_result] eq {NEW f2}}
116 test clean-19 {[read_file f2] eq "f2 line"}
117
118 ###############################################################################
119
120 write_file f4 [string repeat KJIHGFEDCBA 1048576]
121 fossil extra
122 test clean-20 {[normalize_result] eq {f2
123 f4}}
 
124
125 ###############################################################################
126
127 # clean w/undo disabled, no prompt, 1 file < 10MiB, 1 file > 10MiB
128 fossil clean --disable-undo --no-prompt
129 test clean-21 {[normalize_result] eq {}}
130
131 ###############################################################################
132
133 fossil extra
134 test clean-22 {[normalize_result] eq {f2
135 f4}}
 
136
137 ###############################################################################
138
139 fossil undo -expectError
140 test clean-23 {[normalize_result] eq {nothing to undo}}
141
142 ###############################################################################
143
144 # clean w/undo disabled, force, 1 file < 10MiB, 1 file > 10MiB
145 fossil clean --disable-undo --force
146 test clean-24 {[normalize_result] eq {}}
147
148 ###############################################################################
149
150 fossil extra
151 test clean-25 {[normalize_result] eq {}}
152
153 ###############################################################################
154
155 fossil undo -expectError
156 test clean-26 {[normalize_result] eq {nothing to undo}}
157
158 ###############################################################################
159
160 write_file f5 "f5 line"
161 fossil extra
162 test clean-27 {[normalize_result] eq {f5}}
163
164 ###############################################################################
165
166 # clean w/undo disabled, should prompt, 1 file < 10MiB
167 fossil_maybe_answer Y clean --disable-undo
@@ -172,20 +176,20 @@
172 Remove unmanaged file "f5" (a=all/y/N)?}}
173
174 ###############################################################################
175
176 fossil extra
177 test clean-29 {[normalize_result] eq {}}
178
179 ###############################################################################
180
181 fossil undo -expectError
182 test clean-30 {[normalize_result] eq {nothing to undo}}
183
184 ###############################################################################
185
186 fossil extra
187 test clean-31 {[normalize_result] eq {}}
188
189 ###############################################################################
190
191 test_cleanup
192
--- test/clean.test
+++ test/clean.test
@@ -21,28 +21,28 @@
21 test_setup
22
23 ###############################################################################
24
25 fossil extra
26 test_eq clean-0 [normalize_result] {}
27
28 ###############################################################################
29
30 commit_file f1 "f1 line" "base file"
31 fossil ls
32 test_eq clean-1 [normalize_result] {f1}
33
34 ###############################################################################
35
36 fossil extra
37 test_eq clean-2 [normalize_result] {}
38
39 ###############################################################################
40
41 write_file f2 "f2 line"
42 fossil extra
43 test_eq clean-3 [normalize_result] {f2}
44
45 ###############################################################################
46
47 # clean w/undo enabled, should not prompt, 1 file < 10MiB
48 fossil clean
@@ -50,29 +50,30 @@
50 {"fossil undo" is available to undo changes to the working checkout.}}
51
52 ###############################################################################
53
54 fossil extra
55 test_eq clean-5 [normalize_result] {}
56
57 ###############################################################################
58
59 fossil undo
60 test_eq clean-6 [normalize_result] {NEW f2}
61 test_eq clean-7 [read_file f2] "f2 line"
62
63 ###############################################################################
64
65 fossil extra
66 test_eq clean-8 [normalize_result] {f2}
67
68 ###############################################################################
69
70 write_file f3 [string repeat ABCDEFGHIJK 1048576]
71 fossil extra
72 test_eq clean-9 [normalize_result] \
73 {f2
74 f3}
75
76 ###############################################################################
77
78 # clean w/undo enabled, no prompt, 1 file < 10MiB, 1 file > 10MiB
79 fossil clean --no-prompt
@@ -80,24 +81,25 @@
81 {"fossil undo" is available to undo changes to the working checkout.}}
82
83 ###############################################################################
84
85 fossil extra
86 test_eq clean-11 [normalize_result] {f3}
87
88 ###############################################################################
89
90 fossil undo
91 test_eq clean-12 [normalize_result] {NEW f2}
92 test_eq clean-13 [read_file f2] "f2 line"
93 test_eq clean-14 [read_file f3] [string repeat ABCDEFGHIJK 1048576]
94
95 ###############################################################################
96
97 fossil extra
98 test_eq clean-15 [normalize_result] \
99 {f2
100 f3}
101
102 ###############################################################################
103
104 # clean w/undo enabled, force, 1 file < 10MiB, 1 file > 10MiB
105 fossil clean --force
@@ -105,63 +107,65 @@
107 {"fossil undo" is available to undo changes to the working checkout.}}
108
109 ###############################################################################
110
111 fossil extra
112 test_eq clean-17 [normalize_result] {}
113
114 ###############################################################################
115
116 fossil undo
117 test_eq clean-18 [normalize_result] {NEW f2}
118 test_eq clean-19 [read_file f2] "f2 line"
119
120 ###############################################################################
121
122 write_file f4 [string repeat KJIHGFEDCBA 1048576]
123 fossil extra
124 test_eq clean-20 [normalize_result] \
125 {f2
126 f4}
127
128 ###############################################################################
129
130 # clean w/undo disabled, no prompt, 1 file < 10MiB, 1 file > 10MiB
131 fossil clean --disable-undo --no-prompt
132 test_eq clean-21 [normalize_result] {}
133
134 ###############################################################################
135
136 fossil extra
137 test_eq clean-22 [normalize_result] \
138 {f2
139 f4}
140
141 ###############################################################################
142
143 fossil undo -expectError
144 test_eq clean-23 [normalize_result] {nothing to undo}
145
146 ###############################################################################
147
148 # clean w/undo disabled, force, 1 file < 10MiB, 1 file > 10MiB
149 fossil clean --disable-undo --force
150 test_eq clean-24 [normalize_result] {}
151
152 ###############################################################################
153
154 fossil extra
155 test_eq clean-25 [normalize_result] {}
156
157 ###############################################################################
158
159 fossil undo -expectError
160 test_eq clean-26 [normalize_result] {nothing to undo}
161
162 ###############################################################################
163
164 write_file f5 "f5 line"
165 fossil extra
166 test_eq clean-27 [normalize_result] {f5}
167
168 ###############################################################################
169
170 # clean w/undo disabled, should prompt, 1 file < 10MiB
171 fossil_maybe_answer Y clean --disable-undo
@@ -172,20 +176,20 @@
176 Remove unmanaged file "f5" (a=all/y/N)?}}
177
178 ###############################################################################
179
180 fossil extra
181 test_eq clean-29 [normalize_result] {}
182
183 ###############################################################################
184
185 fossil undo -expectError
186 test_eq clean-30 [normalize_result] {nothing to undo}
187
188 ###############################################################################
189
190 fossil extra
191 test_eq clean-31 [normalize_result] {}
192
193 ###############################################################################
194
195 test_cleanup
196
--- test/commit-warning.test
+++ test/commit-warning.test
@@ -19,11 +19,12 @@
1919
#
2020
2121
test_setup
2222
2323
# binary
24
-write_file binary "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
24
+write_file binary \
25
+ "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
2526
2627
# text with CRLF lines
2728
write_file crlf.txt [subst -nocommands -novariables \
2829
{ordinary text\r
2930
cariage returns and line feeds\r
@@ -71,29 +72,37 @@
7172
# valid Unicode code point. But it's complicated.
7273
write_file utf-mod-c0-80 "11 bit NUL:\xC0\x80 is sometimes ok\n"
7374
write_file utf-bad-e0-80-80 "16 bit NUL:\xE0\x80\x80 is bad\n"
7475
write_file utf-bad-f0-80-80-80 "21 bit NUL:\xF0\x80\x80\x80 is bad\n"
7576
write_file utf-bad-f8-80-80-80-80 "26 bit NUL:\xF8\x80\x80\x80\x80 is bad\n"
76
-write_file utf-bad-fc-80-80-80-80-80 "31 bit NUL:\xFC\x80\x80\x80\x80\x80 is bad\n"
77
-write_file utf-bad-fe-80-80-80-80-80-80 "36 bit NUL:\xFE\x80\x80\x80\x80\x80\x80 is bad\n"
77
+write_file utf-bad-fc-80-80-80-80-80 \
78
+ "31 bit NUL:\xFC\x80\x80\x80\x80\x80 is bad\n"
79
+write_file utf-bad-fe-80-80-80-80-80-80 \
80
+ "36 bit NUL:\xFE\x80\x80\x80\x80\x80\x80 is bad\n"
7881
write_file utf-bad-c0-81 "overlong SOH:\xC0\x81 is bad\n"
7982
write_file utf-bad-c0-bf "overlong '?':\xC0\xBF is bad\n"
8083
write_file utf-bad-c1-bf "overlong DEL:\xC1\xBF is bad\n"
81
-write_file utf-bad-f4-90-80-80 "U+110000 not allowed:\xF4\x90\x80\x80 not unicode\n"
82
-write_file utf-bad-f9-80-80-80-80 "U+2000000 not allowed:\xF9\x80\x80\x80\x80 not unicode\n"
84
+write_file utf-bad-f4-90-80-80 \
85
+ "U+110000 not allowed:\xF4\x90\x80\x80 not unicode\n"
86
+write_file utf-bad-f9-80-80-80-80 \
87
+ "U+2000000 not allowed:\xF9\x80\x80\x80\x80 not unicode\n"
8388
write_file utf-bad-ff "no byte FF:\xFF\n"
8489
write_file utf-ill16-lead "lead surrogate U+D800:\xED\xA0\x80 is ill formed\n"
8590
write_file utf-ill16-trail "trail surrogate U+DC00:\xED\xB0\x80 is ill formed\n"
86
-write_file utf-ill16-pair "surrogate pair U+10000:\xED\xA0\x80\xED\xB0\x80 is ill formed\n"
87
-set emoji "micro-smile \xC2\xB5\xE2\x98\xBA\npale facepalm \xF0\x9F\xA4\xA6\xF0\x9F\x8F\xBB\n"
91
+write_file utf-ill16-pair \
92
+ "surrogate pair U+10000:\xED\xA0\x80\xED\xB0\x80 is ill formed\n"
93
+set emoji \
94
+ [join [list \
95
+ "micro-smile \xC2\xB5\xE2\x98\xBA\n" \
96
+ "pale facepalm \xF0\x9F\xA4\xA6\xF0\x9F\x8F\xBB\n"] ""]
8897
protOut $emoji
8998
write_file utf-8-emoji $emoji
9099
write_file utf-8-bom-emoji "\xef\xbb\xbf$emoji"
91100
92101
# UTF-16 uses 16-bit values to cover all valid unicode code points
93102
# from U+0 to U+10FFFF, using surrogate pairs to escape the BMP.
94
-# Interchange require knowing (and preserving) byte order.
103
+# Interchange requires knowing (and preserving) byte order.
95104
set hello16LE "h\x00e\x00l\x00l\x00o\x00\n\x00"
96105
set hello16BE "\x00h\x00e\x00l\x00l\x00o\x00\n"
97106
write_file utf-16le-hello $hello16LE
98107
write_file utf-16be-hello $hello16BE
99108
set bomLE "\xff\xfe"
100109
--- test/commit-warning.test
+++ test/commit-warning.test
@@ -19,11 +19,12 @@
19 #
20
21 test_setup
22
23 # binary
24 write_file binary "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
 
25
26 # text with CRLF lines
27 write_file crlf.txt [subst -nocommands -novariables \
28 {ordinary text\r
29 cariage returns and line feeds\r
@@ -71,29 +72,37 @@
71 # valid Unicode code point. But it's complicated.
72 write_file utf-mod-c0-80 "11 bit NUL:\xC0\x80 is sometimes ok\n"
73 write_file utf-bad-e0-80-80 "16 bit NUL:\xE0\x80\x80 is bad\n"
74 write_file utf-bad-f0-80-80-80 "21 bit NUL:\xF0\x80\x80\x80 is bad\n"
75 write_file utf-bad-f8-80-80-80-80 "26 bit NUL:\xF8\x80\x80\x80\x80 is bad\n"
76 write_file utf-bad-fc-80-80-80-80-80 "31 bit NUL:\xFC\x80\x80\x80\x80\x80 is bad\n"
77 write_file utf-bad-fe-80-80-80-80-80-80 "36 bit NUL:\xFE\x80\x80\x80\x80\x80\x80 is bad\n"
 
 
78 write_file utf-bad-c0-81 "overlong SOH:\xC0\x81 is bad\n"
79 write_file utf-bad-c0-bf "overlong '?':\xC0\xBF is bad\n"
80 write_file utf-bad-c1-bf "overlong DEL:\xC1\xBF is bad\n"
81 write_file utf-bad-f4-90-80-80 "U+110000 not allowed:\xF4\x90\x80\x80 not unicode\n"
82 write_file utf-bad-f9-80-80-80-80 "U+2000000 not allowed:\xF9\x80\x80\x80\x80 not unicode\n"
 
 
83 write_file utf-bad-ff "no byte FF:\xFF\n"
84 write_file utf-ill16-lead "lead surrogate U+D800:\xED\xA0\x80 is ill formed\n"
85 write_file utf-ill16-trail "trail surrogate U+DC00:\xED\xB0\x80 is ill formed\n"
86 write_file utf-ill16-pair "surrogate pair U+10000:\xED\xA0\x80\xED\xB0\x80 is ill formed\n"
87 set emoji "micro-smile \xC2\xB5\xE2\x98\xBA\npale facepalm \xF0\x9F\xA4\xA6\xF0\x9F\x8F\xBB\n"
 
 
 
 
88 protOut $emoji
89 write_file utf-8-emoji $emoji
90 write_file utf-8-bom-emoji "\xef\xbb\xbf$emoji"
91
92 # UTF-16 uses 16-bit values to cover all valid unicode code points
93 # from U+0 to U+10FFFF, using surrogate pairs to escape the BMP.
94 # Interchange require knowing (and preserving) byte order.
95 set hello16LE "h\x00e\x00l\x00l\x00o\x00\n\x00"
96 set hello16BE "\x00h\x00e\x00l\x00l\x00o\x00\n"
97 write_file utf-16le-hello $hello16LE
98 write_file utf-16be-hello $hello16BE
99 set bomLE "\xff\xfe"
100
--- test/commit-warning.test
+++ test/commit-warning.test
@@ -19,11 +19,12 @@
19 #
20
21 test_setup
22
23 # binary
24 write_file binary \
25 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
26
27 # text with CRLF lines
28 write_file crlf.txt [subst -nocommands -novariables \
29 {ordinary text\r
30 cariage returns and line feeds\r
@@ -71,29 +72,37 @@
72 # valid Unicode code point. But it's complicated.
73 write_file utf-mod-c0-80 "11 bit NUL:\xC0\x80 is sometimes ok\n"
74 write_file utf-bad-e0-80-80 "16 bit NUL:\xE0\x80\x80 is bad\n"
75 write_file utf-bad-f0-80-80-80 "21 bit NUL:\xF0\x80\x80\x80 is bad\n"
76 write_file utf-bad-f8-80-80-80-80 "26 bit NUL:\xF8\x80\x80\x80\x80 is bad\n"
77 write_file utf-bad-fc-80-80-80-80-80 \
78 "31 bit NUL:\xFC\x80\x80\x80\x80\x80 is bad\n"
79 write_file utf-bad-fe-80-80-80-80-80-80 \
80 "36 bit NUL:\xFE\x80\x80\x80\x80\x80\x80 is bad\n"
81 write_file utf-bad-c0-81 "overlong SOH:\xC0\x81 is bad\n"
82 write_file utf-bad-c0-bf "overlong '?':\xC0\xBF is bad\n"
83 write_file utf-bad-c1-bf "overlong DEL:\xC1\xBF is bad\n"
84 write_file utf-bad-f4-90-80-80 \
85 "U+110000 not allowed:\xF4\x90\x80\x80 not unicode\n"
86 write_file utf-bad-f9-80-80-80-80 \
87 "U+2000000 not allowed:\xF9\x80\x80\x80\x80 not unicode\n"
88 write_file utf-bad-ff "no byte FF:\xFF\n"
89 write_file utf-ill16-lead "lead surrogate U+D800:\xED\xA0\x80 is ill formed\n"
90 write_file utf-ill16-trail "trail surrogate U+DC00:\xED\xB0\x80 is ill formed\n"
91 write_file utf-ill16-pair \
92 "surrogate pair U+10000:\xED\xA0\x80\xED\xB0\x80 is ill formed\n"
93 set emoji \
94 [join [list \
95 "micro-smile \xC2\xB5\xE2\x98\xBA\n" \
96 "pale facepalm \xF0\x9F\xA4\xA6\xF0\x9F\x8F\xBB\n"] ""]
97 protOut $emoji
98 write_file utf-8-emoji $emoji
99 write_file utf-8-bom-emoji "\xef\xbb\xbf$emoji"
100
101 # UTF-16 uses 16-bit values to cover all valid unicode code points
102 # from U+0 to U+10FFFF, using surrogate pairs to escape the BMP.
103 # Interchange requires knowing (and preserving) byte order.
104 set hello16LE "h\x00e\x00l\x00l\x00o\x00\n\x00"
105 set hello16BE "\x00h\x00e\x00l\x00l\x00o\x00\n"
106 write_file utf-16le-hello $hello16LE
107 write_file utf-16be-hello $hello16BE
108 set bomLE "\xff\xfe"
109
+33 -20
--- test/diff.test
+++ test/diff.test
@@ -48,77 +48,88 @@
4848
###############################################################################
4949
5050
write_file file0.dat "\0"
5151
fossil diff file0.dat
5252
53
-test diff-file0-1 {[normalize_result] eq "Index: file0.dat
53
+test_eq diff-file0-1 [normalize_result] \
54
+ "Index: file0.dat
5455
==================================================================
5556
--- file0.dat\t
5657
+++ file0.dat\t
57
-cannot compute difference between binary files"}
58
+cannot compute difference between binary files"
5859
5960
###############################################################################
6061
6162
write_file file1.dat [string repeat z 32768]
6263
fossil diff file1.dat
6364
64
-test diff-file1-1 {[normalize_result] eq "Index: file1.dat
65
+test_eq diff-file1-1 [normalize_result] \
66
+ "Index: file1.dat
6567
==================================================================
6668
--- file1.dat\t
6769
+++ file1.dat\t
68
-cannot compute difference between binary files"}
70
+cannot compute difference between binary files"
6971
7072
###############################################################################
7173
7274
write_file file2.dat "test file 2 (no NUL character)."
7375
fossil diff file2.dat
7476
75
-test diff-file2-1 {[normalize_result] eq "Index: file2.dat
77
+test_eq diff-file2-1 [normalize_result] \
78
+ "Index: file2.dat
7679
==================================================================
7780
--- file2.dat\t
7881
+++ file2.dat\t
79
-cannot compute difference between binary files"}
82
+cannot compute difference between binary files"
8083
8184
###############################################################################
8285
8386
write_file file3.dat "test file 3 (not a long line)."
8487
fossil diff file3.dat
8588
86
-test diff-file3-1 {[normalize_result] eq "Index: file3.dat
89
+test_eq diff-file3-1 [normalize_result] \
90
+ "Index: file3.dat
8791
==================================================================
8892
--- file3.dat\t
8993
+++ file3.dat\t
90
-cannot compute difference between binary files"}
94
+cannot compute difference between binary files"
9195
9296
###############################################################################
9397
9498
write_file file4.dat "test file 4 (not a long line).\ntwo"
9599
fossil diff file4.dat
96100
97
-test diff-file4-1 {[normalize_result] eq "Index: file4.dat
101
+test_eq diff-file4-1 [normalize_result] \
102
+ "Index: file4.dat
98103
==================================================================
99104
--- file4.dat\t
100105
+++ file4.dat\t
101
-cannot compute difference between binary files"}
106
+cannot compute difference between binary files"
102107
103108
###############################################################################
104109
105110
write_file file5.dat "[string repeat 0 16]\ntest file 5 (not a long line)."
106111
fossil diff file5.dat
107112
108
-test diff-file5-1 {[normalize_result] eq "Index: file5.dat
113
+test_eq diff-file5-1 [normalize_result] \
114
+ "Index: file5.dat
109115
==================================================================
110116
--- file5.dat\t
111117
+++ file5.dat\t
112
-cannot compute difference between binary files"}
118
+cannot compute difference between binary files"
113119
114120
###############################################################################
115121
116
-write_file file6a.dat "{\n \"abc\": {\n \"def\": false,\n \"ghi\": false\n }\n}\n"
117
-write_file file6b.dat "{\n \"abc\": {\n \"def\": false,\n \"ghi\": false\n },\n \"jkl\": {\n \"mno\": {\n \"pqr\": false\n }\n }\n}\n"
122
+write_file file6a.dat \
123
+ "{\n \"abc\": {\n \"def\": false,\n \"ghi\": false\n }\n}\n"
124
+write_file file6b.dat \
125
+ [join [list \
126
+ "{\n \"abc\": {\n \"def\": false,\n \"ghi\": false\n },\n" \
127
+ " \"jkl\": {\n \"mno\": {\n \"pqr\": false\n }\n }\n}\n"] ""]
118128
fossil xdiff -y -W 16 file6a.dat file6b.dat
119
-test diff-file-6-1 {[normalize_result] eq {========== file6a.dat ===== versus ===== file6b.dat =====
129
+test_eq diff-file-6-1 [normalize_result] \
130
+ {========== file6a.dat ===== versus ===== file6b.dat =====
120131
1 { 1 {
121132
2 "abc": { 2 "abc": {
122133
3 "def": false, 3 "def": false,
123134
4 "ghi": false 4 "ghi": false
124135
> 5 },
@@ -125,38 +136,40 @@
125136
> 6 "jkl": {
126137
> 7 "mno": {
127138
> 8 "pqr": false
128139
> 9 }
129140
5 } 10 }
130
- 6 } 11 }}}
141
+ 6 } 11 }}
131142
132143
###############################################################################
133144
134145
fossil rm file1.dat
135146
fossil diff -v file1.dat
136147
137
-test diff-deleted-file-1 {[normalize_result] eq "DELETED file1.dat
148
+test_eq diff-deleted-file-1 [normalize_result] \
149
+ "DELETED file1.dat
138150
Index: file1.dat
139151
==================================================================
140152
--- file1.dat\t
141153
+++ /dev/null\t
142154
@@ -1,1 +0,0 @@
143
--test file 1 (one line no term)."}
155
+-test file 1 (one line no term)."
144156
145157
###############################################################################
146158
147159
write_file file6.dat "test file 6 (one line no term)."
148160
fossil add file6.dat
149161
150162
fossil diff -v file6.dat
151163
152
-test diff-added-file-1 {[normalize_result] eq "ADDED file6.dat
164
+test_eq diff-added-file-1 [normalize_result] \
165
+ "ADDED file6.dat
153166
Index: file6.dat
154167
==================================================================
155168
--- /dev/null\t
156169
+++ file6.dat\t
157170
@@ -0,0 +1,1 @@
158
-+test file 6 (one line no term)."}
171
++test file 6 (one line no term)."
159172
160173
###############################################################################
161174
162175
test_cleanup
163176
--- test/diff.test
+++ test/diff.test
@@ -48,77 +48,88 @@
48 ###############################################################################
49
50 write_file file0.dat "\0"
51 fossil diff file0.dat
52
53 test diff-file0-1 {[normalize_result] eq "Index: file0.dat
 
54 ==================================================================
55 --- file0.dat\t
56 +++ file0.dat\t
57 cannot compute difference between binary files"}
58
59 ###############################################################################
60
61 write_file file1.dat [string repeat z 32768]
62 fossil diff file1.dat
63
64 test diff-file1-1 {[normalize_result] eq "Index: file1.dat
 
65 ==================================================================
66 --- file1.dat\t
67 +++ file1.dat\t
68 cannot compute difference between binary files"}
69
70 ###############################################################################
71
72 write_file file2.dat "test file 2 (no NUL character)."
73 fossil diff file2.dat
74
75 test diff-file2-1 {[normalize_result] eq "Index: file2.dat
 
76 ==================================================================
77 --- file2.dat\t
78 +++ file2.dat\t
79 cannot compute difference between binary files"}
80
81 ###############################################################################
82
83 write_file file3.dat "test file 3 (not a long line)."
84 fossil diff file3.dat
85
86 test diff-file3-1 {[normalize_result] eq "Index: file3.dat
 
87 ==================================================================
88 --- file3.dat\t
89 +++ file3.dat\t
90 cannot compute difference between binary files"}
91
92 ###############################################################################
93
94 write_file file4.dat "test file 4 (not a long line).\ntwo"
95 fossil diff file4.dat
96
97 test diff-file4-1 {[normalize_result] eq "Index: file4.dat
 
98 ==================================================================
99 --- file4.dat\t
100 +++ file4.dat\t
101 cannot compute difference between binary files"}
102
103 ###############################################################################
104
105 write_file file5.dat "[string repeat 0 16]\ntest file 5 (not a long line)."
106 fossil diff file5.dat
107
108 test diff-file5-1 {[normalize_result] eq "Index: file5.dat
 
109 ==================================================================
110 --- file5.dat\t
111 +++ file5.dat\t
112 cannot compute difference between binary files"}
113
114 ###############################################################################
115
116 write_file file6a.dat "{\n \"abc\": {\n \"def\": false,\n \"ghi\": false\n }\n}\n"
117 write_file file6b.dat "{\n \"abc\": {\n \"def\": false,\n \"ghi\": false\n },\n \"jkl\": {\n \"mno\": {\n \"pqr\": false\n }\n }\n}\n"
 
 
 
 
118 fossil xdiff -y -W 16 file6a.dat file6b.dat
119 test diff-file-6-1 {[normalize_result] eq {========== file6a.dat ===== versus ===== file6b.dat =====
 
120 1 { 1 {
121 2 "abc": { 2 "abc": {
122 3 "def": false, 3 "def": false,
123 4 "ghi": false 4 "ghi": false
124 > 5 },
@@ -125,38 +136,40 @@
125 > 6 "jkl": {
126 > 7 "mno": {
127 > 8 "pqr": false
128 > 9 }
129 5 } 10 }
130 6 } 11 }}}
131
132 ###############################################################################
133
134 fossil rm file1.dat
135 fossil diff -v file1.dat
136
137 test diff-deleted-file-1 {[normalize_result] eq "DELETED file1.dat
 
138 Index: file1.dat
139 ==================================================================
140 --- file1.dat\t
141 +++ /dev/null\t
142 @@ -1,1 +0,0 @@
143 -test file 1 (one line no term)."}
144
145 ###############################################################################
146
147 write_file file6.dat "test file 6 (one line no term)."
148 fossil add file6.dat
149
150 fossil diff -v file6.dat
151
152 test diff-added-file-1 {[normalize_result] eq "ADDED file6.dat
 
153 Index: file6.dat
154 ==================================================================
155 --- /dev/null\t
156 +++ file6.dat\t
157 @@ -0,0 +1,1 @@
158 +test file 6 (one line no term)."}
159
160 ###############################################################################
161
162 test_cleanup
163
--- test/diff.test
+++ test/diff.test
@@ -48,77 +48,88 @@
48 ###############################################################################
49
50 write_file file0.dat "\0"
51 fossil diff file0.dat
52
53 test_eq diff-file0-1 [normalize_result] \
54 "Index: file0.dat
55 ==================================================================
56 --- file0.dat\t
57 +++ file0.dat\t
58 cannot compute difference between binary files"
59
60 ###############################################################################
61
62 write_file file1.dat [string repeat z 32768]
63 fossil diff file1.dat
64
65 test_eq diff-file1-1 [normalize_result] \
66 "Index: file1.dat
67 ==================================================================
68 --- file1.dat\t
69 +++ file1.dat\t
70 cannot compute difference between binary files"
71
72 ###############################################################################
73
74 write_file file2.dat "test file 2 (no NUL character)."
75 fossil diff file2.dat
76
77 test_eq diff-file2-1 [normalize_result] \
78 "Index: file2.dat
79 ==================================================================
80 --- file2.dat\t
81 +++ file2.dat\t
82 cannot compute difference between binary files"
83
84 ###############################################################################
85
86 write_file file3.dat "test file 3 (not a long line)."
87 fossil diff file3.dat
88
89 test_eq diff-file3-1 [normalize_result] \
90 "Index: file3.dat
91 ==================================================================
92 --- file3.dat\t
93 +++ file3.dat\t
94 cannot compute difference between binary files"
95
96 ###############################################################################
97
98 write_file file4.dat "test file 4 (not a long line).\ntwo"
99 fossil diff file4.dat
100
101 test_eq diff-file4-1 [normalize_result] \
102 "Index: file4.dat
103 ==================================================================
104 --- file4.dat\t
105 +++ file4.dat\t
106 cannot compute difference between binary files"
107
108 ###############################################################################
109
110 write_file file5.dat "[string repeat 0 16]\ntest file 5 (not a long line)."
111 fossil diff file5.dat
112
113 test_eq diff-file5-1 [normalize_result] \
114 "Index: file5.dat
115 ==================================================================
116 --- file5.dat\t
117 +++ file5.dat\t
118 cannot compute difference between binary files"
119
120 ###############################################################################
121
122 write_file file6a.dat \
123 "{\n \"abc\": {\n \"def\": false,\n \"ghi\": false\n }\n}\n"
124 write_file file6b.dat \
125 [join [list \
126 "{\n \"abc\": {\n \"def\": false,\n \"ghi\": false\n },\n" \
127 " \"jkl\": {\n \"mno\": {\n \"pqr\": false\n }\n }\n}\n"] ""]
128 fossil xdiff -y -W 16 file6a.dat file6b.dat
129 test_eq diff-file-6-1 [normalize_result] \
130 {========== file6a.dat ===== versus ===== file6b.dat =====
131 1 { 1 {
132 2 "abc": { 2 "abc": {
133 3 "def": false, 3 "def": false,
134 4 "ghi": false 4 "ghi": false
135 > 5 },
@@ -125,38 +136,40 @@
136 > 6 "jkl": {
137 > 7 "mno": {
138 > 8 "pqr": false
139 > 9 }
140 5 } 10 }
141 6 } 11 }}
142
143 ###############################################################################
144
145 fossil rm file1.dat
146 fossil diff -v file1.dat
147
148 test_eq diff-deleted-file-1 [normalize_result] \
149 "DELETED file1.dat
150 Index: file1.dat
151 ==================================================================
152 --- file1.dat\t
153 +++ /dev/null\t
154 @@ -1,1 +0,0 @@
155 -test file 1 (one line no term)."
156
157 ###############################################################################
158
159 write_file file6.dat "test file 6 (one line no term)."
160 fossil add file6.dat
161
162 fossil diff -v file6.dat
163
164 test_eq diff-added-file-1 [normalize_result] \
165 "ADDED file6.dat
166 Index: file6.dat
167 ==================================================================
168 --- /dev/null\t
169 +++ file6.dat\t
170 @@ -0,0 +1,1 @@
171 +test file 6 (one line no term)."
172
173 ###############################################################################
174
175 test_cleanup
176
+18 -9
--- test/file1.test
+++ test/file1.test
@@ -71,29 +71,38 @@
7171
}
7272
7373
# This is needed because we are now running outside of the Fossil checkout.
7474
file mkdir file1; set savedPwd [pwd]; cd file1
7575
76
-# Those directories are only needed for the testcase being able to "--chdir" to it.
76
+# Those directories are only needed for the testcase being able to "--chdir" to
77
+# it.
7778
file mkdir test1
7879
file mkdir test1/test2
7980
8081
relative-name 100 . . . test1 [pwd] .. test1 [pwd]/ .. test1 [pwd]/test ../test
81
-relative-name 101 test1/test2 [pwd] ../.. test1/test2 [pwd]/ ../.. test1/test2 [pwd]/test ../../test
82
-relative-name 102 test1 [pwd]/test ../test . [pwd]/file1 ./file1 . [pwd]/file1/file2 ./file1/file2
82
+relative-name 101 test1/test2 [pwd] ../.. test1/test2 [pwd]/ ../.. test1/test2 \
83
+ [pwd]/test ../../test
84
+relative-name 102 test1 [pwd]/test ../test . [pwd]/file1 ./file1 . \
85
+ [pwd]/file1/file2 ./file1/file2
8386
relative-name 103 . [pwd] .
8487
85
-relative-tree-name 100 . . file1 test1 [pwd] file1 test1 [pwd]/ file1 test1 [pwd]/test file1/test
86
-relative-tree-name 101 test1/test2 [pwd] file1 test1/test2 [pwd]/ file1 test1/test2 [pwd]/test file1/test
87
-relative-tree-name 102 test1 [pwd]/test file1/test . [pwd]/file1 file1/file1 . [pwd]/file1/file2 file1/file1/file2
88
+relative-tree-name 100 . . file1 test1 [pwd] file1 test1 [pwd]/ file1 test1 \
89
+ [pwd]/test file1/test
90
+relative-tree-name 101 test1/test2 [pwd] file1 test1/test2 [pwd]/ file1 \
91
+ test1/test2 [pwd]/test file1/test
92
+relative-tree-name 102 test1 [pwd]/test file1/test . [pwd]/file1 file1/file1 . \
93
+ [pwd]/file1/file2 file1/file1/file2
8894
relative-tree-name 103 . [pwd] file1
8995
9096
set dirname [file normalize [file dirname [pwd]]]
9197
92
-absolute-tree-name 100 . . $dirname test1 [pwd] [pwd] test1 [pwd]/ $dirname/file1 test1 [pwd]/test $dirname/file1/test
93
-absolute-tree-name 101 test1/test2 [pwd] $dirname/file1 test1/test2 [pwd]/ $dirname/file1 test1/test2 [pwd]/test $dirname/file1/test
94
-absolute-tree-name 102 test1 [pwd]/test $dirname/file1/test . [pwd]/file1 $dirname/file1/file1 . [pwd]/file1/file2 $dirname/file1/file1/file2
98
+absolute-tree-name 100 . . $dirname test1 [pwd] [pwd] test1 [pwd]/ \
99
+ $dirname/file1 test1 [pwd]/test $dirname/file1/test
100
+absolute-tree-name 101 test1/test2 [pwd] $dirname/file1 test1/test2 [pwd]/ \
101
+ $dirname/file1 test1/test2 [pwd]/test $dirname/file1/test
102
+absolute-tree-name 102 test1 [pwd]/test $dirname/file1/test . [pwd]/file1 \
103
+ $dirname/file1/file1 . [pwd]/file1/file2 $dirname/file1/file1/file2
95104
absolute-tree-name 103 . [pwd] $dirname/file1
96105
97106
catch {file delete test1/test2}
98107
catch {file delete test1}
99108
100109
--- test/file1.test
+++ test/file1.test
@@ -71,29 +71,38 @@
71 }
72
73 # This is needed because we are now running outside of the Fossil checkout.
74 file mkdir file1; set savedPwd [pwd]; cd file1
75
76 # Those directories are only needed for the testcase being able to "--chdir" to it.
 
77 file mkdir test1
78 file mkdir test1/test2
79
80 relative-name 100 . . . test1 [pwd] .. test1 [pwd]/ .. test1 [pwd]/test ../test
81 relative-name 101 test1/test2 [pwd] ../.. test1/test2 [pwd]/ ../.. test1/test2 [pwd]/test ../../test
82 relative-name 102 test1 [pwd]/test ../test . [pwd]/file1 ./file1 . [pwd]/file1/file2 ./file1/file2
 
 
83 relative-name 103 . [pwd] .
84
85 relative-tree-name 100 . . file1 test1 [pwd] file1 test1 [pwd]/ file1 test1 [pwd]/test file1/test
86 relative-tree-name 101 test1/test2 [pwd] file1 test1/test2 [pwd]/ file1 test1/test2 [pwd]/test file1/test
87 relative-tree-name 102 test1 [pwd]/test file1/test . [pwd]/file1 file1/file1 . [pwd]/file1/file2 file1/file1/file2
 
 
 
88 relative-tree-name 103 . [pwd] file1
89
90 set dirname [file normalize [file dirname [pwd]]]
91
92 absolute-tree-name 100 . . $dirname test1 [pwd] [pwd] test1 [pwd]/ $dirname/file1 test1 [pwd]/test $dirname/file1/test
93 absolute-tree-name 101 test1/test2 [pwd] $dirname/file1 test1/test2 [pwd]/ $dirname/file1 test1/test2 [pwd]/test $dirname/file1/test
94 absolute-tree-name 102 test1 [pwd]/test $dirname/file1/test . [pwd]/file1 $dirname/file1/file1 . [pwd]/file1/file2 $dirname/file1/file1/file2
 
 
 
95 absolute-tree-name 103 . [pwd] $dirname/file1
96
97 catch {file delete test1/test2}
98 catch {file delete test1}
99
100
--- test/file1.test
+++ test/file1.test
@@ -71,29 +71,38 @@
71 }
72
73 # This is needed because we are now running outside of the Fossil checkout.
74 file mkdir file1; set savedPwd [pwd]; cd file1
75
76 # Those directories are only needed for the testcase being able to "--chdir" to
77 # it.
78 file mkdir test1
79 file mkdir test1/test2
80
81 relative-name 100 . . . test1 [pwd] .. test1 [pwd]/ .. test1 [pwd]/test ../test
82 relative-name 101 test1/test2 [pwd] ../.. test1/test2 [pwd]/ ../.. test1/test2 \
83 [pwd]/test ../../test
84 relative-name 102 test1 [pwd]/test ../test . [pwd]/file1 ./file1 . \
85 [pwd]/file1/file2 ./file1/file2
86 relative-name 103 . [pwd] .
87
88 relative-tree-name 100 . . file1 test1 [pwd] file1 test1 [pwd]/ file1 test1 \
89 [pwd]/test file1/test
90 relative-tree-name 101 test1/test2 [pwd] file1 test1/test2 [pwd]/ file1 \
91 test1/test2 [pwd]/test file1/test
92 relative-tree-name 102 test1 [pwd]/test file1/test . [pwd]/file1 file1/file1 . \
93 [pwd]/file1/file2 file1/file1/file2
94 relative-tree-name 103 . [pwd] file1
95
96 set dirname [file normalize [file dirname [pwd]]]
97
98 absolute-tree-name 100 . . $dirname test1 [pwd] [pwd] test1 [pwd]/ \
99 $dirname/file1 test1 [pwd]/test $dirname/file1/test
100 absolute-tree-name 101 test1/test2 [pwd] $dirname/file1 test1/test2 [pwd]/ \
101 $dirname/file1 test1/test2 [pwd]/test $dirname/file1/test
102 absolute-tree-name 102 test1 [pwd]/test $dirname/file1/test . [pwd]/file1 \
103 $dirname/file1/file1 . [pwd]/file1/file2 $dirname/file1/file1/file2
104 absolute-tree-name 103 . [pwd] $dirname/file1
105
106 catch {file delete test1/test2}
107 catch {file delete test1}
108
109
+19 -78
--- test/http.test
+++ test/http.test
@@ -1,12 +1,11 @@
11
#
2
-# Tests of fossil's HTTP and HTTPS client. Servers in this file send
3
-# fossil replies that HTTP/1.1 allows, which must give a complete clone,
4
-# and malformed replies, which must make the clone fail with a message
5
-# and not leave a repository behind. Others close or reset the connection,
6
-# record the request line fossil sends, or present certificates that
7
-# fossil must or must not trust.
2
+# Tests of fossil's HTTP and HTTPS client. A clone must work when the
3
+# reply is framed in any way HTTP/1.1 allows. It must fail with a
4
+# message, and leave no repository, when the reply is malformed or the
5
+# connection is closed or reset. Other tests check the request line
6
+# fossil sends and which certificates it trusts.
87
#
98
# The HTTPS tests need openssl and a fossil built with TLS support. The
109
# tests that reset a connection, and the HTTPS tests that check what
1110
# fossil does with a reply, need python3 to run http-relay.py.
1211
#
@@ -34,58 +33,24 @@
3433
test_setup ""
3534
fossil test-th-eval {hasfeature ssl}
3635
set haveTls [expr {[normalize_result] eq "1" && [auto_execok openssl] ne ""}]
3736
set havePython [expr {[auto_execok python3] ne ""}]
3837
set haveIpv6 [expr {![catch {close [socket -server list -myaddr ::1 0]}]}]
39
-set httpServers [list]
4038
set httpPids [list]
4139
set httpFossilServers [list]
4240
set httpAnswer ""
4341
44
-# Runs fossil with ARGS and INPUT on its standard input, while the event
45
-# loop runs the servers in this file. Sets RESULT to fossil's output and
46
-# CODE to its exit status, the name of the signal that ended it, or
47
-# "timeout" if it ran for more than 60 seconds.
48
-#
49
-proc http_fossil {input args} {
50
- global RESULT CODE LASTCMD
51
- set LASTCMD [list $::fossilexe {*}$args]
52
- protOut $LASTCMD
53
- set chan [open |[concat $LASTCMD [list << $input 2>@1]] r]
54
- fconfigure $chan -blocking 0
55
- set ::httpOutput ""
56
- set ::httpDone 0
57
- fileevent $chan readable [list http_fossil_read $chan]
58
- set timer [after 60000 {set ::httpDone timeout}]
59
- vwait ::httpDone
60
- after cancel $timer
61
- if {$::httpDone eq "timeout"} {
62
- catch {exec kill -KILL {*}[pid $chan]}
63
- }
64
- fconfigure $chan -blocking 1
65
- set CODE 0
66
- if {[catch {close $chan} msg options]} {
67
- set CODE [lindex [dict get $options -errorcode] 2]
68
- }
69
- if {$::httpDone eq "timeout"} {set CODE timeout}
70
- set RESULT [string trim $::httpOutput]
71
-}
72
-
73
-proc http_fossil_read {chan} {
74
- append ::httpOutput [read $chan]
75
- if {[eof $chan]} {set ::httpDone 1}
76
-}
77
-
7842
# Clones URL into c.fossil with the options in ARGS, answering fossil's
7943
# prompts with the lines in httpAnswer. Returns "cloned" when the clone
8044
# is a complete copy of r.fossil. When fossil exits with status 1 and
8145
# does not leave c.fossil, returns its output, and otherwise says what
8246
# went wrong.
8347
#
8448
proc http_clone {url args} {
8549
file delete c.fossil
86
- http_fossil $::httpAnswer clone $url c.fossil {*}$args
50
+ fossil_raw -seconds 60 -input $::httpAnswer clone $url c.fossil {*}$args
51
+ set ::RESULT [string trim $::RESULT]
8752
if {$::CODE == 0} {
8853
fossil sql -R c.fossil "SELECT count(*) FROM blob"
8954
if {$::RESULT == $::httpBlobs} {return cloned}
9055
return "cloned $::RESULT of $::httpBlobs blobs"
9156
}
@@ -97,47 +62,23 @@
9762
# Listens on a port on 127.0.0.1 that the system chooses, and returns
9863
# the port. Calls HANDLER with each connection and the request on it,
9964
# once the whole request has arrived, and then closes the connection.
10065
#
10166
proc http_listen {handler} {
102
- set server [socket -server [list http_accept $handler] -myaddr 127.0.0.1 0]
103
- lappend ::httpServers $server
104
- return [lindex [fconfigure $server -sockname] 2]
105
-}
106
-
107
-proc http_accept {handler chan address port} {
108
- fconfigure $chan -translation binary -blocking 0
109
- set ::httpRequest($chan) ""
110
- fileevent $chan readable [list http_receive $handler $chan]
111
-}
112
-
113
-proc http_receive {handler chan} {
114
- append ::httpRequest($chan) [read $chan]
115
- set request $::httpRequest($chan)
116
- set end [string first "\r\n\r\n" $request]
117
- set length 0
118
- regexp -nocase -line {^content-length:\s*(\d+)} $request -> length
119
- if {![eof $chan] &&
120
- ($end < 0 || [string length $request] < $end + 4 + $length)} {
121
- return
122
- }
123
- unset ::httpRequest($chan)
124
- fileevent $chan readable {}
125
- fconfigure $chan -blocking 1
126
- if {$end >= 0} {
127
- catch {{*}$handler $chan $request}
128
- }
129
- catch {close $chan}
130
-}
131
-
132
-# Listens like http_listen, and closes each connection as soon as it is
133
-# accepted.
134
-#
67
+ return [test_listen [list http_receive $handler]]
68
+}
69
+
70
+proc http_receive {handler chan request} {
71
+ if {[string first "\r\n\r\n" $request] >= 0} {
72
+ {*}$handler $chan $request
73
+ }
74
+}
75
+
13576
proc http_listen_close {} {
13677
set server [socket -server {apply {{chan address port} {close $chan}}} \
13778
-myaddr 127.0.0.1 0]
138
- lappend ::httpServers $server
79
+ lappend ::testListeners $server
13980
return [lindex [fconfigure $server -sockname] 2]
14081
}
14182
14283
# Starts http-relay.py with ARGS and returns the port it listens on. Its
14384
# output goes to relay-PORT.log.
@@ -358,11 +299,11 @@
358299
puts -nonewline $chan "HTTP/1.1 200 OK\r\nContent-Length: 3\r\n"
359300
puts -nonewline $chan "Connection: close\r\n\r\nnew"
360301
}
361302
}
362303
set port [http_listen http_redirect]
363
-http_fossil "" test-httpmsg http://127.0.0.1:$port/old --out new.txt
304
+fossil_raw -seconds 60 test-httpmsg http://127.0.0.1:$port/old --out new.txt
364305
test_eq http-rfc-relative-redirect \
365306
[expr {[file exists new.txt] ? [read_file new.txt] : ""}] new knownBug
366307
367308
# xfer lines with more tokens than any card has. The clone must fail
368309
# with "unknown command" and not crash.
@@ -629,12 +570,12 @@
629570
test_eq http-rfc-https-trailing-dot \
630571
[http_clone https://localhost.:$tlsPort/] cloned
631572
unset env(SSL_CERT_FILE)
632573
}
633574
634
-foreach server $httpServers {close $server}
575
+test_listen_stop
635576
foreach pid $httpPids {catch {exec kill $pid}}
636577
foreach server $httpFossilServers {
637578
test_stop_server [lindex $server 0] [lindex $server 0] [lindex $server 2]
638579
}
639580
array set env [array get httpSavedEnv]
640581
test_cleanup
641582
--- test/http.test
+++ test/http.test
@@ -1,12 +1,11 @@
1 #
2 # Tests of fossil's HTTP and HTTPS client. Servers in this file send
3 # fossil replies that HTTP/1.1 allows, which must give a complete clone,
4 # and malformed replies, which must make the clone fail with a message
5 # and not leave a repository behind. Others close or reset the connection,
6 # record the request line fossil sends, or present certificates that
7 # fossil must or must not trust.
8 #
9 # The HTTPS tests need openssl and a fossil built with TLS support. The
10 # tests that reset a connection, and the HTTPS tests that check what
11 # fossil does with a reply, need python3 to run http-relay.py.
12 #
@@ -34,58 +33,24 @@
34 test_setup ""
35 fossil test-th-eval {hasfeature ssl}
36 set haveTls [expr {[normalize_result] eq "1" && [auto_execok openssl] ne ""}]
37 set havePython [expr {[auto_execok python3] ne ""}]
38 set haveIpv6 [expr {![catch {close [socket -server list -myaddr ::1 0]}]}]
39 set httpServers [list]
40 set httpPids [list]
41 set httpFossilServers [list]
42 set httpAnswer ""
43
44 # Runs fossil with ARGS and INPUT on its standard input, while the event
45 # loop runs the servers in this file. Sets RESULT to fossil's output and
46 # CODE to its exit status, the name of the signal that ended it, or
47 # "timeout" if it ran for more than 60 seconds.
48 #
49 proc http_fossil {input args} {
50 global RESULT CODE LASTCMD
51 set LASTCMD [list $::fossilexe {*}$args]
52 protOut $LASTCMD
53 set chan [open |[concat $LASTCMD [list << $input 2>@1]] r]
54 fconfigure $chan -blocking 0
55 set ::httpOutput ""
56 set ::httpDone 0
57 fileevent $chan readable [list http_fossil_read $chan]
58 set timer [after 60000 {set ::httpDone timeout}]
59 vwait ::httpDone
60 after cancel $timer
61 if {$::httpDone eq "timeout"} {
62 catch {exec kill -KILL {*}[pid $chan]}
63 }
64 fconfigure $chan -blocking 1
65 set CODE 0
66 if {[catch {close $chan} msg options]} {
67 set CODE [lindex [dict get $options -errorcode] 2]
68 }
69 if {$::httpDone eq "timeout"} {set CODE timeout}
70 set RESULT [string trim $::httpOutput]
71 }
72
73 proc http_fossil_read {chan} {
74 append ::httpOutput [read $chan]
75 if {[eof $chan]} {set ::httpDone 1}
76 }
77
78 # Clones URL into c.fossil with the options in ARGS, answering fossil's
79 # prompts with the lines in httpAnswer. Returns "cloned" when the clone
80 # is a complete copy of r.fossil. When fossil exits with status 1 and
81 # does not leave c.fossil, returns its output, and otherwise says what
82 # went wrong.
83 #
84 proc http_clone {url args} {
85 file delete c.fossil
86 http_fossil $::httpAnswer clone $url c.fossil {*}$args
 
87 if {$::CODE == 0} {
88 fossil sql -R c.fossil "SELECT count(*) FROM blob"
89 if {$::RESULT == $::httpBlobs} {return cloned}
90 return "cloned $::RESULT of $::httpBlobs blobs"
91 }
@@ -97,47 +62,23 @@
97 # Listens on a port on 127.0.0.1 that the system chooses, and returns
98 # the port. Calls HANDLER with each connection and the request on it,
99 # once the whole request has arrived, and then closes the connection.
100 #
101 proc http_listen {handler} {
102 set server [socket -server [list http_accept $handler] -myaddr 127.0.0.1 0]
103 lappend ::httpServers $server
104 return [lindex [fconfigure $server -sockname] 2]
105 }
106
107 proc http_accept {handler chan address port} {
108 fconfigure $chan -translation binary -blocking 0
109 set ::httpRequest($chan) ""
110 fileevent $chan readable [list http_receive $handler $chan]
111 }
112
113 proc http_receive {handler chan} {
114 append ::httpRequest($chan) [read $chan]
115 set request $::httpRequest($chan)
116 set end [string first "\r\n\r\n" $request]
117 set length 0
118 regexp -nocase -line {^content-length:\s*(\d+)} $request -> length
119 if {![eof $chan] &&
120 ($end < 0 || [string length $request] < $end + 4 + $length)} {
121 return
122 }
123 unset ::httpRequest($chan)
124 fileevent $chan readable {}
125 fconfigure $chan -blocking 1
126 if {$end >= 0} {
127 catch {{*}$handler $chan $request}
128 }
129 catch {close $chan}
130 }
131
132 # Listens like http_listen, and closes each connection as soon as it is
133 # accepted.
134 #
135 proc http_listen_close {} {
136 set server [socket -server {apply {{chan address port} {close $chan}}} \
137 -myaddr 127.0.0.1 0]
138 lappend ::httpServers $server
139 return [lindex [fconfigure $server -sockname] 2]
140 }
141
142 # Starts http-relay.py with ARGS and returns the port it listens on. Its
143 # output goes to relay-PORT.log.
@@ -358,11 +299,11 @@
358 puts -nonewline $chan "HTTP/1.1 200 OK\r\nContent-Length: 3\r\n"
359 puts -nonewline $chan "Connection: close\r\n\r\nnew"
360 }
361 }
362 set port [http_listen http_redirect]
363 http_fossil "" test-httpmsg http://127.0.0.1:$port/old --out new.txt
364 test_eq http-rfc-relative-redirect \
365 [expr {[file exists new.txt] ? [read_file new.txt] : ""}] new knownBug
366
367 # xfer lines with more tokens than any card has. The clone must fail
368 # with "unknown command" and not crash.
@@ -629,12 +570,12 @@
629 test_eq http-rfc-https-trailing-dot \
630 [http_clone https://localhost.:$tlsPort/] cloned
631 unset env(SSL_CERT_FILE)
632 }
633
634 foreach server $httpServers {close $server}
635 foreach pid $httpPids {catch {exec kill $pid}}
636 foreach server $httpFossilServers {
637 test_stop_server [lindex $server 0] [lindex $server 0] [lindex $server 2]
638 }
639 array set env [array get httpSavedEnv]
640 test_cleanup
641
--- test/http.test
+++ test/http.test
@@ -1,12 +1,11 @@
1 #
2 # Tests of fossil's HTTP and HTTPS client. A clone must work when the
3 # reply is framed in any way HTTP/1.1 allows. It must fail with a
4 # message, and leave no repository, when the reply is malformed or the
5 # connection is closed or reset. Other tests check the request line
6 # fossil sends and which certificates it trusts.
 
7 #
8 # The HTTPS tests need openssl and a fossil built with TLS support. The
9 # tests that reset a connection, and the HTTPS tests that check what
10 # fossil does with a reply, need python3 to run http-relay.py.
11 #
@@ -34,58 +33,24 @@
33 test_setup ""
34 fossil test-th-eval {hasfeature ssl}
35 set haveTls [expr {[normalize_result] eq "1" && [auto_execok openssl] ne ""}]
36 set havePython [expr {[auto_execok python3] ne ""}]
37 set haveIpv6 [expr {![catch {close [socket -server list -myaddr ::1 0]}]}]
 
38 set httpPids [list]
39 set httpFossilServers [list]
40 set httpAnswer ""
41
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42 # Clones URL into c.fossil with the options in ARGS, answering fossil's
43 # prompts with the lines in httpAnswer. Returns "cloned" when the clone
44 # is a complete copy of r.fossil. When fossil exits with status 1 and
45 # does not leave c.fossil, returns its output, and otherwise says what
46 # went wrong.
47 #
48 proc http_clone {url args} {
49 file delete c.fossil
50 fossil_raw -seconds 60 -input $::httpAnswer clone $url c.fossil {*}$args
51 set ::RESULT [string trim $::RESULT]
52 if {$::CODE == 0} {
53 fossil sql -R c.fossil "SELECT count(*) FROM blob"
54 if {$::RESULT == $::httpBlobs} {return cloned}
55 return "cloned $::RESULT of $::httpBlobs blobs"
56 }
@@ -97,47 +62,23 @@
62 # Listens on a port on 127.0.0.1 that the system chooses, and returns
63 # the port. Calls HANDLER with each connection and the request on it,
64 # once the whole request has arrived, and then closes the connection.
65 #
66 proc http_listen {handler} {
67 return [test_listen [list http_receive $handler]]
68 }
69
70 proc http_receive {handler chan request} {
71 if {[string first "\r\n\r\n" $request] >= 0} {
72 {*}$handler $chan $request
73 }
74 }
75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76 proc http_listen_close {} {
77 set server [socket -server {apply {{chan address port} {close $chan}}} \
78 -myaddr 127.0.0.1 0]
79 lappend ::testListeners $server
80 return [lindex [fconfigure $server -sockname] 2]
81 }
82
83 # Starts http-relay.py with ARGS and returns the port it listens on. Its
84 # output goes to relay-PORT.log.
@@ -358,11 +299,11 @@
299 puts -nonewline $chan "HTTP/1.1 200 OK\r\nContent-Length: 3\r\n"
300 puts -nonewline $chan "Connection: close\r\n\r\nnew"
301 }
302 }
303 set port [http_listen http_redirect]
304 fossil_raw -seconds 60 test-httpmsg http://127.0.0.1:$port/old --out new.txt
305 test_eq http-rfc-relative-redirect \
306 [expr {[file exists new.txt] ? [read_file new.txt] : ""}] new knownBug
307
308 # xfer lines with more tokens than any card has. The clone must fail
309 # with "unknown command" and not crash.
@@ -629,12 +570,12 @@
570 test_eq http-rfc-https-trailing-dot \
571 [http_clone https://localhost.:$tlsPort/] cloned
572 unset env(SSL_CERT_FILE)
573 }
574
575 test_listen_stop
576 foreach pid $httpPids {catch {exec kill $pid}}
577 foreach server $httpFossilServers {
578 test_stop_server [lindex $server 0] [lindex $server 0] [lindex $server 2]
579 }
580 array set env [array get httpSavedEnv]
581 test_cleanup
582
+71 -89
--- test/json.test
+++ test/json.test
@@ -75,11 +75,14 @@
7575
# the response body.
7676
#
7777
# Returns the status code from the HTTP header.
7878
proc fossil_http_json {url {cookie "Muppet=Monster"} args} {
7979
global RESULT JR
80
- set request "GET $url HTTP/1.1\r\nHost: localhost\r\nUser-Agent: Fossil-http-json\r\nCookie: $cookie"
80
+ set request \
81
+ [join [list \
82
+ "GET $url HTTP/1.1\r\nHost: localhost\r\n" \
83
+ "User-Agent: Fossil-http-json\r\nCookie: $cookie"] ""]
8184
set RESULT [fossil_maybe_answer $request http {*}$args --ipaddr 127.0.0.1]
8285
set head ""; set body ""; set status "--NO_MATCH--"
8386
regexp {(?w)(.*)^\s*$(.*)} $RESULT dummy head body
8487
regexp {^HTTP\S+\s+(\d\d\d)\s+(.*)$} $head dummy status msg
8588
if {$status eq "200"} {
@@ -117,11 +120,10 @@
117120
}]
118121
}
119122
120123
# handle the actual request
121124
flush stdout
122
- #exec $fossilexe
123125
set RESULT [fossil_maybe_answer $request http {*}$args --ipaddr 127.0.0.1]
124126
125127
# separate HTTP headers from body
126128
set head ""; set body ""; set status "--NO_MATCH--"
127129
regexp {(?w)(.*)^\s*$(.*)} $RESULT dummy head body
@@ -190,11 +192,11 @@
190192
191193
# Check for basic envelope fields in the result with an error
192194
fossil_json -expectError
193195
test_json_envelope json-enverr [concat resultCode fossil timestamp \
194196
resultText command procTimeUs procTimeMs] {}
195
-test json-enverr-rc-1 {[dict get $JR resultCode] eq "FOSSIL-3002"}
197
+test_eq json-enverr-rc-1 [dict get $JR resultCode] "FOSSIL-3002"
196198
197199
198200
# Check for basic envelope fields in the result with a successful
199201
# command
200202
set HAIfields [concat manifestUuid manifestVersion manifestDate \
@@ -221,36 +223,37 @@
221223
#### ARTIFACT
222224
223225
# sha1 of 0 bytes and a file to match in a commit
224226
set UUID_empty da39a3ee5e6b4b0d3255bfef95601890afd80709
225227
# sha3 of 0 bytes and a file to match in a commit
226
-set UUID_empty_64 a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a
228
+set UUID_empty_64 \
229
+ a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a
227230
write_file empty ""
228231
fossil add empty
229232
fossil ci -m "empty file"
230233
231234
# json artifact (checkin)
232235
fossil_json [concat artifact tip]
233236
test_json_envelope_ok json-artifact-checkin-env
234
-test json-artifact-checkin {[dict get $JR payload type] eq "checkin"}
237
+test_eq json-artifact-checkin [dict get $JR payload type] "checkin"
235238
test_json_payload json-artifact \
236239
[concat type uuid isLeaf timestamp user comment parents tags files] {}
237240
238241
# json artifact (file)
239242
fossil_json [concat artifact $UUID_empty_64]
240243
test_json_envelope_ok json-artifact-file-env
241
-test json-artifact-file {[dict get $JR payload type] eq "file"}
244
+test_eq json-artifact-file [dict get $JR payload type] "file"
242245
test_json_payload json-artifact [concat type uuid size checkins] {}
243246
244247
# json artifact (wiki)
245248
fossil wiki create Empty <<"-=BLANK=-"
246249
fossil_json wiki get Empty
247
-test json-wiki-get {[dict get $JR payload name] eq "Empty"}
250
+test_eq json-wiki-get [dict get $JR payload name] "Empty"
248251
set uuid [dict get $JR payload uuid]
249252
fossil_json artifact $uuid
250253
test_json_envelope_ok json-artifact-wiki-env
251
-test json-artifact-wiki {[dict get $JR payload type] eq "wiki"}
254
+test_eq json-artifact-wiki [dict get $JR payload type] "wiki"
252255
test_json_payload json-artifact-wiki [list type uuid artifact] {}
253256
set artifact [dict get $JR payload artifact]
254257
test_dict_keys json-artifact-wiki-artifact $artifact \
255258
[list name uuid user timestamp size] {}
256259
# name, uuid, parent?, user, timestamp, size?, content?
@@ -300,12 +303,14 @@
300303
test_json_envelope_ok json-login-u1-env
301304
test_json_payload json-login-u1 {authToken name capabilities loginCookieName} {}
302305
set AuthU1 [dict get $JR payload]
303306
test_hascaps json-login-c "s" [dict get $AuthU1 capabilities]
304307
305
-set U1Cookie [dict get $AuthU1 loginCookieName]=[regsub -all {[/]} [dict get $AuthU1 authToken] {%2F} ]
306
-set AnonCookie [dict get $AuthAnon loginCookieName]=[regsub -all {[/]} [dict get $AuthAnon authToken] {%2F} ]
308
+set U1Cookie [dict get $AuthU1 loginCookieName]=[regsub -all {[/]} \
309
+ [dict get $AuthU1 authToken] {%2F} ]
310
+set AnonCookie [dict get $AuthAnon loginCookieName]=[regsub -all {[/]} \
311
+ [dict get $AuthAnon authToken] {%2F} ]
307312
308313
# json cap
309314
# The CLI user has all rights, and no auth token affects that. This
310315
# is consistent with the rest of the fossil CLI, and with the
311316
# pragmatic argument that using the CLI implies physical access to
@@ -340,11 +345,12 @@
340345
if {[catch {test json-cap-GETcookie-name-0 \
341346
{[dict get $JR payload name] eq "anonymous"}} jerr]} then {
342347
test json-cap-GETcookie-name-0-threw 0
343348
protOut "CAUGHT: $jerr"
344349
}
345
-test json-cap-GETcookie-notsetup-0 {![dict get $JR payload permissionFlags setup]}
350
+test json-cap-GETcookie-notsetup-0 \
351
+ {![dict get $JR payload permissionFlags setup]}
346352
347353
348354
# json cap via GET with authToken in a parameter
349355
fossil_post_json "/json/cap?authToken=[dict get $AuthAnon authToken]" {}
350356
test json-cap-GETcookie-env-1 {[string length $JR] > 0}
@@ -352,31 +358,29 @@
352358
if {[catch {test json-cap-GETcookie-name-1 \
353359
{[dict get $JR payload name] eq "anonymous"}} jerr]} then {
354360
test json-cap-GETcookie-name-1-threw 0
355361
protOut "CAUGHT: $jerr"
356362
}
357
-test json-cap-GETcookie-notsetup-1 {![dict get $JR payload permissionFlags setup]}
363
+test json-cap-GETcookie-notsetup-1 \
364
+ {![dict get $JR payload permissionFlags setup]}
358365
359366
360
-# whoami
361367
# via CLI with no auth token supplied
362368
fossil_json whoami
363369
test_json_envelope_ok json-whoami-cli-env
364370
test_json_payload json-whoami-cli {name capabilities} {}
365
-test json-whoami-cli-name {[dict get $JR payload name] eq "nobody"}
371
+test_eq json-whoami-cli-name [dict get $JR payload name] "nobody"
366372
test_hascaps json-whoami-cli-cap "gjorz" [dict get $JR payload capabilities]
367373
368374
#### BRANCHES
369
-# json branch list
370375
fossil_json branch list
371376
test_json_envelope_ok json-branch-list-env
372377
test_json_payload json-branch-list {range current branches} {}
373
-test json-branch-list-cur {[dict get $JR payload current] eq "trunk"}
378
+test_eq json-branch-list-cur [dict get $JR payload current] "trunk"
374379
test json-branch-list-cnt {[llength [dict get $JR payload branches]] == 1}
375
-test json-branch-list-val {[dict get $JR payload branches] eq "trunk"}
380
+test_eq json-branch-list-val [dict get $JR payload branches] "trunk"
376381
377
-# json branch create
378382
fossil_json branch create alpha --basis trunk
379383
test_json_envelope_ok json-branch-create-env
380384
test_json_payload json-branch-create {name basis rid uuid isPrivate} {}
381385
382386
@@ -412,40 +416,37 @@
412416
413417
test fossil-diff-setup {$fishV1 ne $fishV2}
414418
fossil_json diff $fishV1 $fishV2
415419
test_json_envelope_ok json-diff-env
416420
test_json_payload json-diff {from to diff} {}
417
-test json-diff-v1 {[dict get $JR payload from] eq $fishV1}
418
-test json-diff-v2 {[dict get $JR payload to] eq $fishV2}
421
+test_eq json-diff-v1 [dict get $JR payload from] $fishV1
422
+test_eq json-diff-v2 [dict get $JR payload to] $fishV2
419423
set diff [dict get $JR payload diff]
420424
test json-diff-diff {[string first "+LMNO goldfish" $diff] >= 0}
421425
protOut [dict get $JR payload diff]
422426
423427
424428
#### DIRECTORY LISTING
425
-# json dir DIRNAME
426429
fossil_json dir
427430
test_json_envelope_ok json-dir-env
428431
test_json_payload json-dir {name entries} {}
429432
430433
#### FILE INFO
431
-# json finfo FILENAME
432434
fossil_json finfo empty
433435
test_json_envelope_ok json-finfo-env
434436
test_json_payload json-finfo {name checkins} {}
435437
436438
#### QUERY
437
-# json query SQLCODE
438439
fossil_json query {"SELECT * FROM reportfmt"}
439440
test_json_envelope_ok json-query-env
440441
test_json_payload json-query {columns rows} {}
441442
442443
#### STATS
443
-# json stat
444444
fossil_json stat
445445
test_json_envelope_ok json-stat-env
446
-test_json_payload json-stat {repositorySize ageDays ageYears projectCode compiler sqlite} \
446
+test_json_payload json-stat \
447
+ {repositorySize ageDays ageYears projectCode compiler sqlite} \
447448
{blobCount deltaCount uncompressedArtifactSize averageArtifactSize maxArtifactSize \
448449
compressionRatio checkinCount fileCount wikiPageCount ticketCount}
449450
450451
fossil_json stat -f
451452
test_json_envelope_ok json-stat-full-env
@@ -455,18 +456,17 @@
455456
ageDays ageYears projectCode compiler sqlite} {}
456457
457458
458459
#### STATUS
459460
# NOTE: Local checkout required
460
-# json status
461461
fossil_json status
462462
test_json_envelope_ok json-status-env
463
-test_json_payload json-status {repository localRoot checkout files errorCount} {}
463
+test_json_payload json-status {repository localRoot checkout files errorCount} \
464
+ {}
464465
465466
#### TAGS
466467
467
-# json tag add NAME CHECKIN VALUE
468468
fossil_json tag add blue trunk green
469469
test_json_envelope_ok json-tag-add-env
470470
test_json_payload json-tag-add {name value propagate raw appliedTo} {}
471471
472472
@@ -474,17 +474,15 @@
474474
fossil_json tag add cancel alpha
475475
test_json_envelope_ok json-tag-cancel-env
476476
# DOCBUG? Doc says no payload.
477477
test_json_payload json-tag-cancel {name value propagate raw appliedTo} {}
478478
479
-# json tag find NAME
480479
fossil_json tag find alpha
481480
test_json_envelope_ok json-tag-find-env
482481
test_json_payload json-tag-find {name raw type limit artifacts} {}
483482
test json-tag-find-count {[llength [dict get $JR payload artifacts]] >= 1}
484483
485
-# json tag list CHECKIN
486484
fossil_json tag list
487485
test_json_envelope_ok json-tag-list-env
488486
test_json_payload json-tag-list {raw includeTickets tags} {}
489487
test json-tag-list-count {[llength [dict get $JR payload tags]] >= 2}
490488
@@ -493,56 +491,45 @@
493491
# API Docs say not yet defined, so it isn't quite fair to mark this
494492
# category as TODO for the test cases...
495493
496494
#### TICKET REPORTS
497495
498
-# json report get NUMBER
499496
fossil_json report get 1
500497
test_json_envelope_ok json-report-get-env
501
-test_json_payload json-report-get {report owner title timestamp columns sqlCode} {}
498
+test_json_payload json-report-get \
499
+ {report owner title timestamp columns sqlCode} {}
502500
503
-# json report list
504501
fossil_json report list
505502
test_json_envelope_ok json-report-list-env
506
-#test_json_payload json-report-list {raw includeTickets tags} {}
507503
test json-report-list-count {[llength [dict get $JR payload]] >= 1}
508504
509505
510
-# json report run NUMBER
511506
fossil_json report run 1
512507
test_json_envelope_ok json-report-run-1-env
513508
test_json_payload json-report-run {report title sqlcode columnNames tickets} {}
514509
test json-report-run-cols {[llength [dict get $JR payload columnNames]] >= 7}
515510
test json-report-run-tkts {[llength [dict get $JR payload tickets]] >= 0}
516511
517512
518513
#### TIMELINE
519514
520
-# json timeline checkin
521515
fossil_json timeline checkin
522516
test_json_envelope_ok json-timeline-checkin-env
523517
test_json_payload json-timeline-checkin {limit timeline} {}
524518
set i 0
525519
foreach t [dict get $JR payload timeline] {
526520
# parents appears only for entries that have a parent
527521
# files appears only if requested by the --files parameter
528
- test_dict_keys json-timeline-checkin-$i $t {type uuid timestamp comment user isLeaf tags} {}
522
+ test_dict_keys json-timeline-checkin-$i $t \
523
+ {type uuid timestamp comment user isLeaf tags} {}
529524
incr i
530525
}
531526
532
-# json timeline ci
533
-# removed from documentation
534
-#fossil_json timeline ci
535
-#test json-timeline-ci {[dict get $JR resultCode] ne "FOSSIL-1102"} knownBug
536
-#test_json_payload json-timeline-ci {limit timeline} {}
537
-
538
-# json timeline ticket
539527
fossil_json timeline ticket
540528
test_json_envelope_ok json-timeline-ticket-env
541529
test_json_payload json-timeline-ticket {limit timeline} {}
542530
543
-# json timeline wiki
544531
fossil_json timeline wiki
545532
test_json_envelope_ok json-timeline-wiki-env
546533
test_json_payload json-timeline-wiki {limit timeline} {}
547534
548535
@@ -553,54 +540,46 @@
553540
fossil_json user get $u
554541
test_json_envelope_ok json-user-get-$u-env
555542
test_json_payload json-user-get-$u {uid name capabilities info timestamp} {}
556543
}
557544
558
-# json user list
559545
fossil_json user list
560546
test_json_envelope_ok json-user-list-env
561547
set i 0
562548
foreach u [dict get $JR payload] {
563549
test_dict_keys json-user-list-$i $u {uid name capabilities info timestamp} {}
564550
incr i
565551
}
566552
567
-# json user save
568553
fossil_json user save --uid -1 --name U2 --password Utwo
569554
test_json_envelope_ok json-user-save-env
570555
test_json_payload json-user-save {uid name capabilities info timestamp} {}
571556
572557
573558
# DOCBUG? Doc says payload is "same as /json/user/get" but actual
574559
# result was an array of one user similar to /json/user/list.
575
-#set i 0
576
-#foreach u [dict get $JR payload] {
577
-# test_dict_keys json-user-save-$i $u {uid name capabilities info timestamp} {}
578
-# incr i
579
-#}
580
-#test json-user-save-count {$i == 1}
581560
582561
583562
584563
#### WIKI
585564
586
-# wiki list
587565
fossil_json wiki list
588566
test_json_envelope_ok json-wiki-list-env
589567
set pages [dict get $JR payload]
590568
test json-wiki-1 {[llength $pages] == 1}
591
-test json-wiki-2 {[lindex $pages 0] eq "Empty"}
569
+test_eq json-wiki-2 [lindex $pages 0] "Empty"
592570
fossil_json wiki list --verbose
593571
set pages [dict get $JR payload]
594572
test json-wiki-verbose-1 {[llength $pages] == 1}
595
-test_dict_keys json-wiki-verbose-pages [lindex $pages 0] [list name uuid user timestamp size] {}
573
+test_dict_keys json-wiki-verbose-pages [lindex $pages 0] \
574
+ [list name uuid user timestamp size] {}
596575
597
-# wiki get
598576
fossil_json wiki get Empty
599577
test_json_envelope_ok json-wiki-get-env
600578
# this page has only one version, so no parent should be listed
601
-test_json_payload json-wiki-get [list name uuid user timestamp size content] [list parent]
579
+test_json_payload json-wiki-get [list name uuid user timestamp size content] \
580
+ [list parent]
602581
603582
604583
# wiki create
605584
# requires an authToken? Not from CLI.
606585
@@ -615,11 +594,12 @@
615594
}
616595
fossil_json --json-input req.json
617596
test_json_envelope_ok json-wiki-create-env
618597
fossil_json wiki get Page2
619598
test_json_envelope_ok json-wiki-create-get-env
620
-test_json_payload json-wiki-save-get [list name uuid user timestamp size content] {parent}
599
+test_json_payload json-wiki-save-get \
600
+ [list name uuid user timestamp size content] {parent}
621601
set uuid1 [dict get $JR payload uuid]
622602
623603
# wiki save
624604
625605
write_file req2.json {
@@ -633,24 +613,25 @@
633613
}
634614
fossil_json --json-input req2.json
635615
test_json_envelope_ok json-wiki-save-env
636616
fossil_json wiki get Page2
637617
test_json_envelope_ok json-wiki-save-get-env
638
-test_json_payload json-wiki-save-get [list name uuid user timestamp size parent content] {}
618
+test_json_payload json-wiki-save-get \
619
+ [list name uuid user timestamp size parent content] {}
639620
set uuid2 [dict get $JR payload uuid]
640
-test json-wiki-save-parent {[dict get $JR payload parent] eq $uuid1}
621
+test_eq json-wiki-save-parent [dict get $JR payload parent] $uuid1
641622
642623
# wiki diff
643624
644625
fossil_json wiki diff $uuid1 $uuid2
645626
test_json_envelope_ok json-wiki-diff-env
646627
test_json_payload json-wiki-diff [list v1 v2 diff] {}
647
-test json-wiki-diff-v1 {[dict get $JR payload v1] eq $uuid1}
648
-test json-wiki-diff-v2 {[dict get $JR payload v2] eq $uuid2}
628
+test_eq json-wiki-diff-v1 [dict get $JR payload v1] $uuid1
629
+test_eq json-wiki-diff-v2 [dict get $JR payload v2] $uuid2
649630
set diff [dict get $JR payload diff]
650
-test json-wiki-diff-diff {[string first "+consectetur adipisicing elit" $diff] >= 0}
651
-#puts [dict get $JR payload diff]
631
+test json-wiki-diff-diff {[string first "+consectetur adipisicing elit" $diff]
632
+ >= 0}
652633
653634
# wiki preview
654635
#
655636
# takes a string in fossil wiki markup and return an HTML fragment.
656637
# This command does not make use of the actual wiki content (much?)
@@ -667,31 +648,29 @@
667648
test json-wiki-preview-out-1 {[string first "<p>Lorem ipsum" $pv] == 0}
668649
test json-wiki-preview-out-2 {[string last "<p>" $pv] == 0}
669650
670651
#### UNAVOIDABLE MISC
671652
672
-# json g
673653
fossil_json g
674654
test_json_envelope_ok json-g-env
675
-#puts [llength [dict keys [dict get $JR payload]]]
676655
test json-g-g {[llength [dict keys [dict get $JR payload]]] >= 60};# 64 on my PC
677656
678
-# json rebuild
679657
fossil_json rebuild
680
-test_json_envelope json-rebuild-env [concat fossil timestamp command procTimeUs \
658
+test_json_envelope json-rebuild-env \
659
+ [concat fossil timestamp command procTimeUs \
681660
procTimeMs] [concat payload resultCode resultText]
682661
683
-# json resultCodes
684662
fossil_json resultCodes
685663
test_json_envelope_ok json-resultCodes-env
686664
set codes [dict get $JR payload]
687
-test json-resultCodes-codes-1 {[llength $codes] >= 35} ;# count as of API 20120713
688
-# foreach c $codes {
689
-# puts [dict values $c]
690
-# }
665
+test json-resultCodes-codes-1 \
666
+ {[llength $codes] >= 35} ;# count as of API 20120713
691667
foreach r $codes {
692
- protOut "# [dict get $r resultCode] [dict get $r cSymbol]\n# [dict get $r description]"
668
+ protOut \
669
+ [join [list \
670
+ "# [dict get $r resultCode] [dict get $r cSymbol]\n" \
671
+ "# [dict get $r description]"] ""]
693672
}
694673
695674
696675
697676
#### From the API Docs
@@ -702,12 +681,12 @@
702681
# is not writable" error comes back as HTML. i don't know if the
703682
# error happens before we have made the determination that the app is
704683
# in JSON mode or if the error handling is incorrectly not
705684
# recognizing JSON mode.
706685
#
707
-#test_setup x.fossil
708
-fossil_http_json /json/query?sql=PRAGMA%20repository.journal_mode%3Dwal $U1Cookie
686
+fossil_http_json /json/query?sql=PRAGMA%20repository.journal_mode%3Dwal \
687
+ $U1Cookie
709688
test json-ROrepo-1-1 {$CODE == 0}
710689
test json-ROrepo-1-2 {[regexp {\}\s*$} $RESULT]}
711690
test json-ROrepo-1-3 {![regexp {SQLITE_[A-Z]+:} $RESULT]}
712691
test_json_envelope_ok json-http-timeline1
713692
if {$is_windows} then {
@@ -714,15 +693,15 @@
714693
catch {exec attrib +r .rep.fossil}; # Windows
715694
} else {
716695
catch {exec chmod 444 .rep.fossil}; # Unix
717696
}
718697
protOut "chmod 444 repo"
719
-fossil_http_json /json/query?sql=PRAGMA%20repository.journal_mode%3Ddelete $U1Cookie -expectError --json-preserve-rc
698
+fossil_http_json /json/query?sql=PRAGMA%20repository.journal_mode%3Ddelete \
699
+ $U1Cookie -expectError --json-preserve-rc
720700
test json-ROrepo-2-1 {$CODE != 0}
721701
test json-ROrepo-2-2 {[regexp {\}\s*$} $RESULT]}
722702
test json-ROrepo-2-3 {![regexp {SQLITE_[A-Z]+:} $RESULT]}
723
-#test_json_envelope_ok json-http-timeline2
724703
if {$is_windows} then {
725704
catch {exec attrib -r .rep.fossil}; # Windows
726705
catch {exec attrib -r .rep.fossil-shm}
727706
catch {exec attrib -r .rep.fossil-wal}
728707
} else {
@@ -755,20 +734,21 @@
755734
}
756735
fossil_json --json-input e1101.json -expectError
757736
test json-RC-1101-array-CLI-exit {$CODE != 0}
758737
test_json_envelope json-RC-1101-array-env {fossil timestamp command procTimeUs \
759738
procTimeMs resultCode resultText} {payload}
760
-test json-RC-1101-array-code {[dict get $JR resultCode] eq "FOSSIL-1101"}
739
+test_eq json-RC-1101-array-code [dict get $JR resultCode] "FOSSIL-1101"
761740
762741
write_file e1101.json {
763742
"Not really a command but more of a suggestion"
764743
}
765744
fossil_json --json-input e1101.json -expectError
766745
test json-RC-1101-string-CLI-exit {$CODE != 0}
767
-test_json_envelope json-RC-1101-string-env {fossil timestamp command procTimeUs \
746
+test_json_envelope json-RC-1101-string-env \
747
+ {fossil timestamp command procTimeUs \
768748
procTimeMs resultCode resultText} {payload}
769
-test json-RC-1101-string-code {[dict get $JR resultCode] eq "FOSSIL-1101"}
749
+test_eq json-RC-1101-string-code [dict get $JR resultCode] "FOSSIL-1101"
770750
771751
772752
773753
774754
# FOSSIL-1102 FSL_JSON_E_UNKNOWN_COMMAND
@@ -775,11 +755,11 @@
775755
# Unknown command or subcommand
776756
fossil_json NoSuchEndpoint -expectError
777757
test json-RC-1102-CLI-exit {$CODE != 0}
778758
test_json_envelope json-RC-1102-env {fossil timestamp command procTimeUs \
779759
procTimeMs resultCode resultText} {payload}
780
-test json-RC-1102-code {[dict get $JR resultCode] eq "FOSSIL-1102"}
760
+test_eq json-RC-1102-code [dict get $JR resultCode] "FOSSIL-1102"
781761
782762
write_file e1102.json {
783763
{
784764
"command":"no/such/endpoint"
785765
}
@@ -786,11 +766,11 @@
786766
}
787767
fossil_json --json-input e1102.json -expectError
788768
test json-env-RC-1102a-CLI-exit {$CODE != 0}
789769
test_json_envelope json-env-RC-1102a-env {fossil timestamp command procTimeUs \
790770
procTimeMs resultCode resultText} {payload}
791
-test json-env-RC-1102a-code {[dict get $JR resultCode] eq "FOSSIL-1102"}
771
+test_eq json-env-RC-1102a-code [dict get $JR resultCode] "FOSSIL-1102"
792772
793773
794774
# FOSSIL-1103 FSL_JSON_E_UNKNOWN
795775
# Unknown error
796776
@@ -800,11 +780,12 @@
800780
test json-env-RC-1103-CLI-exit {$CODE != 0}
801781
if { $JR ne "" } {
802782
test_json_envelope json-env-RC-1103-env {fossil timestamp command procTimeUs \
803783
procTimeMs resultCode resultText} {payload}
804784
test json-env-RC-1103-code {[dict exists $JR resultCode]\
805
- && [dict get $JR resultCode] eq "FOSSIL-1103"} knownBug
785
+ && [dict get $JR resultCode] eq "FOSSIL-1103"} \
786
+ knownBug
806787
} else {
807788
protOut "Want test case for FOSSIL-1103"
808789
test json-RC-1103 0 knownBug
809790
}
810791
@@ -855,13 +836,14 @@
855836
"number":42
856837
}
857838
}
858839
fossil_json --json-input e3002.json -expectError
859840
test json-RC-3002-strange-CLI-exit {$CODE != 0}
860
-test_json_envelope json-RC-3002-strange-env {fossil timestamp command procTimeUs \
841
+test_json_envelope json-RC-3002-strange-env \
842
+ {fossil timestamp command procTimeUs \
861843
procTimeMs resultCode resultText} {payload}
862
-test json-RC-3002-strange-code {[dict get $JR resultCode] eq "FOSSIL-3002"}
844
+test_eq json-RC-3002-strange-code [dict get $JR resultCode] "FOSSIL-3002"
863845
864846
865847
# FOSSIL-3003 FSL_JSON_E_AMBIGUOUS_UUID
866848
# Resource identifier is ambiguous
867849
# FOSSIL-3004 FSL_JSON_E_UNRESOLVED_UUID
@@ -889,11 +871,11 @@
889871
fossil close
890872
fossil_json HAI -expectError
891873
test json-RC-4102-CLI-exit {$CODE != 0}
892874
test_json_envelope json-RC-4102-CLI-exit {fossil timestamp command procTimeUs \
893875
procTimeMs resultCode resultText} {payload}
894
-test json-RC-4102 {[dict get $JR resultCode] eq "FOSSIL-4102"}
876
+test_eq json-RC-4102 [dict get $JR resultCode] "FOSSIL-4102"
895877
896878
# FOSSIL-4103 FSL_JSON_E_DB_NOT_VALID
897879
# Fossil repository db file is not valid.
898880
write_file nope.fossil {
899881
This is not a fossil repo. It ought to be a SQLite db with a well-known schema,
@@ -902,11 +884,11 @@
902884
fossil_json HAI -R nope.fossil -expectError
903885
test json-RC-4103-CLI-exit {$CODE != 0}
904886
if { $JR ne "" } {
905887
test_json_envelope json-RC-4103-CLI {fossil timestamp command procTimeUs \
906888
procTimeMs resultCode resultText} {payload}
907
- test json-RC-4103 {[dict get $JR resultCode] eq "FOSSIL-4103"}
889
+ test_eq json-RC-4103 [dict get $JR resultCode] "FOSSIL-4103"
908890
} else {
909891
test json-RC-4103 0 knownBug
910892
}
911893
912894
###############################################################################
913895
--- test/json.test
+++ test/json.test
@@ -75,11 +75,14 @@
75 # the response body.
76 #
77 # Returns the status code from the HTTP header.
78 proc fossil_http_json {url {cookie "Muppet=Monster"} args} {
79 global RESULT JR
80 set request "GET $url HTTP/1.1\r\nHost: localhost\r\nUser-Agent: Fossil-http-json\r\nCookie: $cookie"
 
 
 
81 set RESULT [fossil_maybe_answer $request http {*}$args --ipaddr 127.0.0.1]
82 set head ""; set body ""; set status "--NO_MATCH--"
83 regexp {(?w)(.*)^\s*$(.*)} $RESULT dummy head body
84 regexp {^HTTP\S+\s+(\d\d\d)\s+(.*)$} $head dummy status msg
85 if {$status eq "200"} {
@@ -117,11 +120,10 @@
117 }]
118 }
119
120 # handle the actual request
121 flush stdout
122 #exec $fossilexe
123 set RESULT [fossil_maybe_answer $request http {*}$args --ipaddr 127.0.0.1]
124
125 # separate HTTP headers from body
126 set head ""; set body ""; set status "--NO_MATCH--"
127 regexp {(?w)(.*)^\s*$(.*)} $RESULT dummy head body
@@ -190,11 +192,11 @@
190
191 # Check for basic envelope fields in the result with an error
192 fossil_json -expectError
193 test_json_envelope json-enverr [concat resultCode fossil timestamp \
194 resultText command procTimeUs procTimeMs] {}
195 test json-enverr-rc-1 {[dict get $JR resultCode] eq "FOSSIL-3002"}
196
197
198 # Check for basic envelope fields in the result with a successful
199 # command
200 set HAIfields [concat manifestUuid manifestVersion manifestDate \
@@ -221,36 +223,37 @@
221 #### ARTIFACT
222
223 # sha1 of 0 bytes and a file to match in a commit
224 set UUID_empty da39a3ee5e6b4b0d3255bfef95601890afd80709
225 # sha3 of 0 bytes and a file to match in a commit
226 set UUID_empty_64 a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a
 
227 write_file empty ""
228 fossil add empty
229 fossil ci -m "empty file"
230
231 # json artifact (checkin)
232 fossil_json [concat artifact tip]
233 test_json_envelope_ok json-artifact-checkin-env
234 test json-artifact-checkin {[dict get $JR payload type] eq "checkin"}
235 test_json_payload json-artifact \
236 [concat type uuid isLeaf timestamp user comment parents tags files] {}
237
238 # json artifact (file)
239 fossil_json [concat artifact $UUID_empty_64]
240 test_json_envelope_ok json-artifact-file-env
241 test json-artifact-file {[dict get $JR payload type] eq "file"}
242 test_json_payload json-artifact [concat type uuid size checkins] {}
243
244 # json artifact (wiki)
245 fossil wiki create Empty <<"-=BLANK=-"
246 fossil_json wiki get Empty
247 test json-wiki-get {[dict get $JR payload name] eq "Empty"}
248 set uuid [dict get $JR payload uuid]
249 fossil_json artifact $uuid
250 test_json_envelope_ok json-artifact-wiki-env
251 test json-artifact-wiki {[dict get $JR payload type] eq "wiki"}
252 test_json_payload json-artifact-wiki [list type uuid artifact] {}
253 set artifact [dict get $JR payload artifact]
254 test_dict_keys json-artifact-wiki-artifact $artifact \
255 [list name uuid user timestamp size] {}
256 # name, uuid, parent?, user, timestamp, size?, content?
@@ -300,12 +303,14 @@
300 test_json_envelope_ok json-login-u1-env
301 test_json_payload json-login-u1 {authToken name capabilities loginCookieName} {}
302 set AuthU1 [dict get $JR payload]
303 test_hascaps json-login-c "s" [dict get $AuthU1 capabilities]
304
305 set U1Cookie [dict get $AuthU1 loginCookieName]=[regsub -all {[/]} [dict get $AuthU1 authToken] {%2F} ]
306 set AnonCookie [dict get $AuthAnon loginCookieName]=[regsub -all {[/]} [dict get $AuthAnon authToken] {%2F} ]
 
 
307
308 # json cap
309 # The CLI user has all rights, and no auth token affects that. This
310 # is consistent with the rest of the fossil CLI, and with the
311 # pragmatic argument that using the CLI implies physical access to
@@ -340,11 +345,12 @@
340 if {[catch {test json-cap-GETcookie-name-0 \
341 {[dict get $JR payload name] eq "anonymous"}} jerr]} then {
342 test json-cap-GETcookie-name-0-threw 0
343 protOut "CAUGHT: $jerr"
344 }
345 test json-cap-GETcookie-notsetup-0 {![dict get $JR payload permissionFlags setup]}
 
346
347
348 # json cap via GET with authToken in a parameter
349 fossil_post_json "/json/cap?authToken=[dict get $AuthAnon authToken]" {}
350 test json-cap-GETcookie-env-1 {[string length $JR] > 0}
@@ -352,31 +358,29 @@
352 if {[catch {test json-cap-GETcookie-name-1 \
353 {[dict get $JR payload name] eq "anonymous"}} jerr]} then {
354 test json-cap-GETcookie-name-1-threw 0
355 protOut "CAUGHT: $jerr"
356 }
357 test json-cap-GETcookie-notsetup-1 {![dict get $JR payload permissionFlags setup]}
 
358
359
360 # whoami
361 # via CLI with no auth token supplied
362 fossil_json whoami
363 test_json_envelope_ok json-whoami-cli-env
364 test_json_payload json-whoami-cli {name capabilities} {}
365 test json-whoami-cli-name {[dict get $JR payload name] eq "nobody"}
366 test_hascaps json-whoami-cli-cap "gjorz" [dict get $JR payload capabilities]
367
368 #### BRANCHES
369 # json branch list
370 fossil_json branch list
371 test_json_envelope_ok json-branch-list-env
372 test_json_payload json-branch-list {range current branches} {}
373 test json-branch-list-cur {[dict get $JR payload current] eq "trunk"}
374 test json-branch-list-cnt {[llength [dict get $JR payload branches]] == 1}
375 test json-branch-list-val {[dict get $JR payload branches] eq "trunk"}
376
377 # json branch create
378 fossil_json branch create alpha --basis trunk
379 test_json_envelope_ok json-branch-create-env
380 test_json_payload json-branch-create {name basis rid uuid isPrivate} {}
381
382
@@ -412,40 +416,37 @@
412
413 test fossil-diff-setup {$fishV1 ne $fishV2}
414 fossil_json diff $fishV1 $fishV2
415 test_json_envelope_ok json-diff-env
416 test_json_payload json-diff {from to diff} {}
417 test json-diff-v1 {[dict get $JR payload from] eq $fishV1}
418 test json-diff-v2 {[dict get $JR payload to] eq $fishV2}
419 set diff [dict get $JR payload diff]
420 test json-diff-diff {[string first "+LMNO goldfish" $diff] >= 0}
421 protOut [dict get $JR payload diff]
422
423
424 #### DIRECTORY LISTING
425 # json dir DIRNAME
426 fossil_json dir
427 test_json_envelope_ok json-dir-env
428 test_json_payload json-dir {name entries} {}
429
430 #### FILE INFO
431 # json finfo FILENAME
432 fossil_json finfo empty
433 test_json_envelope_ok json-finfo-env
434 test_json_payload json-finfo {name checkins} {}
435
436 #### QUERY
437 # json query SQLCODE
438 fossil_json query {"SELECT * FROM reportfmt"}
439 test_json_envelope_ok json-query-env
440 test_json_payload json-query {columns rows} {}
441
442 #### STATS
443 # json stat
444 fossil_json stat
445 test_json_envelope_ok json-stat-env
446 test_json_payload json-stat {repositorySize ageDays ageYears projectCode compiler sqlite} \
 
447 {blobCount deltaCount uncompressedArtifactSize averageArtifactSize maxArtifactSize \
448 compressionRatio checkinCount fileCount wikiPageCount ticketCount}
449
450 fossil_json stat -f
451 test_json_envelope_ok json-stat-full-env
@@ -455,18 +456,17 @@
455 ageDays ageYears projectCode compiler sqlite} {}
456
457
458 #### STATUS
459 # NOTE: Local checkout required
460 # json status
461 fossil_json status
462 test_json_envelope_ok json-status-env
463 test_json_payload json-status {repository localRoot checkout files errorCount} {}
 
464
465 #### TAGS
466
467 # json tag add NAME CHECKIN VALUE
468 fossil_json tag add blue trunk green
469 test_json_envelope_ok json-tag-add-env
470 test_json_payload json-tag-add {name value propagate raw appliedTo} {}
471
472
@@ -474,17 +474,15 @@
474 fossil_json tag add cancel alpha
475 test_json_envelope_ok json-tag-cancel-env
476 # DOCBUG? Doc says no payload.
477 test_json_payload json-tag-cancel {name value propagate raw appliedTo} {}
478
479 # json tag find NAME
480 fossil_json tag find alpha
481 test_json_envelope_ok json-tag-find-env
482 test_json_payload json-tag-find {name raw type limit artifacts} {}
483 test json-tag-find-count {[llength [dict get $JR payload artifacts]] >= 1}
484
485 # json tag list CHECKIN
486 fossil_json tag list
487 test_json_envelope_ok json-tag-list-env
488 test_json_payload json-tag-list {raw includeTickets tags} {}
489 test json-tag-list-count {[llength [dict get $JR payload tags]] >= 2}
490
@@ -493,56 +491,45 @@
493 # API Docs say not yet defined, so it isn't quite fair to mark this
494 # category as TODO for the test cases...
495
496 #### TICKET REPORTS
497
498 # json report get NUMBER
499 fossil_json report get 1
500 test_json_envelope_ok json-report-get-env
501 test_json_payload json-report-get {report owner title timestamp columns sqlCode} {}
 
502
503 # json report list
504 fossil_json report list
505 test_json_envelope_ok json-report-list-env
506 #test_json_payload json-report-list {raw includeTickets tags} {}
507 test json-report-list-count {[llength [dict get $JR payload]] >= 1}
508
509
510 # json report run NUMBER
511 fossil_json report run 1
512 test_json_envelope_ok json-report-run-1-env
513 test_json_payload json-report-run {report title sqlcode columnNames tickets} {}
514 test json-report-run-cols {[llength [dict get $JR payload columnNames]] >= 7}
515 test json-report-run-tkts {[llength [dict get $JR payload tickets]] >= 0}
516
517
518 #### TIMELINE
519
520 # json timeline checkin
521 fossil_json timeline checkin
522 test_json_envelope_ok json-timeline-checkin-env
523 test_json_payload json-timeline-checkin {limit timeline} {}
524 set i 0
525 foreach t [dict get $JR payload timeline] {
526 # parents appears only for entries that have a parent
527 # files appears only if requested by the --files parameter
528 test_dict_keys json-timeline-checkin-$i $t {type uuid timestamp comment user isLeaf tags} {}
 
529 incr i
530 }
531
532 # json timeline ci
533 # removed from documentation
534 #fossil_json timeline ci
535 #test json-timeline-ci {[dict get $JR resultCode] ne "FOSSIL-1102"} knownBug
536 #test_json_payload json-timeline-ci {limit timeline} {}
537
538 # json timeline ticket
539 fossil_json timeline ticket
540 test_json_envelope_ok json-timeline-ticket-env
541 test_json_payload json-timeline-ticket {limit timeline} {}
542
543 # json timeline wiki
544 fossil_json timeline wiki
545 test_json_envelope_ok json-timeline-wiki-env
546 test_json_payload json-timeline-wiki {limit timeline} {}
547
548
@@ -553,54 +540,46 @@
553 fossil_json user get $u
554 test_json_envelope_ok json-user-get-$u-env
555 test_json_payload json-user-get-$u {uid name capabilities info timestamp} {}
556 }
557
558 # json user list
559 fossil_json user list
560 test_json_envelope_ok json-user-list-env
561 set i 0
562 foreach u [dict get $JR payload] {
563 test_dict_keys json-user-list-$i $u {uid name capabilities info timestamp} {}
564 incr i
565 }
566
567 # json user save
568 fossil_json user save --uid -1 --name U2 --password Utwo
569 test_json_envelope_ok json-user-save-env
570 test_json_payload json-user-save {uid name capabilities info timestamp} {}
571
572
573 # DOCBUG? Doc says payload is "same as /json/user/get" but actual
574 # result was an array of one user similar to /json/user/list.
575 #set i 0
576 #foreach u [dict get $JR payload] {
577 # test_dict_keys json-user-save-$i $u {uid name capabilities info timestamp} {}
578 # incr i
579 #}
580 #test json-user-save-count {$i == 1}
581
582
583
584 #### WIKI
585
586 # wiki list
587 fossil_json wiki list
588 test_json_envelope_ok json-wiki-list-env
589 set pages [dict get $JR payload]
590 test json-wiki-1 {[llength $pages] == 1}
591 test json-wiki-2 {[lindex $pages 0] eq "Empty"}
592 fossil_json wiki list --verbose
593 set pages [dict get $JR payload]
594 test json-wiki-verbose-1 {[llength $pages] == 1}
595 test_dict_keys json-wiki-verbose-pages [lindex $pages 0] [list name uuid user timestamp size] {}
 
596
597 # wiki get
598 fossil_json wiki get Empty
599 test_json_envelope_ok json-wiki-get-env
600 # this page has only one version, so no parent should be listed
601 test_json_payload json-wiki-get [list name uuid user timestamp size content] [list parent]
 
602
603
604 # wiki create
605 # requires an authToken? Not from CLI.
606
@@ -615,11 +594,12 @@
615 }
616 fossil_json --json-input req.json
617 test_json_envelope_ok json-wiki-create-env
618 fossil_json wiki get Page2
619 test_json_envelope_ok json-wiki-create-get-env
620 test_json_payload json-wiki-save-get [list name uuid user timestamp size content] {parent}
 
621 set uuid1 [dict get $JR payload uuid]
622
623 # wiki save
624
625 write_file req2.json {
@@ -633,24 +613,25 @@
633 }
634 fossil_json --json-input req2.json
635 test_json_envelope_ok json-wiki-save-env
636 fossil_json wiki get Page2
637 test_json_envelope_ok json-wiki-save-get-env
638 test_json_payload json-wiki-save-get [list name uuid user timestamp size parent content] {}
 
639 set uuid2 [dict get $JR payload uuid]
640 test json-wiki-save-parent {[dict get $JR payload parent] eq $uuid1}
641
642 # wiki diff
643
644 fossil_json wiki diff $uuid1 $uuid2
645 test_json_envelope_ok json-wiki-diff-env
646 test_json_payload json-wiki-diff [list v1 v2 diff] {}
647 test json-wiki-diff-v1 {[dict get $JR payload v1] eq $uuid1}
648 test json-wiki-diff-v2 {[dict get $JR payload v2] eq $uuid2}
649 set diff [dict get $JR payload diff]
650 test json-wiki-diff-diff {[string first "+consectetur adipisicing elit" $diff] >= 0}
651 #puts [dict get $JR payload diff]
652
653 # wiki preview
654 #
655 # takes a string in fossil wiki markup and return an HTML fragment.
656 # This command does not make use of the actual wiki content (much?)
@@ -667,31 +648,29 @@
667 test json-wiki-preview-out-1 {[string first "<p>Lorem ipsum" $pv] == 0}
668 test json-wiki-preview-out-2 {[string last "<p>" $pv] == 0}
669
670 #### UNAVOIDABLE MISC
671
672 # json g
673 fossil_json g
674 test_json_envelope_ok json-g-env
675 #puts [llength [dict keys [dict get $JR payload]]]
676 test json-g-g {[llength [dict keys [dict get $JR payload]]] >= 60};# 64 on my PC
677
678 # json rebuild
679 fossil_json rebuild
680 test_json_envelope json-rebuild-env [concat fossil timestamp command procTimeUs \
 
681 procTimeMs] [concat payload resultCode resultText]
682
683 # json resultCodes
684 fossil_json resultCodes
685 test_json_envelope_ok json-resultCodes-env
686 set codes [dict get $JR payload]
687 test json-resultCodes-codes-1 {[llength $codes] >= 35} ;# count as of API 20120713
688 # foreach c $codes {
689 # puts [dict values $c]
690 # }
691 foreach r $codes {
692 protOut "# [dict get $r resultCode] [dict get $r cSymbol]\n# [dict get $r description]"
 
 
 
693 }
694
695
696
697 #### From the API Docs
@@ -702,12 +681,12 @@
702 # is not writable" error comes back as HTML. i don't know if the
703 # error happens before we have made the determination that the app is
704 # in JSON mode or if the error handling is incorrectly not
705 # recognizing JSON mode.
706 #
707 #test_setup x.fossil
708 fossil_http_json /json/query?sql=PRAGMA%20repository.journal_mode%3Dwal $U1Cookie
709 test json-ROrepo-1-1 {$CODE == 0}
710 test json-ROrepo-1-2 {[regexp {\}\s*$} $RESULT]}
711 test json-ROrepo-1-3 {![regexp {SQLITE_[A-Z]+:} $RESULT]}
712 test_json_envelope_ok json-http-timeline1
713 if {$is_windows} then {
@@ -714,15 +693,15 @@
714 catch {exec attrib +r .rep.fossil}; # Windows
715 } else {
716 catch {exec chmod 444 .rep.fossil}; # Unix
717 }
718 protOut "chmod 444 repo"
719 fossil_http_json /json/query?sql=PRAGMA%20repository.journal_mode%3Ddelete $U1Cookie -expectError --json-preserve-rc
 
720 test json-ROrepo-2-1 {$CODE != 0}
721 test json-ROrepo-2-2 {[regexp {\}\s*$} $RESULT]}
722 test json-ROrepo-2-3 {![regexp {SQLITE_[A-Z]+:} $RESULT]}
723 #test_json_envelope_ok json-http-timeline2
724 if {$is_windows} then {
725 catch {exec attrib -r .rep.fossil}; # Windows
726 catch {exec attrib -r .rep.fossil-shm}
727 catch {exec attrib -r .rep.fossil-wal}
728 } else {
@@ -755,20 +734,21 @@
755 }
756 fossil_json --json-input e1101.json -expectError
757 test json-RC-1101-array-CLI-exit {$CODE != 0}
758 test_json_envelope json-RC-1101-array-env {fossil timestamp command procTimeUs \
759 procTimeMs resultCode resultText} {payload}
760 test json-RC-1101-array-code {[dict get $JR resultCode] eq "FOSSIL-1101"}
761
762 write_file e1101.json {
763 "Not really a command but more of a suggestion"
764 }
765 fossil_json --json-input e1101.json -expectError
766 test json-RC-1101-string-CLI-exit {$CODE != 0}
767 test_json_envelope json-RC-1101-string-env {fossil timestamp command procTimeUs \
 
768 procTimeMs resultCode resultText} {payload}
769 test json-RC-1101-string-code {[dict get $JR resultCode] eq "FOSSIL-1101"}
770
771
772
773
774 # FOSSIL-1102 FSL_JSON_E_UNKNOWN_COMMAND
@@ -775,11 +755,11 @@
775 # Unknown command or subcommand
776 fossil_json NoSuchEndpoint -expectError
777 test json-RC-1102-CLI-exit {$CODE != 0}
778 test_json_envelope json-RC-1102-env {fossil timestamp command procTimeUs \
779 procTimeMs resultCode resultText} {payload}
780 test json-RC-1102-code {[dict get $JR resultCode] eq "FOSSIL-1102"}
781
782 write_file e1102.json {
783 {
784 "command":"no/such/endpoint"
785 }
@@ -786,11 +766,11 @@
786 }
787 fossil_json --json-input e1102.json -expectError
788 test json-env-RC-1102a-CLI-exit {$CODE != 0}
789 test_json_envelope json-env-RC-1102a-env {fossil timestamp command procTimeUs \
790 procTimeMs resultCode resultText} {payload}
791 test json-env-RC-1102a-code {[dict get $JR resultCode] eq "FOSSIL-1102"}
792
793
794 # FOSSIL-1103 FSL_JSON_E_UNKNOWN
795 # Unknown error
796
@@ -800,11 +780,12 @@
800 test json-env-RC-1103-CLI-exit {$CODE != 0}
801 if { $JR ne "" } {
802 test_json_envelope json-env-RC-1103-env {fossil timestamp command procTimeUs \
803 procTimeMs resultCode resultText} {payload}
804 test json-env-RC-1103-code {[dict exists $JR resultCode]\
805 && [dict get $JR resultCode] eq "FOSSIL-1103"} knownBug
 
806 } else {
807 protOut "Want test case for FOSSIL-1103"
808 test json-RC-1103 0 knownBug
809 }
810
@@ -855,13 +836,14 @@
855 "number":42
856 }
857 }
858 fossil_json --json-input e3002.json -expectError
859 test json-RC-3002-strange-CLI-exit {$CODE != 0}
860 test_json_envelope json-RC-3002-strange-env {fossil timestamp command procTimeUs \
 
861 procTimeMs resultCode resultText} {payload}
862 test json-RC-3002-strange-code {[dict get $JR resultCode] eq "FOSSIL-3002"}
863
864
865 # FOSSIL-3003 FSL_JSON_E_AMBIGUOUS_UUID
866 # Resource identifier is ambiguous
867 # FOSSIL-3004 FSL_JSON_E_UNRESOLVED_UUID
@@ -889,11 +871,11 @@
889 fossil close
890 fossil_json HAI -expectError
891 test json-RC-4102-CLI-exit {$CODE != 0}
892 test_json_envelope json-RC-4102-CLI-exit {fossil timestamp command procTimeUs \
893 procTimeMs resultCode resultText} {payload}
894 test json-RC-4102 {[dict get $JR resultCode] eq "FOSSIL-4102"}
895
896 # FOSSIL-4103 FSL_JSON_E_DB_NOT_VALID
897 # Fossil repository db file is not valid.
898 write_file nope.fossil {
899 This is not a fossil repo. It ought to be a SQLite db with a well-known schema,
@@ -902,11 +884,11 @@
902 fossil_json HAI -R nope.fossil -expectError
903 test json-RC-4103-CLI-exit {$CODE != 0}
904 if { $JR ne "" } {
905 test_json_envelope json-RC-4103-CLI {fossil timestamp command procTimeUs \
906 procTimeMs resultCode resultText} {payload}
907 test json-RC-4103 {[dict get $JR resultCode] eq "FOSSIL-4103"}
908 } else {
909 test json-RC-4103 0 knownBug
910 }
911
912 ###############################################################################
913
--- test/json.test
+++ test/json.test
@@ -75,11 +75,14 @@
75 # the response body.
76 #
77 # Returns the status code from the HTTP header.
78 proc fossil_http_json {url {cookie "Muppet=Monster"} args} {
79 global RESULT JR
80 set request \
81 [join [list \
82 "GET $url HTTP/1.1\r\nHost: localhost\r\n" \
83 "User-Agent: Fossil-http-json\r\nCookie: $cookie"] ""]
84 set RESULT [fossil_maybe_answer $request http {*}$args --ipaddr 127.0.0.1]
85 set head ""; set body ""; set status "--NO_MATCH--"
86 regexp {(?w)(.*)^\s*$(.*)} $RESULT dummy head body
87 regexp {^HTTP\S+\s+(\d\d\d)\s+(.*)$} $head dummy status msg
88 if {$status eq "200"} {
@@ -117,11 +120,10 @@
120 }]
121 }
122
123 # handle the actual request
124 flush stdout
 
125 set RESULT [fossil_maybe_answer $request http {*}$args --ipaddr 127.0.0.1]
126
127 # separate HTTP headers from body
128 set head ""; set body ""; set status "--NO_MATCH--"
129 regexp {(?w)(.*)^\s*$(.*)} $RESULT dummy head body
@@ -190,11 +192,11 @@
192
193 # Check for basic envelope fields in the result with an error
194 fossil_json -expectError
195 test_json_envelope json-enverr [concat resultCode fossil timestamp \
196 resultText command procTimeUs procTimeMs] {}
197 test_eq json-enverr-rc-1 [dict get $JR resultCode] "FOSSIL-3002"
198
199
200 # Check for basic envelope fields in the result with a successful
201 # command
202 set HAIfields [concat manifestUuid manifestVersion manifestDate \
@@ -221,36 +223,37 @@
223 #### ARTIFACT
224
225 # sha1 of 0 bytes and a file to match in a commit
226 set UUID_empty da39a3ee5e6b4b0d3255bfef95601890afd80709
227 # sha3 of 0 bytes and a file to match in a commit
228 set UUID_empty_64 \
229 a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a
230 write_file empty ""
231 fossil add empty
232 fossil ci -m "empty file"
233
234 # json artifact (checkin)
235 fossil_json [concat artifact tip]
236 test_json_envelope_ok json-artifact-checkin-env
237 test_eq json-artifact-checkin [dict get $JR payload type] "checkin"
238 test_json_payload json-artifact \
239 [concat type uuid isLeaf timestamp user comment parents tags files] {}
240
241 # json artifact (file)
242 fossil_json [concat artifact $UUID_empty_64]
243 test_json_envelope_ok json-artifact-file-env
244 test_eq json-artifact-file [dict get $JR payload type] "file"
245 test_json_payload json-artifact [concat type uuid size checkins] {}
246
247 # json artifact (wiki)
248 fossil wiki create Empty <<"-=BLANK=-"
249 fossil_json wiki get Empty
250 test_eq json-wiki-get [dict get $JR payload name] "Empty"
251 set uuid [dict get $JR payload uuid]
252 fossil_json artifact $uuid
253 test_json_envelope_ok json-artifact-wiki-env
254 test_eq json-artifact-wiki [dict get $JR payload type] "wiki"
255 test_json_payload json-artifact-wiki [list type uuid artifact] {}
256 set artifact [dict get $JR payload artifact]
257 test_dict_keys json-artifact-wiki-artifact $artifact \
258 [list name uuid user timestamp size] {}
259 # name, uuid, parent?, user, timestamp, size?, content?
@@ -300,12 +303,14 @@
303 test_json_envelope_ok json-login-u1-env
304 test_json_payload json-login-u1 {authToken name capabilities loginCookieName} {}
305 set AuthU1 [dict get $JR payload]
306 test_hascaps json-login-c "s" [dict get $AuthU1 capabilities]
307
308 set U1Cookie [dict get $AuthU1 loginCookieName]=[regsub -all {[/]} \
309 [dict get $AuthU1 authToken] {%2F} ]
310 set AnonCookie [dict get $AuthAnon loginCookieName]=[regsub -all {[/]} \
311 [dict get $AuthAnon authToken] {%2F} ]
312
313 # json cap
314 # The CLI user has all rights, and no auth token affects that. This
315 # is consistent with the rest of the fossil CLI, and with the
316 # pragmatic argument that using the CLI implies physical access to
@@ -340,11 +345,12 @@
345 if {[catch {test json-cap-GETcookie-name-0 \
346 {[dict get $JR payload name] eq "anonymous"}} jerr]} then {
347 test json-cap-GETcookie-name-0-threw 0
348 protOut "CAUGHT: $jerr"
349 }
350 test json-cap-GETcookie-notsetup-0 \
351 {![dict get $JR payload permissionFlags setup]}
352
353
354 # json cap via GET with authToken in a parameter
355 fossil_post_json "/json/cap?authToken=[dict get $AuthAnon authToken]" {}
356 test json-cap-GETcookie-env-1 {[string length $JR] > 0}
@@ -352,31 +358,29 @@
358 if {[catch {test json-cap-GETcookie-name-1 \
359 {[dict get $JR payload name] eq "anonymous"}} jerr]} then {
360 test json-cap-GETcookie-name-1-threw 0
361 protOut "CAUGHT: $jerr"
362 }
363 test json-cap-GETcookie-notsetup-1 \
364 {![dict get $JR payload permissionFlags setup]}
365
366
 
367 # via CLI with no auth token supplied
368 fossil_json whoami
369 test_json_envelope_ok json-whoami-cli-env
370 test_json_payload json-whoami-cli {name capabilities} {}
371 test_eq json-whoami-cli-name [dict get $JR payload name] "nobody"
372 test_hascaps json-whoami-cli-cap "gjorz" [dict get $JR payload capabilities]
373
374 #### BRANCHES
 
375 fossil_json branch list
376 test_json_envelope_ok json-branch-list-env
377 test_json_payload json-branch-list {range current branches} {}
378 test_eq json-branch-list-cur [dict get $JR payload current] "trunk"
379 test json-branch-list-cnt {[llength [dict get $JR payload branches]] == 1}
380 test_eq json-branch-list-val [dict get $JR payload branches] "trunk"
381
 
382 fossil_json branch create alpha --basis trunk
383 test_json_envelope_ok json-branch-create-env
384 test_json_payload json-branch-create {name basis rid uuid isPrivate} {}
385
386
@@ -412,40 +416,37 @@
416
417 test fossil-diff-setup {$fishV1 ne $fishV2}
418 fossil_json diff $fishV1 $fishV2
419 test_json_envelope_ok json-diff-env
420 test_json_payload json-diff {from to diff} {}
421 test_eq json-diff-v1 [dict get $JR payload from] $fishV1
422 test_eq json-diff-v2 [dict get $JR payload to] $fishV2
423 set diff [dict get $JR payload diff]
424 test json-diff-diff {[string first "+LMNO goldfish" $diff] >= 0}
425 protOut [dict get $JR payload diff]
426
427
428 #### DIRECTORY LISTING
 
429 fossil_json dir
430 test_json_envelope_ok json-dir-env
431 test_json_payload json-dir {name entries} {}
432
433 #### FILE INFO
 
434 fossil_json finfo empty
435 test_json_envelope_ok json-finfo-env
436 test_json_payload json-finfo {name checkins} {}
437
438 #### QUERY
 
439 fossil_json query {"SELECT * FROM reportfmt"}
440 test_json_envelope_ok json-query-env
441 test_json_payload json-query {columns rows} {}
442
443 #### STATS
 
444 fossil_json stat
445 test_json_envelope_ok json-stat-env
446 test_json_payload json-stat \
447 {repositorySize ageDays ageYears projectCode compiler sqlite} \
448 {blobCount deltaCount uncompressedArtifactSize averageArtifactSize maxArtifactSize \
449 compressionRatio checkinCount fileCount wikiPageCount ticketCount}
450
451 fossil_json stat -f
452 test_json_envelope_ok json-stat-full-env
@@ -455,18 +456,17 @@
456 ageDays ageYears projectCode compiler sqlite} {}
457
458
459 #### STATUS
460 # NOTE: Local checkout required
 
461 fossil_json status
462 test_json_envelope_ok json-status-env
463 test_json_payload json-status {repository localRoot checkout files errorCount} \
464 {}
465
466 #### TAGS
467
 
468 fossil_json tag add blue trunk green
469 test_json_envelope_ok json-tag-add-env
470 test_json_payload json-tag-add {name value propagate raw appliedTo} {}
471
472
@@ -474,17 +474,15 @@
474 fossil_json tag add cancel alpha
475 test_json_envelope_ok json-tag-cancel-env
476 # DOCBUG? Doc says no payload.
477 test_json_payload json-tag-cancel {name value propagate raw appliedTo} {}
478
 
479 fossil_json tag find alpha
480 test_json_envelope_ok json-tag-find-env
481 test_json_payload json-tag-find {name raw type limit artifacts} {}
482 test json-tag-find-count {[llength [dict get $JR payload artifacts]] >= 1}
483
 
484 fossil_json tag list
485 test_json_envelope_ok json-tag-list-env
486 test_json_payload json-tag-list {raw includeTickets tags} {}
487 test json-tag-list-count {[llength [dict get $JR payload tags]] >= 2}
488
@@ -493,56 +491,45 @@
491 # API Docs say not yet defined, so it isn't quite fair to mark this
492 # category as TODO for the test cases...
493
494 #### TICKET REPORTS
495
 
496 fossil_json report get 1
497 test_json_envelope_ok json-report-get-env
498 test_json_payload json-report-get \
499 {report owner title timestamp columns sqlCode} {}
500
 
501 fossil_json report list
502 test_json_envelope_ok json-report-list-env
 
503 test json-report-list-count {[llength [dict get $JR payload]] >= 1}
504
505
 
506 fossil_json report run 1
507 test_json_envelope_ok json-report-run-1-env
508 test_json_payload json-report-run {report title sqlcode columnNames tickets} {}
509 test json-report-run-cols {[llength [dict get $JR payload columnNames]] >= 7}
510 test json-report-run-tkts {[llength [dict get $JR payload tickets]] >= 0}
511
512
513 #### TIMELINE
514
 
515 fossil_json timeline checkin
516 test_json_envelope_ok json-timeline-checkin-env
517 test_json_payload json-timeline-checkin {limit timeline} {}
518 set i 0
519 foreach t [dict get $JR payload timeline] {
520 # parents appears only for entries that have a parent
521 # files appears only if requested by the --files parameter
522 test_dict_keys json-timeline-checkin-$i $t \
523 {type uuid timestamp comment user isLeaf tags} {}
524 incr i
525 }
526
 
 
 
 
 
 
 
527 fossil_json timeline ticket
528 test_json_envelope_ok json-timeline-ticket-env
529 test_json_payload json-timeline-ticket {limit timeline} {}
530
 
531 fossil_json timeline wiki
532 test_json_envelope_ok json-timeline-wiki-env
533 test_json_payload json-timeline-wiki {limit timeline} {}
534
535
@@ -553,54 +540,46 @@
540 fossil_json user get $u
541 test_json_envelope_ok json-user-get-$u-env
542 test_json_payload json-user-get-$u {uid name capabilities info timestamp} {}
543 }
544
 
545 fossil_json user list
546 test_json_envelope_ok json-user-list-env
547 set i 0
548 foreach u [dict get $JR payload] {
549 test_dict_keys json-user-list-$i $u {uid name capabilities info timestamp} {}
550 incr i
551 }
552
 
553 fossil_json user save --uid -1 --name U2 --password Utwo
554 test_json_envelope_ok json-user-save-env
555 test_json_payload json-user-save {uid name capabilities info timestamp} {}
556
557
558 # DOCBUG? Doc says payload is "same as /json/user/get" but actual
559 # result was an array of one user similar to /json/user/list.
 
 
 
 
 
 
560
561
562
563 #### WIKI
564
 
565 fossil_json wiki list
566 test_json_envelope_ok json-wiki-list-env
567 set pages [dict get $JR payload]
568 test json-wiki-1 {[llength $pages] == 1}
569 test_eq json-wiki-2 [lindex $pages 0] "Empty"
570 fossil_json wiki list --verbose
571 set pages [dict get $JR payload]
572 test json-wiki-verbose-1 {[llength $pages] == 1}
573 test_dict_keys json-wiki-verbose-pages [lindex $pages 0] \
574 [list name uuid user timestamp size] {}
575
 
576 fossil_json wiki get Empty
577 test_json_envelope_ok json-wiki-get-env
578 # this page has only one version, so no parent should be listed
579 test_json_payload json-wiki-get [list name uuid user timestamp size content] \
580 [list parent]
581
582
583 # wiki create
584 # requires an authToken? Not from CLI.
585
@@ -615,11 +594,12 @@
594 }
595 fossil_json --json-input req.json
596 test_json_envelope_ok json-wiki-create-env
597 fossil_json wiki get Page2
598 test_json_envelope_ok json-wiki-create-get-env
599 test_json_payload json-wiki-save-get \
600 [list name uuid user timestamp size content] {parent}
601 set uuid1 [dict get $JR payload uuid]
602
603 # wiki save
604
605 write_file req2.json {
@@ -633,24 +613,25 @@
613 }
614 fossil_json --json-input req2.json
615 test_json_envelope_ok json-wiki-save-env
616 fossil_json wiki get Page2
617 test_json_envelope_ok json-wiki-save-get-env
618 test_json_payload json-wiki-save-get \
619 [list name uuid user timestamp size parent content] {}
620 set uuid2 [dict get $JR payload uuid]
621 test_eq json-wiki-save-parent [dict get $JR payload parent] $uuid1
622
623 # wiki diff
624
625 fossil_json wiki diff $uuid1 $uuid2
626 test_json_envelope_ok json-wiki-diff-env
627 test_json_payload json-wiki-diff [list v1 v2 diff] {}
628 test_eq json-wiki-diff-v1 [dict get $JR payload v1] $uuid1
629 test_eq json-wiki-diff-v2 [dict get $JR payload v2] $uuid2
630 set diff [dict get $JR payload diff]
631 test json-wiki-diff-diff {[string first "+consectetur adipisicing elit" $diff]
632 >= 0}
633
634 # wiki preview
635 #
636 # takes a string in fossil wiki markup and return an HTML fragment.
637 # This command does not make use of the actual wiki content (much?)
@@ -667,31 +648,29 @@
648 test json-wiki-preview-out-1 {[string first "<p>Lorem ipsum" $pv] == 0}
649 test json-wiki-preview-out-2 {[string last "<p>" $pv] == 0}
650
651 #### UNAVOIDABLE MISC
652
 
653 fossil_json g
654 test_json_envelope_ok json-g-env
 
655 test json-g-g {[llength [dict keys [dict get $JR payload]]] >= 60};# 64 on my PC
656
 
657 fossil_json rebuild
658 test_json_envelope json-rebuild-env \
659 [concat fossil timestamp command procTimeUs \
660 procTimeMs] [concat payload resultCode resultText]
661
 
662 fossil_json resultCodes
663 test_json_envelope_ok json-resultCodes-env
664 set codes [dict get $JR payload]
665 test json-resultCodes-codes-1 \
666 {[llength $codes] >= 35} ;# count as of API 20120713
 
 
667 foreach r $codes {
668 protOut \
669 [join [list \
670 "# [dict get $r resultCode] [dict get $r cSymbol]\n" \
671 "# [dict get $r description]"] ""]
672 }
673
674
675
676 #### From the API Docs
@@ -702,12 +681,12 @@
681 # is not writable" error comes back as HTML. i don't know if the
682 # error happens before we have made the determination that the app is
683 # in JSON mode or if the error handling is incorrectly not
684 # recognizing JSON mode.
685 #
686 fossil_http_json /json/query?sql=PRAGMA%20repository.journal_mode%3Dwal \
687 $U1Cookie
688 test json-ROrepo-1-1 {$CODE == 0}
689 test json-ROrepo-1-2 {[regexp {\}\s*$} $RESULT]}
690 test json-ROrepo-1-3 {![regexp {SQLITE_[A-Z]+:} $RESULT]}
691 test_json_envelope_ok json-http-timeline1
692 if {$is_windows} then {
@@ -714,15 +693,15 @@
693 catch {exec attrib +r .rep.fossil}; # Windows
694 } else {
695 catch {exec chmod 444 .rep.fossil}; # Unix
696 }
697 protOut "chmod 444 repo"
698 fossil_http_json /json/query?sql=PRAGMA%20repository.journal_mode%3Ddelete \
699 $U1Cookie -expectError --json-preserve-rc
700 test json-ROrepo-2-1 {$CODE != 0}
701 test json-ROrepo-2-2 {[regexp {\}\s*$} $RESULT]}
702 test json-ROrepo-2-3 {![regexp {SQLITE_[A-Z]+:} $RESULT]}
 
703 if {$is_windows} then {
704 catch {exec attrib -r .rep.fossil}; # Windows
705 catch {exec attrib -r .rep.fossil-shm}
706 catch {exec attrib -r .rep.fossil-wal}
707 } else {
@@ -755,20 +734,21 @@
734 }
735 fossil_json --json-input e1101.json -expectError
736 test json-RC-1101-array-CLI-exit {$CODE != 0}
737 test_json_envelope json-RC-1101-array-env {fossil timestamp command procTimeUs \
738 procTimeMs resultCode resultText} {payload}
739 test_eq json-RC-1101-array-code [dict get $JR resultCode] "FOSSIL-1101"
740
741 write_file e1101.json {
742 "Not really a command but more of a suggestion"
743 }
744 fossil_json --json-input e1101.json -expectError
745 test json-RC-1101-string-CLI-exit {$CODE != 0}
746 test_json_envelope json-RC-1101-string-env \
747 {fossil timestamp command procTimeUs \
748 procTimeMs resultCode resultText} {payload}
749 test_eq json-RC-1101-string-code [dict get $JR resultCode] "FOSSIL-1101"
750
751
752
753
754 # FOSSIL-1102 FSL_JSON_E_UNKNOWN_COMMAND
@@ -775,11 +755,11 @@
755 # Unknown command or subcommand
756 fossil_json NoSuchEndpoint -expectError
757 test json-RC-1102-CLI-exit {$CODE != 0}
758 test_json_envelope json-RC-1102-env {fossil timestamp command procTimeUs \
759 procTimeMs resultCode resultText} {payload}
760 test_eq json-RC-1102-code [dict get $JR resultCode] "FOSSIL-1102"
761
762 write_file e1102.json {
763 {
764 "command":"no/such/endpoint"
765 }
@@ -786,11 +766,11 @@
766 }
767 fossil_json --json-input e1102.json -expectError
768 test json-env-RC-1102a-CLI-exit {$CODE != 0}
769 test_json_envelope json-env-RC-1102a-env {fossil timestamp command procTimeUs \
770 procTimeMs resultCode resultText} {payload}
771 test_eq json-env-RC-1102a-code [dict get $JR resultCode] "FOSSIL-1102"
772
773
774 # FOSSIL-1103 FSL_JSON_E_UNKNOWN
775 # Unknown error
776
@@ -800,11 +780,12 @@
780 test json-env-RC-1103-CLI-exit {$CODE != 0}
781 if { $JR ne "" } {
782 test_json_envelope json-env-RC-1103-env {fossil timestamp command procTimeUs \
783 procTimeMs resultCode resultText} {payload}
784 test json-env-RC-1103-code {[dict exists $JR resultCode]\
785 && [dict get $JR resultCode] eq "FOSSIL-1103"} \
786 knownBug
787 } else {
788 protOut "Want test case for FOSSIL-1103"
789 test json-RC-1103 0 knownBug
790 }
791
@@ -855,13 +836,14 @@
836 "number":42
837 }
838 }
839 fossil_json --json-input e3002.json -expectError
840 test json-RC-3002-strange-CLI-exit {$CODE != 0}
841 test_json_envelope json-RC-3002-strange-env \
842 {fossil timestamp command procTimeUs \
843 procTimeMs resultCode resultText} {payload}
844 test_eq json-RC-3002-strange-code [dict get $JR resultCode] "FOSSIL-3002"
845
846
847 # FOSSIL-3003 FSL_JSON_E_AMBIGUOUS_UUID
848 # Resource identifier is ambiguous
849 # FOSSIL-3004 FSL_JSON_E_UNRESOLVED_UUID
@@ -889,11 +871,11 @@
871 fossil close
872 fossil_json HAI -expectError
873 test json-RC-4102-CLI-exit {$CODE != 0}
874 test_json_envelope json-RC-4102-CLI-exit {fossil timestamp command procTimeUs \
875 procTimeMs resultCode resultText} {payload}
876 test_eq json-RC-4102 [dict get $JR resultCode] "FOSSIL-4102"
877
878 # FOSSIL-4103 FSL_JSON_E_DB_NOT_VALID
879 # Fossil repository db file is not valid.
880 write_file nope.fossil {
881 This is not a fossil repo. It ought to be a SQLite db with a well-known schema,
@@ -902,11 +884,11 @@
884 fossil_json HAI -R nope.fossil -expectError
885 test json-RC-4103-CLI-exit {$CODE != 0}
886 if { $JR ne "" } {
887 test_json_envelope json-RC-4103-CLI {fossil timestamp command procTimeUs \
888 procTimeMs resultCode resultText} {payload}
889 test_eq json-RC-4103 [dict get $JR resultCode] "FOSSIL-4103"
890 } else {
891 test json-RC-4103 0 knownBug
892 }
893
894 ###############################################################################
895
+100 -195
--- test/merge1.test
+++ test/merge1.test
@@ -18,65 +18,76 @@
1818
# Tests of the 3-way merge
1919
#
2020
2121
test_setup ""
2222
23
-write_file_indented t1 {
23
+# Merges V1 and V2, two versions of BASE, and tests that the result is
24
+# EXPECTED. ARGS are more arguments for "fossil 3-way-merge".
25
+#
26
+proc merge1_case {name base v1 v2 expected args} {
27
+ write_file_indented t1 $base
28
+ write_file_indented t2 $v1
29
+ write_file_indented t3 $v2
30
+ write_file_indented expected $expected
31
+ fossil 3-way-merge t1 t2 t3 merged {*}$args
32
+ test $name {[same_file expected merged]}
33
+}
34
+
35
+set merge1Base {
2436
111 - This is line one of the demo program - 1111
2537
222 - The second line program line in code - 2222
2638
333 - This is a test of the merging algohm - 3333
2739
444 - If all goes well, we will be pleased - 4444
2840
555 - we think it well and other stuff too - 5555
2941
}
30
-write_file_indented t2 {
31
- 111 - This is line ONE of the demo program - 1111
32
- 222 - The second line program line in code - 2222
33
- 333 - This is a test of the merging algohm - 3333
34
- 444 - If all goes well, we will be pleased - 4444
35
- 555 - we think it well and other stuff too - 5555
36
-}
37
-write_file_indented t3 {
42
+set merge1G1T3 {
3843
111 - This is line one of the demo program - 1111
3944
222 - The second line program line in code - 2222
4045
333 - This is a test OF THE merging algohm - 3333
4146
444 - If all goes well, we will be pleased - 4444
4247
555 - we think it well and other stuff too - 5555
4348
}
44
-write_file_indented t23 {
49
+set merge1G1T2 {
50
+ 111 - This is line ONE of the demo program - 1111
51
+ 222 - The second line program line in code - 2222
52
+ 333 - This is a test of the merging algohm - 3333
53
+ 444 - If all goes well, we will be pleased - 4444
54
+ 555 - we think it well and other stuff too - 5555
55
+}
56
+set merge1G1T23 {
4557
111 - This is line ONE of the demo program - 1111
4658
222 - The second line program line in code - 2222
4759
333 - This is a test OF THE merging algohm - 3333
4860
444 - If all goes well, we will be pleased - 4444
4961
555 - we think it well and other stuff too - 5555
5062
}
51
-fossil 3-way-merge t1 t3 t2 a32
52
-test merge1-1.1 {[same_file t23 a32]}
53
-fossil 3-way-merge t1 t2 t3 a23
54
-test merge1-1.2 {[same_file t23 a23]}
63
+merge1_case merge1-1.1 $merge1Base $merge1G1T3 $merge1G1T2 $merge1G1T23
64
+merge1_case merge1-1.2 $merge1Base $merge1G1T2 $merge1G1T3 $merge1G1T23
5565
56
-write_file_indented t1 {
57
- 111 - This is line one of the demo program - 1111
66
+set merge1G2T3 {
67
+ 111 - This is line one OF the demo program - 1111
5868
222 - The second line program line in code - 2222
5969
333 - This is a test of the merging algohm - 3333
6070
444 - If all goes well, we will be pleased - 4444
6171
555 - we think it well and other stuff too - 5555
6272
}
63
-write_file_indented t2 {
73
+merge1_case merge1-2.1 $merge1Base $merge1G2T3 $merge1G1T2 {
74
+ <<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<< (line 1)
75
+ 111 - This is line one OF the demo program - 1111
76
+ ####### SUGGESTED CONFLICT RESOLUTION follows ###################
77
+ 111 - This is line ONE OF the demo program - 1111
78
+ ||||||| COMMON ANCESTOR content follows ||||||||||||||||||||||||| (line 1)
79
+ 111 - This is line one of the demo program - 1111
80
+ ======= MERGED IN content follows =============================== (line 1)
6481
111 - This is line ONE of the demo program - 1111
82
+ >>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
6583
222 - The second line program line in code - 2222
6684
333 - This is a test of the merging algohm - 3333
6785
444 - If all goes well, we will be pleased - 4444
6886
555 - we think it well and other stuff too - 5555
69
-}
70
-write_file_indented t3 {
71
- 111 - This is line one OF the demo program - 1111
72
- 222 - The second line program line in code - 2222
73
- 333 - This is a test of the merging algohm - 3333
74
- 444 - If all goes well, we will be pleased - 4444
75
- 555 - we think it well and other stuff too - 5555
76
-}
77
-write_file_indented t23 {
87
+} -expectError
88
+merge1_case merge1-2.2 $merge1Base $merge1G1T2 $merge1G2T3 {
7889
<<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<< (line 1)
7990
111 - This is line ONE of the demo program - 1111
8091
####### SUGGESTED CONFLICT RESOLUTION follows ###################
8192
111 - This is line ONE OF the demo program - 1111
8293
||||||| COMMON ANCESTOR content follows ||||||||||||||||||||||||| (line 1)
@@ -86,86 +97,30 @@
8697
>>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
8798
222 - The second line program line in code - 2222
8899
333 - This is a test of the merging algohm - 3333
89100
444 - If all goes well, we will be pleased - 4444
90101
555 - we think it well and other stuff too - 5555
91
-}
92
-write_file_indented t32 {
93
- <<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<< (line 1)
94
- 111 - This is line one OF the demo program - 1111
95
- ####### SUGGESTED CONFLICT RESOLUTION follows ###################
96
- 111 - This is line ONE OF the demo program - 1111
97
- ||||||| COMMON ANCESTOR content follows ||||||||||||||||||||||||| (line 1)
98
- 111 - This is line one of the demo program - 1111
99
- ======= MERGED IN content follows =============================== (line 1)
100
- 111 - This is line ONE of the demo program - 1111
101
- >>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
102
- 222 - The second line program line in code - 2222
103
- 333 - This is a test of the merging algohm - 3333
104
- 444 - If all goes well, we will be pleased - 4444
105
- 555 - we think it well and other stuff too - 5555
106
-}
107
-fossil 3-way-merge t1 t3 t2 a32 -expectError
108
-test merge1-2.1 {[same_file t32 a32]}
109
-fossil 3-way-merge t1 t2 t3 a23 -expectError
110
-test merge1-2.2 {[same_file t23 a23]}
111
-
112
-write_file_indented t1 {
113
- 111 - This is line one of the demo program - 1111
114
- 222 - The second line program line in code - 2222
115
- 333 - This is a test of the merging algohm - 3333
116
- 444 - If all goes well, we will be pleased - 4444
117
- 555 - we think it well and other stuff too - 5555
118
-}
119
-write_file_indented t2 {
120
- 111 - This is line ONE of the demo program - 1111
121
- 222 - The second line program line in code - 2222
122
- 333 - This is a test of the merging algohm - 3333
123
- 444 - If all goes well, we will be pleased - 4444
124
- 555 - we think it well and other stuff too - 5555
125
-}
126
-write_file_indented t3 {
127
- 111 - This is line ONE of the demo program - 1111
128
- 222 - The second line program line in code - 2222
129
- 333 - This is a test of the merging algohm - 3333
130
- 444 - If all goes well, we will be pleased - 4444
131
- 555 - we think it well and other stuff too - 5555
132
-}
133
-write_file_indented t23 {
134
- 111 - This is line ONE of the demo program - 1111
135
- 222 - The second line program line in code - 2222
136
- 333 - This is a test of the merging algohm - 3333
137
- 444 - If all goes well, we will be pleased - 4444
138
- 555 - we think it well and other stuff too - 5555
139
-}
140
-fossil 3-way-merge t1 t3 t2 a32
141
-test merge1-3.1 {[same_file t23 a32]}
142
-fossil 3-way-merge t1 t2 t3 a23
143
-test merge1-3.2 {[same_file t23 a23]}
144
-
145
-write_file_indented t1 {
146
- 111 - This is line one of the demo program - 1111
147
- 222 - The second line program line in code - 2222
148
- 333 - This is a test of the merging algohm - 3333
149
- 444 - If all goes well, we will be pleased - 4444
150
- 555 - we think it well and other stuff too - 5555
151
-}
152
-write_file_indented t2 {
102
+} -expectError
103
+
104
+merge1_case merge1-3.1 $merge1Base $merge1G1T2 $merge1G1T2 $merge1G1T2
105
+merge1_case merge1-3.2 $merge1Base $merge1G1T2 $merge1G1T2 $merge1G1T2
106
+
107
+set merge1G4T3 {
108
+ 222 - The second line program line in code - 2222
109
+ 333 - This is a test of the merging algohm - 3333
110
+ 444 - If all goes well, we will be pleased - 4444
111
+ 555 - we think it well and other stuff too - 5555
112
+}
113
+set merge1G4T2 {
153114
000 - Zero lines added to the beginning of - 0000
154115
111 - This is line one of the demo program - 1111
155116
222 - The second line program line in code - 2222
156117
333 - This is a test of the merging algohm - 3333
157118
444 - If all goes well, we will be pleased - 4444
158119
555 - we think it well and other stuff too - 5555
159120
}
160
-write_file_indented t3 {
161
- 222 - The second line program line in code - 2222
162
- 333 - This is a test of the merging algohm - 3333
163
- 444 - If all goes well, we will be pleased - 4444
164
- 555 - we think it well and other stuff too - 5555
165
-}
166
-write_file_indented t32 {
121
+merge1_case merge1-4.1 $merge1Base $merge1G4T3 $merge1G4T2 {
167122
<<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<< (line 1)
168123
####### SUGGESTED CONFLICT RESOLUTION follows ###################
169124
000 - Zero lines added to the beginning of - 0000
170125
111 - This is line one of the demo program - 1111
171126
||||||| COMMON ANCESTOR content follows ||||||||||||||||||||||||| (line 1)
@@ -176,12 +131,12 @@
176131
>>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
177132
222 - The second line program line in code - 2222
178133
333 - This is a test of the merging algohm - 3333
179134
444 - If all goes well, we will be pleased - 4444
180135
555 - we think it well and other stuff too - 5555
181
-}
182
-write_file_indented t23 {
136
+} -expectError
137
+merge1_case merge1-4.2 $merge1Base $merge1G4T2 $merge1G4T3 {
183138
<<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<< (line 1)
184139
000 - Zero lines added to the beginning of - 0000
185140
111 - This is line one of the demo program - 1111
186141
||||||| COMMON ANCESTOR content follows ||||||||||||||||||||||||| (line 1)
187142
111 - This is line one of the demo program - 1111
@@ -189,79 +144,51 @@
189144
>>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
190145
222 - The second line program line in code - 2222
191146
333 - This is a test of the merging algohm - 3333
192147
444 - If all goes well, we will be pleased - 4444
193148
555 - we think it well and other stuff too - 5555
194
-}
195
-fossil 3-way-merge t1 t3 t2 a32 -expectError
196
-test merge1-4.1 {[same_file t32 a32]}
197
-fossil 3-way-merge t1 t2 t3 a23 -expectError
198
-test merge1-4.2 {[same_file t23 a23]}
149
+} -expectError
199150
200
-write_file_indented t1 {
151
+set merge1G5T2 {
201152
111 - This is line one of the demo program - 1111
202153
222 - The second line program line in code - 2222
203154
333 - This is a test of the merging algohm - 3333
204155
444 - If all goes well, we will be pleased - 4444
205156
555 - we think it well and other stuff too - 5555
157
+ 666 - Extra line at the end of the file wi - 6666
206158
}
207
-write_file_indented t2 {
208
- 111 - This is line one of the demo program - 1111
159
+set merge1G5T32 {
209160
222 - The second line program line in code - 2222
210161
333 - This is a test of the merging algohm - 3333
211162
444 - If all goes well, we will be pleased - 4444
212163
555 - we think it well and other stuff too - 5555
213164
666 - Extra line at the end of the file wi - 6666
214165
}
215
-write_file_indented t3 {
216
- 222 - The second line program line in code - 2222
217
- 333 - This is a test of the merging algohm - 3333
218
- 444 - If all goes well, we will be pleased - 4444
219
- 555 - we think it well and other stuff too - 5555
220
-}
221
-write_file_indented t32 {
222
- 222 - The second line program line in code - 2222
223
- 333 - This is a test of the merging algohm - 3333
224
- 444 - If all goes well, we will be pleased - 4444
225
- 555 - we think it well and other stuff too - 5555
226
- 666 - Extra line at the end of the file wi - 6666
227
-}
228
-fossil 3-way-merge t1 t3 t2 a32
229
-test merge1-5.1 {[same_file t32 a32]}
230
-fossil 3-way-merge t1 t2 t3 a23
231
-test merge1-5.2 {[same_file t32 a23]}
232
-
233
-write_file_indented t1 {
234
- 111 - This is line one of the demo program - 1111
235
- 222 - The second line program line in code - 2222
236
- 333 - This is a test of the merging algohm - 3333
237
- 444 - If all goes well, we will be pleased - 4444
238
- 555 - we think it well and other stuff too - 5555
239
-}
240
-write_file_indented t2 {
241
- 111 - This is line one of the demo program - 1111
242
- 333 - This is a test of the merging algohm - 3333
243
- 444 - If all goes well, we will be pleased - 4444
244
- 555 - we think it well and other stuff too - 5555
245
-}
246
-write_file_indented t3 {
247
- 111 - This is line one of the demo program - 1111
248
- 222 - The second line program line in code - 2222
249
- 333 - This is a test of the merging algohm - 3333
250
- 555 - we think it well and other stuff too - 5555
251
-}
252
-write_file_indented t32 {
253
- 111 - This is line one of the demo program - 1111
254
- 333 - This is a test of the merging algohm - 3333
255
- 555 - we think it well and other stuff too - 5555
256
-}
257
-fossil 3-way-merge t1 t3 t2 a32
258
-test merge1-6.1 {[same_file t32 a32]}
259
-fossil 3-way-merge t1 t2 t3 a23
260
-test merge1-6.2 {[same_file t32 a23]}
261
-
262
-write_file_indented t1 {
166
+merge1_case merge1-5.1 $merge1Base $merge1G4T3 $merge1G5T2 $merge1G5T32
167
+merge1_case merge1-5.2 $merge1Base $merge1G5T2 $merge1G4T3 $merge1G5T32
168
+
169
+set merge1G6T3 {
170
+ 111 - This is line one of the demo program - 1111
171
+ 222 - The second line program line in code - 2222
172
+ 333 - This is a test of the merging algohm - 3333
173
+ 555 - we think it well and other stuff too - 5555
174
+}
175
+set merge1G6T2 {
176
+ 111 - This is line one of the demo program - 1111
177
+ 333 - This is a test of the merging algohm - 3333
178
+ 444 - If all goes well, we will be pleased - 4444
179
+ 555 - we think it well and other stuff too - 5555
180
+}
181
+set merge1G6T32 {
182
+ 111 - This is line one of the demo program - 1111
183
+ 333 - This is a test of the merging algohm - 3333
184
+ 555 - we think it well and other stuff too - 5555
185
+}
186
+merge1_case merge1-6.1 $merge1Base $merge1G6T3 $merge1G6T2 $merge1G6T32
187
+merge1_case merge1-6.2 $merge1Base $merge1G6T2 $merge1G6T3 $merge1G6T32
188
+
189
+set merge1G7T1 {
263190
abcd
264191
efgh
265192
ijkl
266193
mnop
267194
qrst
@@ -272,26 +199,11 @@
272199
KLMN
273200
OPQR
274201
STUV
275202
XYZ.
276203
}
277
-write_file_indented t2 {
278
- abcd
279
- efgh 2
280
- ijkl 2
281
- mnop 2
282
- qrst
283
- uvwx
284
- yzAB 2
285
- CDEF 2
286
- GHIJ 2
287
- KLMN
288
- OPQR
289
- STUV
290
- XYZ.
291
-}
292
-write_file_indented t3 {
204
+set merge1G7T3 {
293205
abcd
294206
efgh
295207
ijkl
296208
mnop 3
297209
qrst 3
@@ -302,11 +214,25 @@
302214
KLMN
303215
OPQR
304216
STUV
305217
XYZ.
306218
}
307
-write_file_indented t23 {
219
+merge1_case merge1-7.1 $merge1G7T1 {
220
+ abcd
221
+ efgh 2
222
+ ijkl 2
223
+ mnop 2
224
+ qrst
225
+ uvwx
226
+ yzAB 2
227
+ CDEF 2
228
+ GHIJ 2
229
+ KLMN
230
+ OPQR
231
+ STUV
232
+ XYZ.
233
+} $merge1G7T3 {
308234
abcd
309235
<<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<< (line 2)
310236
efgh 2
311237
ijkl 2
312238
mnop 2
@@ -345,15 +271,12 @@
345271
>>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
346272
KLMN
347273
OPQR
348274
STUV
349275
XYZ.
350
-}
351
-fossil 3-way-merge t1 t2 t3 a23 -expectError
352
-test merge1-7.1 {[same_file t23 a23]}
353
-
354
-write_file_indented t2 {
276
+} -expectError
277
+merge1_case merge1-7.2 $merge1G7T1 {
355278
abcd
356279
efgh 2
357280
ijkl 2
358281
mnop
359282
qrst
@@ -363,27 +286,11 @@
363286
GHIJ 2
364287
KLMN
365288
OPQR
366289
STUV
367290
XYZ.
368
-}
369
-write_file_indented t3 {
370
- abcd
371
- efgh
372
- ijkl
373
- mnop 3
374
- qrst 3
375
- uvwx 3
376
- yzAB 3
377
- CDEF
378
- GHIJ
379
- KLMN
380
- OPQR
381
- STUV
382
- XYZ.
383
-}
384
-write_file_indented t23 {
291
+} $merge1G7T3 {
385292
abcd
386293
<<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<< (line 2)
387294
efgh 2
388295
ijkl 2
389296
mnop
@@ -422,12 +329,10 @@
422329
>>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
423330
KLMN
424331
OPQR
425332
STUV
426333
XYZ.
427
-}
428
-fossil 3-way-merge t1 t2 t3 a23 -expectError
429
-test merge1-7.2 {[same_file t23 a23]}
334
+} -expectError
430335
431336
###############################################################################
432337
433338
test_cleanup
434339
--- test/merge1.test
+++ test/merge1.test
@@ -18,65 +18,76 @@
18 # Tests of the 3-way merge
19 #
20
21 test_setup ""
22
23 write_file_indented t1 {
 
 
 
 
 
 
 
 
 
 
 
 
24 111 - This is line one of the demo program - 1111
25 222 - The second line program line in code - 2222
26 333 - This is a test of the merging algohm - 3333
27 444 - If all goes well, we will be pleased - 4444
28 555 - we think it well and other stuff too - 5555
29 }
30 write_file_indented t2 {
31 111 - This is line ONE of the demo program - 1111
32 222 - The second line program line in code - 2222
33 333 - This is a test of the merging algohm - 3333
34 444 - If all goes well, we will be pleased - 4444
35 555 - we think it well and other stuff too - 5555
36 }
37 write_file_indented t3 {
38 111 - This is line one of the demo program - 1111
39 222 - The second line program line in code - 2222
40 333 - This is a test OF THE merging algohm - 3333
41 444 - If all goes well, we will be pleased - 4444
42 555 - we think it well and other stuff too - 5555
43 }
44 write_file_indented t23 {
 
 
 
 
 
 
 
45 111 - This is line ONE of the demo program - 1111
46 222 - The second line program line in code - 2222
47 333 - This is a test OF THE merging algohm - 3333
48 444 - If all goes well, we will be pleased - 4444
49 555 - we think it well and other stuff too - 5555
50 }
51 fossil 3-way-merge t1 t3 t2 a32
52 test merge1-1.1 {[same_file t23 a32]}
53 fossil 3-way-merge t1 t2 t3 a23
54 test merge1-1.2 {[same_file t23 a23]}
55
56 write_file_indented t1 {
57 111 - This is line one of the demo program - 1111
58 222 - The second line program line in code - 2222
59 333 - This is a test of the merging algohm - 3333
60 444 - If all goes well, we will be pleased - 4444
61 555 - we think it well and other stuff too - 5555
62 }
63 write_file_indented t2 {
 
 
 
 
 
 
 
64 111 - This is line ONE of the demo program - 1111
 
65 222 - The second line program line in code - 2222
66 333 - This is a test of the merging algohm - 3333
67 444 - If all goes well, we will be pleased - 4444
68 555 - we think it well and other stuff too - 5555
69 }
70 write_file_indented t3 {
71 111 - This is line one OF the demo program - 1111
72 222 - The second line program line in code - 2222
73 333 - This is a test of the merging algohm - 3333
74 444 - If all goes well, we will be pleased - 4444
75 555 - we think it well and other stuff too - 5555
76 }
77 write_file_indented t23 {
78 <<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<< (line 1)
79 111 - This is line ONE of the demo program - 1111
80 ####### SUGGESTED CONFLICT RESOLUTION follows ###################
81 111 - This is line ONE OF the demo program - 1111
82 ||||||| COMMON ANCESTOR content follows ||||||||||||||||||||||||| (line 1)
@@ -86,86 +97,30 @@
86 >>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
87 222 - The second line program line in code - 2222
88 333 - This is a test of the merging algohm - 3333
89 444 - If all goes well, we will be pleased - 4444
90 555 - we think it well and other stuff too - 5555
91 }
92 write_file_indented t32 {
93 <<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<< (line 1)
94 111 - This is line one OF the demo program - 1111
95 ####### SUGGESTED CONFLICT RESOLUTION follows ###################
96 111 - This is line ONE OF the demo program - 1111
97 ||||||| COMMON ANCESTOR content follows ||||||||||||||||||||||||| (line 1)
98 111 - This is line one of the demo program - 1111
99 ======= MERGED IN content follows =============================== (line 1)
100 111 - This is line ONE of the demo program - 1111
101 >>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
102 222 - The second line program line in code - 2222
103 333 - This is a test of the merging algohm - 3333
104 444 - If all goes well, we will be pleased - 4444
105 555 - we think it well and other stuff too - 5555
106 }
107 fossil 3-way-merge t1 t3 t2 a32 -expectError
108 test merge1-2.1 {[same_file t32 a32]}
109 fossil 3-way-merge t1 t2 t3 a23 -expectError
110 test merge1-2.2 {[same_file t23 a23]}
111
112 write_file_indented t1 {
113 111 - This is line one of the demo program - 1111
114 222 - The second line program line in code - 2222
115 333 - This is a test of the merging algohm - 3333
116 444 - If all goes well, we will be pleased - 4444
117 555 - we think it well and other stuff too - 5555
118 }
119 write_file_indented t2 {
120 111 - This is line ONE of the demo program - 1111
121 222 - The second line program line in code - 2222
122 333 - This is a test of the merging algohm - 3333
123 444 - If all goes well, we will be pleased - 4444
124 555 - we think it well and other stuff too - 5555
125 }
126 write_file_indented t3 {
127 111 - This is line ONE of the demo program - 1111
128 222 - The second line program line in code - 2222
129 333 - This is a test of the merging algohm - 3333
130 444 - If all goes well, we will be pleased - 4444
131 555 - we think it well and other stuff too - 5555
132 }
133 write_file_indented t23 {
134 111 - This is line ONE of the demo program - 1111
135 222 - The second line program line in code - 2222
136 333 - This is a test of the merging algohm - 3333
137 444 - If all goes well, we will be pleased - 4444
138 555 - we think it well and other stuff too - 5555
139 }
140 fossil 3-way-merge t1 t3 t2 a32
141 test merge1-3.1 {[same_file t23 a32]}
142 fossil 3-way-merge t1 t2 t3 a23
143 test merge1-3.2 {[same_file t23 a23]}
144
145 write_file_indented t1 {
146 111 - This is line one of the demo program - 1111
147 222 - The second line program line in code - 2222
148 333 - This is a test of the merging algohm - 3333
149 444 - If all goes well, we will be pleased - 4444
150 555 - we think it well and other stuff too - 5555
151 }
152 write_file_indented t2 {
153 000 - Zero lines added to the beginning of - 0000
154 111 - This is line one of the demo program - 1111
155 222 - The second line program line in code - 2222
156 333 - This is a test of the merging algohm - 3333
157 444 - If all goes well, we will be pleased - 4444
158 555 - we think it well and other stuff too - 5555
159 }
160 write_file_indented t3 {
161 222 - The second line program line in code - 2222
162 333 - This is a test of the merging algohm - 3333
163 444 - If all goes well, we will be pleased - 4444
164 555 - we think it well and other stuff too - 5555
165 }
166 write_file_indented t32 {
167 <<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<< (line 1)
168 ####### SUGGESTED CONFLICT RESOLUTION follows ###################
169 000 - Zero lines added to the beginning of - 0000
170 111 - This is line one of the demo program - 1111
171 ||||||| COMMON ANCESTOR content follows ||||||||||||||||||||||||| (line 1)
@@ -176,12 +131,12 @@
176 >>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
177 222 - The second line program line in code - 2222
178 333 - This is a test of the merging algohm - 3333
179 444 - If all goes well, we will be pleased - 4444
180 555 - we think it well and other stuff too - 5555
181 }
182 write_file_indented t23 {
183 <<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<< (line 1)
184 000 - Zero lines added to the beginning of - 0000
185 111 - This is line one of the demo program - 1111
186 ||||||| COMMON ANCESTOR content follows ||||||||||||||||||||||||| (line 1)
187 111 - This is line one of the demo program - 1111
@@ -189,79 +144,51 @@
189 >>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
190 222 - The second line program line in code - 2222
191 333 - This is a test of the merging algohm - 3333
192 444 - If all goes well, we will be pleased - 4444
193 555 - we think it well and other stuff too - 5555
194 }
195 fossil 3-way-merge t1 t3 t2 a32 -expectError
196 test merge1-4.1 {[same_file t32 a32]}
197 fossil 3-way-merge t1 t2 t3 a23 -expectError
198 test merge1-4.2 {[same_file t23 a23]}
199
200 write_file_indented t1 {
201 111 - This is line one of the demo program - 1111
202 222 - The second line program line in code - 2222
203 333 - This is a test of the merging algohm - 3333
204 444 - If all goes well, we will be pleased - 4444
205 555 - we think it well and other stuff too - 5555
 
206 }
207 write_file_indented t2 {
208 111 - This is line one of the demo program - 1111
209 222 - The second line program line in code - 2222
210 333 - This is a test of the merging algohm - 3333
211 444 - If all goes well, we will be pleased - 4444
212 555 - we think it well and other stuff too - 5555
213 666 - Extra line at the end of the file wi - 6666
214 }
215 write_file_indented t3 {
216 222 - The second line program line in code - 2222
217 333 - This is a test of the merging algohm - 3333
218 444 - If all goes well, we will be pleased - 4444
219 555 - we think it well and other stuff too - 5555
220 }
221 write_file_indented t32 {
222 222 - The second line program line in code - 2222
223 333 - This is a test of the merging algohm - 3333
224 444 - If all goes well, we will be pleased - 4444
225 555 - we think it well and other stuff too - 5555
226 666 - Extra line at the end of the file wi - 6666
227 }
228 fossil 3-way-merge t1 t3 t2 a32
229 test merge1-5.1 {[same_file t32 a32]}
230 fossil 3-way-merge t1 t2 t3 a23
231 test merge1-5.2 {[same_file t32 a23]}
232
233 write_file_indented t1 {
234 111 - This is line one of the demo program - 1111
235 222 - The second line program line in code - 2222
236 333 - This is a test of the merging algohm - 3333
237 444 - If all goes well, we will be pleased - 4444
238 555 - we think it well and other stuff too - 5555
239 }
240 write_file_indented t2 {
241 111 - This is line one of the demo program - 1111
242 333 - This is a test of the merging algohm - 3333
243 444 - If all goes well, we will be pleased - 4444
244 555 - we think it well and other stuff too - 5555
245 }
246 write_file_indented t3 {
247 111 - This is line one of the demo program - 1111
248 222 - The second line program line in code - 2222
249 333 - This is a test of the merging algohm - 3333
250 555 - we think it well and other stuff too - 5555
251 }
252 write_file_indented t32 {
253 111 - This is line one of the demo program - 1111
254 333 - This is a test of the merging algohm - 3333
255 555 - we think it well and other stuff too - 5555
256 }
257 fossil 3-way-merge t1 t3 t2 a32
258 test merge1-6.1 {[same_file t32 a32]}
259 fossil 3-way-merge t1 t2 t3 a23
260 test merge1-6.2 {[same_file t32 a23]}
261
262 write_file_indented t1 {
263 abcd
264 efgh
265 ijkl
266 mnop
267 qrst
@@ -272,26 +199,11 @@
272 KLMN
273 OPQR
274 STUV
275 XYZ.
276 }
277 write_file_indented t2 {
278 abcd
279 efgh 2
280 ijkl 2
281 mnop 2
282 qrst
283 uvwx
284 yzAB 2
285 CDEF 2
286 GHIJ 2
287 KLMN
288 OPQR
289 STUV
290 XYZ.
291 }
292 write_file_indented t3 {
293 abcd
294 efgh
295 ijkl
296 mnop 3
297 qrst 3
@@ -302,11 +214,25 @@
302 KLMN
303 OPQR
304 STUV
305 XYZ.
306 }
307 write_file_indented t23 {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
308 abcd
309 <<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<< (line 2)
310 efgh 2
311 ijkl 2
312 mnop 2
@@ -345,15 +271,12 @@
345 >>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
346 KLMN
347 OPQR
348 STUV
349 XYZ.
350 }
351 fossil 3-way-merge t1 t2 t3 a23 -expectError
352 test merge1-7.1 {[same_file t23 a23]}
353
354 write_file_indented t2 {
355 abcd
356 efgh 2
357 ijkl 2
358 mnop
359 qrst
@@ -363,27 +286,11 @@
363 GHIJ 2
364 KLMN
365 OPQR
366 STUV
367 XYZ.
368 }
369 write_file_indented t3 {
370 abcd
371 efgh
372 ijkl
373 mnop 3
374 qrst 3
375 uvwx 3
376 yzAB 3
377 CDEF
378 GHIJ
379 KLMN
380 OPQR
381 STUV
382 XYZ.
383 }
384 write_file_indented t23 {
385 abcd
386 <<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<< (line 2)
387 efgh 2
388 ijkl 2
389 mnop
@@ -422,12 +329,10 @@
422 >>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
423 KLMN
424 OPQR
425 STUV
426 XYZ.
427 }
428 fossil 3-way-merge t1 t2 t3 a23 -expectError
429 test merge1-7.2 {[same_file t23 a23]}
430
431 ###############################################################################
432
433 test_cleanup
434
--- test/merge1.test
+++ test/merge1.test
@@ -18,65 +18,76 @@
18 # Tests of the 3-way merge
19 #
20
21 test_setup ""
22
23 # Merges V1 and V2, two versions of BASE, and tests that the result is
24 # EXPECTED. ARGS are more arguments for "fossil 3-way-merge".
25 #
26 proc merge1_case {name base v1 v2 expected args} {
27 write_file_indented t1 $base
28 write_file_indented t2 $v1
29 write_file_indented t3 $v2
30 write_file_indented expected $expected
31 fossil 3-way-merge t1 t2 t3 merged {*}$args
32 test $name {[same_file expected merged]}
33 }
34
35 set merge1Base {
36 111 - This is line one of the demo program - 1111
37 222 - The second line program line in code - 2222
38 333 - This is a test of the merging algohm - 3333
39 444 - If all goes well, we will be pleased - 4444
40 555 - we think it well and other stuff too - 5555
41 }
42 set merge1G1T3 {
 
 
 
 
 
 
 
43 111 - This is line one of the demo program - 1111
44 222 - The second line program line in code - 2222
45 333 - This is a test OF THE merging algohm - 3333
46 444 - If all goes well, we will be pleased - 4444
47 555 - we think it well and other stuff too - 5555
48 }
49 set merge1G1T2 {
50 111 - This is line ONE of the demo program - 1111
51 222 - The second line program line in code - 2222
52 333 - This is a test of the merging algohm - 3333
53 444 - If all goes well, we will be pleased - 4444
54 555 - we think it well and other stuff too - 5555
55 }
56 set merge1G1T23 {
57 111 - This is line ONE of the demo program - 1111
58 222 - The second line program line in code - 2222
59 333 - This is a test OF THE merging algohm - 3333
60 444 - If all goes well, we will be pleased - 4444
61 555 - we think it well and other stuff too - 5555
62 }
63 merge1_case merge1-1.1 $merge1Base $merge1G1T3 $merge1G1T2 $merge1G1T23
64 merge1_case merge1-1.2 $merge1Base $merge1G1T2 $merge1G1T3 $merge1G1T23
 
 
65
66 set merge1G2T3 {
67 111 - This is line one OF the demo program - 1111
68 222 - The second line program line in code - 2222
69 333 - This is a test of the merging algohm - 3333
70 444 - If all goes well, we will be pleased - 4444
71 555 - we think it well and other stuff too - 5555
72 }
73 merge1_case merge1-2.1 $merge1Base $merge1G2T3 $merge1G1T2 {
74 <<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<< (line 1)
75 111 - This is line one OF the demo program - 1111
76 ####### SUGGESTED CONFLICT RESOLUTION follows ###################
77 111 - This is line ONE OF the demo program - 1111
78 ||||||| COMMON ANCESTOR content follows ||||||||||||||||||||||||| (line 1)
79 111 - This is line one of the demo program - 1111
80 ======= MERGED IN content follows =============================== (line 1)
81 111 - This is line ONE of the demo program - 1111
82 >>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
83 222 - The second line program line in code - 2222
84 333 - This is a test of the merging algohm - 3333
85 444 - If all goes well, we will be pleased - 4444
86 555 - we think it well and other stuff too - 5555
87 } -expectError
88 merge1_case merge1-2.2 $merge1Base $merge1G1T2 $merge1G2T3 {
 
 
 
 
 
 
 
89 <<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<< (line 1)
90 111 - This is line ONE of the demo program - 1111
91 ####### SUGGESTED CONFLICT RESOLUTION follows ###################
92 111 - This is line ONE OF the demo program - 1111
93 ||||||| COMMON ANCESTOR content follows ||||||||||||||||||||||||| (line 1)
@@ -86,86 +97,30 @@
97 >>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
98 222 - The second line program line in code - 2222
99 333 - This is a test of the merging algohm - 3333
100 444 - If all goes well, we will be pleased - 4444
101 555 - we think it well and other stuff too - 5555
102 } -expectError
103
104 merge1_case merge1-3.1 $merge1Base $merge1G1T2 $merge1G1T2 $merge1G1T2
105 merge1_case merge1-3.2 $merge1Base $merge1G1T2 $merge1G1T2 $merge1G1T2
106
107 set merge1G4T3 {
108 222 - The second line program line in code - 2222
109 333 - This is a test of the merging algohm - 3333
110 444 - If all goes well, we will be pleased - 4444
111 555 - we think it well and other stuff too - 5555
112 }
113 set merge1G4T2 {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114 000 - Zero lines added to the beginning of - 0000
115 111 - This is line one of the demo program - 1111
116 222 - The second line program line in code - 2222
117 333 - This is a test of the merging algohm - 3333
118 444 - If all goes well, we will be pleased - 4444
119 555 - we think it well and other stuff too - 5555
120 }
121 merge1_case merge1-4.1 $merge1Base $merge1G4T3 $merge1G4T2 {
 
 
 
 
 
 
122 <<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<< (line 1)
123 ####### SUGGESTED CONFLICT RESOLUTION follows ###################
124 000 - Zero lines added to the beginning of - 0000
125 111 - This is line one of the demo program - 1111
126 ||||||| COMMON ANCESTOR content follows ||||||||||||||||||||||||| (line 1)
@@ -176,12 +131,12 @@
131 >>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
132 222 - The second line program line in code - 2222
133 333 - This is a test of the merging algohm - 3333
134 444 - If all goes well, we will be pleased - 4444
135 555 - we think it well and other stuff too - 5555
136 } -expectError
137 merge1_case merge1-4.2 $merge1Base $merge1G4T2 $merge1G4T3 {
138 <<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<< (line 1)
139 000 - Zero lines added to the beginning of - 0000
140 111 - This is line one of the demo program - 1111
141 ||||||| COMMON ANCESTOR content follows ||||||||||||||||||||||||| (line 1)
142 111 - This is line one of the demo program - 1111
@@ -189,79 +144,51 @@
144 >>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
145 222 - The second line program line in code - 2222
146 333 - This is a test of the merging algohm - 3333
147 444 - If all goes well, we will be pleased - 4444
148 555 - we think it well and other stuff too - 5555
149 } -expectError
 
 
 
 
150
151 set merge1G5T2 {
152 111 - This is line one of the demo program - 1111
153 222 - The second line program line in code - 2222
154 333 - This is a test of the merging algohm - 3333
155 444 - If all goes well, we will be pleased - 4444
156 555 - we think it well and other stuff too - 5555
157 666 - Extra line at the end of the file wi - 6666
158 }
159 set merge1G5T32 {
 
160 222 - The second line program line in code - 2222
161 333 - This is a test of the merging algohm - 3333
162 444 - If all goes well, we will be pleased - 4444
163 555 - we think it well and other stuff too - 5555
164 666 - Extra line at the end of the file wi - 6666
165 }
166 merge1_case merge1-5.1 $merge1Base $merge1G4T3 $merge1G5T2 $merge1G5T32
167 merge1_case merge1-5.2 $merge1Base $merge1G5T2 $merge1G4T3 $merge1G5T32
168
169 set merge1G6T3 {
170 111 - This is line one of the demo program - 1111
171 222 - The second line program line in code - 2222
172 333 - This is a test of the merging algohm - 3333
173 555 - we think it well and other stuff too - 5555
174 }
175 set merge1G6T2 {
176 111 - This is line one of the demo program - 1111
177 333 - This is a test of the merging algohm - 3333
178 444 - If all goes well, we will be pleased - 4444
179 555 - we think it well and other stuff too - 5555
180 }
181 set merge1G6T32 {
182 111 - This is line one of the demo program - 1111
183 333 - This is a test of the merging algohm - 3333
184 555 - we think it well and other stuff too - 5555
185 }
186 merge1_case merge1-6.1 $merge1Base $merge1G6T3 $merge1G6T2 $merge1G6T32
187 merge1_case merge1-6.2 $merge1Base $merge1G6T2 $merge1G6T3 $merge1G6T32
188
189 set merge1G7T1 {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
190 abcd
191 efgh
192 ijkl
193 mnop
194 qrst
@@ -272,26 +199,11 @@
199 KLMN
200 OPQR
201 STUV
202 XYZ.
203 }
204 set merge1G7T3 {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
205 abcd
206 efgh
207 ijkl
208 mnop 3
209 qrst 3
@@ -302,11 +214,25 @@
214 KLMN
215 OPQR
216 STUV
217 XYZ.
218 }
219 merge1_case merge1-7.1 $merge1G7T1 {
220 abcd
221 efgh 2
222 ijkl 2
223 mnop 2
224 qrst
225 uvwx
226 yzAB 2
227 CDEF 2
228 GHIJ 2
229 KLMN
230 OPQR
231 STUV
232 XYZ.
233 } $merge1G7T3 {
234 abcd
235 <<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<< (line 2)
236 efgh 2
237 ijkl 2
238 mnop 2
@@ -345,15 +271,12 @@
271 >>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
272 KLMN
273 OPQR
274 STUV
275 XYZ.
276 } -expectError
277 merge1_case merge1-7.2 $merge1G7T1 {
 
 
 
278 abcd
279 efgh 2
280 ijkl 2
281 mnop
282 qrst
@@ -363,27 +286,11 @@
286 GHIJ 2
287 KLMN
288 OPQR
289 STUV
290 XYZ.
291 } $merge1G7T3 {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
292 abcd
293 <<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<< (line 2)
294 efgh 2
295 ijkl 2
296 mnop
@@ -422,12 +329,10 @@
329 >>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
330 KLMN
331 OPQR
332 STUV
333 XYZ.
334 } -expectError
 
 
335
336 ###############################################################################
337
338 test_cleanup
339
--- test/merge5.test
+++ test/merge5.test
@@ -44,11 +44,12 @@
4444
4545
require_no_open_checkout; test_setup ""
4646
4747
# Construct a test repository
4848
#
49
-exec $::fossilexe sqlite3 --no-repository m5.fossil <$testfiledir/${testfile}_repo.sql
49
+exec $::fossilexe sqlite3 --no-repository m5.fossil \
50
+ <$testfiledir/${testfile}_repo.sql
5051
fossil rebuild m5.fossil
5152
fossil open m5.fossil
5253
fossil user default drh --user drh
5354
fossil update baseline
5455
checkout-test 10 {
@@ -136,11 +137,11 @@
136137
64a8a5c7320fccfa4b2e5dfc5fd20a5381a86c5b three.txt
137138
b262fee89ed8a27a23a5e09d3917e0bebe22cd24 two.txt
138139
}
139140
140141
# Merge br2 into the trunk. br2 contains some independent change to the
141
-# two.txt file. Verify that these are merge in correctly.
142
+# two.txt file. Verify that these are merged in correctly.
142143
#
143144
fossil update m1
144145
fossil merge br2
145146
checkout-test 80 {
146147
8f09bc55a60eb8ca06f10a3b577aafa869b31695 five.txt
@@ -285,11 +286,11 @@
285286
98e47f99bb9fed4fdcd407f553615ca7f15a38a2 three.txt
286287
e58c5da3e6007d0e30600ea31611813093ad180f two-rename.txt
287288
}
288289
289290
# Merge the chng3 check-in into br5, verifying that the change to two.txt
290
-# from chng3 are applies to two-rename.txt in br5.
291
+# from chng3 are applied to two-rename.txt in br5.
291292
#
292293
fossil update br5
293294
checkout-test 140 {
294295
e866bb885d5184cba497cfb6a4eb281688519521 one.txt
295296
e09593950837f76e70ca2f8ff2272ae3df0ba017 three.txt
296297
--- test/merge5.test
+++ test/merge5.test
@@ -44,11 +44,12 @@
44
45 require_no_open_checkout; test_setup ""
46
47 # Construct a test repository
48 #
49 exec $::fossilexe sqlite3 --no-repository m5.fossil <$testfiledir/${testfile}_repo.sql
 
50 fossil rebuild m5.fossil
51 fossil open m5.fossil
52 fossil user default drh --user drh
53 fossil update baseline
54 checkout-test 10 {
@@ -136,11 +137,11 @@
136 64a8a5c7320fccfa4b2e5dfc5fd20a5381a86c5b three.txt
137 b262fee89ed8a27a23a5e09d3917e0bebe22cd24 two.txt
138 }
139
140 # Merge br2 into the trunk. br2 contains some independent change to the
141 # two.txt file. Verify that these are merge in correctly.
142 #
143 fossil update m1
144 fossil merge br2
145 checkout-test 80 {
146 8f09bc55a60eb8ca06f10a3b577aafa869b31695 five.txt
@@ -285,11 +286,11 @@
285 98e47f99bb9fed4fdcd407f553615ca7f15a38a2 three.txt
286 e58c5da3e6007d0e30600ea31611813093ad180f two-rename.txt
287 }
288
289 # Merge the chng3 check-in into br5, verifying that the change to two.txt
290 # from chng3 are applies to two-rename.txt in br5.
291 #
292 fossil update br5
293 checkout-test 140 {
294 e866bb885d5184cba497cfb6a4eb281688519521 one.txt
295 e09593950837f76e70ca2f8ff2272ae3df0ba017 three.txt
296
--- test/merge5.test
+++ test/merge5.test
@@ -44,11 +44,12 @@
44
45 require_no_open_checkout; test_setup ""
46
47 # Construct a test repository
48 #
49 exec $::fossilexe sqlite3 --no-repository m5.fossil \
50 <$testfiledir/${testfile}_repo.sql
51 fossil rebuild m5.fossil
52 fossil open m5.fossil
53 fossil user default drh --user drh
54 fossil update baseline
55 checkout-test 10 {
@@ -136,11 +137,11 @@
137 64a8a5c7320fccfa4b2e5dfc5fd20a5381a86c5b three.txt
138 b262fee89ed8a27a23a5e09d3917e0bebe22cd24 two.txt
139 }
140
141 # Merge br2 into the trunk. br2 contains some independent change to the
142 # two.txt file. Verify that these are merged in correctly.
143 #
144 fossil update m1
145 fossil merge br2
146 checkout-test 80 {
147 8f09bc55a60eb8ca06f10a3b577aafa869b31695 five.txt
@@ -285,11 +286,11 @@
286 98e47f99bb9fed4fdcd407f553615ca7f15a38a2 three.txt
287 e58c5da3e6007d0e30600ea31611813093ad180f two-rename.txt
288 }
289
290 # Merge the chng3 check-in into br5, verifying that the change to two.txt
291 # from chng3 are applied to two-rename.txt in br5.
292 #
293 fossil update br5
294 checkout-test 140 {
295 e866bb885d5184cba497cfb6a4eb281688519521 one.txt
296 e09593950837f76e70ca2f8ff2272ae3df0ba017 three.txt
297
+11 -8
--- test/merge6.test
+++ test/merge6.test
@@ -23,45 +23,48 @@
2323
####################################################################
2424
2525
test_setup
2626
fossil ls
2727
28
-test merge_multi-0 {[normalize_result] eq {}}
28
+test_eq merge_multi-0 [normalize_result] {}
2929
3030
commit_file f1 "f1 line" "base file"
3131
fossil ls
3232
33
-test merge_multi-1 {[normalize_result] eq {f1}}
33
+test_eq merge_multi-1 [normalize_result] {f1}
3434
3535
fossil update trunk
3636
commit_file f2 "f2 line" "branch for file f2" -b branch_for_f2
3737
fossil ls
3838
39
-test merge_multi-2 {[normalize_result] eq {f1
40
-f2}}
39
+test_eq merge_multi-2 [normalize_result] \
40
+ {f1
41
+f2}
4142
4243
fossil update trunk
4344
write_file f3 "f3 line"
4445
write_file f4 "f4 line"
4546
fossil add f3
4647
fossil add f4
4748
fossil commit -m "branch for files f3 and f4" -b branch_for_f3_f4
4849
fossil ls
4950
50
-test merge_multi-3 {[normalize_result] eq {f1
51
+test_eq merge_multi-3 [normalize_result] \
52
+ {f1
5153
f3
52
-f4}}
54
+f4}
5355
5456
fossil update trunk
5557
fossil merge branch_for_f2
5658
fossil merge branch_for_f3_f4
5759
fossil commit -m "new trunk files f2, f3, and f4 via merge"
5860
fossil ls
5961
60
-test merge_multi-4 {[normalize_result] eq {f1
62
+test_eq merge_multi-4 [normalize_result] \
63
+ {f1
6164
f2
6265
f3
63
-f4}}
66
+f4}
6467
6568
###############################################################################
6669
6770
test_cleanup
6871
--- test/merge6.test
+++ test/merge6.test
@@ -23,45 +23,48 @@
23 ####################################################################
24
25 test_setup
26 fossil ls
27
28 test merge_multi-0 {[normalize_result] eq {}}
29
30 commit_file f1 "f1 line" "base file"
31 fossil ls
32
33 test merge_multi-1 {[normalize_result] eq {f1}}
34
35 fossil update trunk
36 commit_file f2 "f2 line" "branch for file f2" -b branch_for_f2
37 fossil ls
38
39 test merge_multi-2 {[normalize_result] eq {f1
40 f2}}
 
41
42 fossil update trunk
43 write_file f3 "f3 line"
44 write_file f4 "f4 line"
45 fossil add f3
46 fossil add f4
47 fossil commit -m "branch for files f3 and f4" -b branch_for_f3_f4
48 fossil ls
49
50 test merge_multi-3 {[normalize_result] eq {f1
 
51 f3
52 f4}}
53
54 fossil update trunk
55 fossil merge branch_for_f2
56 fossil merge branch_for_f3_f4
57 fossil commit -m "new trunk files f2, f3, and f4 via merge"
58 fossil ls
59
60 test merge_multi-4 {[normalize_result] eq {f1
 
61 f2
62 f3
63 f4}}
64
65 ###############################################################################
66
67 test_cleanup
68
--- test/merge6.test
+++ test/merge6.test
@@ -23,45 +23,48 @@
23 ####################################################################
24
25 test_setup
26 fossil ls
27
28 test_eq merge_multi-0 [normalize_result] {}
29
30 commit_file f1 "f1 line" "base file"
31 fossil ls
32
33 test_eq merge_multi-1 [normalize_result] {f1}
34
35 fossil update trunk
36 commit_file f2 "f2 line" "branch for file f2" -b branch_for_f2
37 fossil ls
38
39 test_eq merge_multi-2 [normalize_result] \
40 {f1
41 f2}
42
43 fossil update trunk
44 write_file f3 "f3 line"
45 write_file f4 "f4 line"
46 fossil add f3
47 fossil add f4
48 fossil commit -m "branch for files f3 and f4" -b branch_for_f3_f4
49 fossil ls
50
51 test_eq merge_multi-3 [normalize_result] \
52 {f1
53 f3
54 f4}
55
56 fossil update trunk
57 fossil merge branch_for_f2
58 fossil merge branch_for_f3_f4
59 fossil commit -m "new trunk files f2, f3, and f4 via merge"
60 fossil ls
61
62 test_eq merge_multi-4 [normalize_result] \
63 {f1
64 f2
65 f3
66 f4}
67
68 ###############################################################################
69
70 test_cleanup
71
--- test/merge_renames.test
+++ test/merge_renames.test
@@ -148,13 +148,14 @@
148148
149149
fossil commit -m "trunk merged, should have 3 files"
150150
151151
fossil ls
152152
153
-test merge_renames-5-2 {[normalize_result] eq {f1
153
+test_eq merge_renames-5-2 [normalize_result] \
154
+ {f1
154155
f2
155
-f3}}
156
+f3}
156157
157158
#####################################
158159
# Test 6 #
159160
# Merging a branch multiple times #
160161
#####################################
@@ -303,11 +304,11 @@
303304
fossil merge -n b -expectError
304305
test_status_list merge_renames-9-6 $RESULT "
305306
$expectedMerge
306307
REMINDER: this was a dry run - no files were actually changed.
307308
"
308
-test merge_renames-9-7 {[fossil changes] eq ""}
309
+test_eq merge_renames-9-7 [fossil changes] ""
309310
310311
###################################################################
311312
# Test 10 #
312313
# Merge swapped filenames, backout the swap, then merge changes #
313314
###################################################################
314315
--- test/merge_renames.test
+++ test/merge_renames.test
@@ -148,13 +148,14 @@
148
149 fossil commit -m "trunk merged, should have 3 files"
150
151 fossil ls
152
153 test merge_renames-5-2 {[normalize_result] eq {f1
 
154 f2
155 f3}}
156
157 #####################################
158 # Test 6 #
159 # Merging a branch multiple times #
160 #####################################
@@ -303,11 +304,11 @@
303 fossil merge -n b -expectError
304 test_status_list merge_renames-9-6 $RESULT "
305 $expectedMerge
306 REMINDER: this was a dry run - no files were actually changed.
307 "
308 test merge_renames-9-7 {[fossil changes] eq ""}
309
310 ###################################################################
311 # Test 10 #
312 # Merge swapped filenames, backout the swap, then merge changes #
313 ###################################################################
314
--- test/merge_renames.test
+++ test/merge_renames.test
@@ -148,13 +148,14 @@
148
149 fossil commit -m "trunk merged, should have 3 files"
150
151 fossil ls
152
153 test_eq merge_renames-5-2 [normalize_result] \
154 {f1
155 f2
156 f3}
157
158 #####################################
159 # Test 6 #
160 # Merging a branch multiple times #
161 #####################################
@@ -303,11 +304,11 @@
304 fossil merge -n b -expectError
305 test_status_list merge_renames-9-6 $RESULT "
306 $expectedMerge
307 REMINDER: this was a dry run - no files were actually changed.
308 "
309 test_eq merge_renames-9-7 [fossil changes] ""
310
311 ###################################################################
312 # Test 10 #
313 # Merge swapped filenames, backout the swap, then merge changes #
314 ###################################################################
315
+68 -91
--- test/mv-rm.test
+++ test/mv-rm.test
@@ -68,13 +68,12 @@
6868
6969
fossil mv ../f1 .
7070
test mv-soft-relative-1 {$RESULT eq "RENAME f1 subdir1/f1"}
7171
7272
fossil revert
73
-test mv-soft-relative-2 {
74
- [normalize_result] eq "DELETE subdir1/f1\nREVERT f1${undoMsg}"
75
-}
73
+test_eq mv-soft-relative-2 [normalize_result] \
74
+ "DELETE subdir1/f1\nREVERT f1${undoMsg}"
7675
7776
cd $rootDir
7877
7978
###################################
8079
# Test 2: Soft Move Relative File #
@@ -85,13 +84,12 @@
8584
8685
fossil mv ../f2 ./f2
8786
test mv-soft-relative-3 {$RESULT eq "RENAME f2 subdir2/f2"}
8887
8988
fossil revert
90
-test mv-soft-relative-4 {
91
- [normalize_result] eq "DELETE subdir2/f2\nREVERT f2${undoMsg}"
92
-}
89
+test_eq mv-soft-relative-4 [normalize_result] \
90
+ "DELETE subdir2/f2\nREVERT f2${undoMsg}"
9391
9492
cd $rootDir
9593
9694
########################################
9795
# Test 3: Hard Move Relative Directory #
@@ -99,18 +97,16 @@
9997
10098
file mkdir [file join $rootDir subdir3]
10199
cd [file join $rootDir subdir3]
102100
103101
fossil mv --hard ../f3 .
104
-test mv-hard-relative-1 {
105
- [normalize_result] eq "RENAME f3 subdir3/f3\nMOVED_FILE ${rootDir}/f3"
106
-}
102
+test_eq mv-hard-relative-1 [normalize_result] \
103
+ "RENAME f3 subdir3/f3\nMOVED_FILE ${rootDir}/f3"
107104
108105
fossil revert
109
-test mv-hard-relative-2 {
110
- [normalize_result] eq "DELETE subdir3/f3\nREVERT f3${undoMsg}"
111
-}
106
+test_eq mv-hard-relative-2 [normalize_result] \
107
+ "DELETE subdir3/f3\nREVERT f3${undoMsg}"
112108
113109
cd $rootDir
114110
115111
###################################
116112
# Test 4: Hard Move Relative File #
@@ -118,18 +114,16 @@
118114
119115
file mkdir [file join $rootDir subdir4]
120116
cd [file join $rootDir subdir4]
121117
122118
fossil mv --hard ../f4 ./f4
123
-test mv-hard-relative-3 {
124
- [normalize_result] eq "RENAME f4 subdir4/f4\nMOVED_FILE ${rootDir}/f4"
125
-}
119
+test_eq mv-hard-relative-3 [normalize_result] \
120
+ "RENAME f4 subdir4/f4\nMOVED_FILE ${rootDir}/f4"
126121
127122
fossil revert
128
-test mv-hard-relative-4 {
129
- [normalize_result] eq "DELETE subdir4/f4\nREVERT f4${undoMsg}"
130
-}
123
+test_eq mv-hard-relative-4 [normalize_result] \
124
+ "DELETE subdir4/f4\nREVERT f4${undoMsg}"
131125
132126
cd $rootDir
133127
134128
########################################
135129
# Test 5: Soft Move Absolute Directory #
@@ -140,13 +134,12 @@
140134
141135
fossil mv [file join $rootDir f5] [file join $rootDir subdir5]
142136
test mv-soft-absolute-1 {$RESULT eq "RENAME f5 subdir5/f5"}
143137
144138
fossil revert
145
-test mv-soft-absolute-2 {
146
- [normalize_result] eq "DELETE subdir5/f5\nREVERT f5${undoMsg}"
147
-}
139
+test_eq mv-soft-absolute-2 [normalize_result] \
140
+ "DELETE subdir5/f5\nREVERT f5${undoMsg}"
148141
149142
cd $rootDir
150143
151144
###################################
152145
# Test 6: Soft Move Absolute File #
@@ -157,13 +150,12 @@
157150
158151
fossil mv [file join $rootDir f6] [file join $rootDir subdir6 f6]
159152
test mv-soft-absolute-3 {$RESULT eq "RENAME f6 subdir6/f6"}
160153
161154
fossil revert
162
-test mv-soft-absolute-4 {
163
- [normalize_result] eq "DELETE subdir6/f6\nREVERT f6${undoMsg}"
164
-}
155
+test_eq mv-soft-absolute-4 [normalize_result] \
156
+ "DELETE subdir6/f6\nREVERT f6${undoMsg}"
165157
166158
cd $rootDir
167159
168160
########################################
169161
# Test 7: Hard Move Absolute Directory #
@@ -171,18 +163,16 @@
171163
172164
file mkdir [file join $rootDir subdir7]
173165
cd [file join $rootDir subdir7]
174166
175167
fossil mv --hard [file join $rootDir f7] [file join $rootDir subdir7]
176
-test mv-hard-absolute-1 {
177
- [normalize_result] eq "RENAME f7 subdir7/f7\nMOVED_FILE ${rootDir}/f7"
178
-}
168
+test_eq mv-hard-absolute-1 [normalize_result] \
169
+ "RENAME f7 subdir7/f7\nMOVED_FILE ${rootDir}/f7"
179170
180171
fossil revert
181
-test mv-hard-absolute-2 {
182
- [normalize_result] eq "DELETE subdir7/f7\nREVERT f7${undoMsg}"
183
-}
172
+test_eq mv-hard-absolute-2 [normalize_result] \
173
+ "DELETE subdir7/f7\nREVERT f7${undoMsg}"
184174
185175
cd $rootDir
186176
187177
###################################
188178
# Test 8: Hard Move Absolute File #
@@ -190,18 +180,16 @@
190180
191181
file mkdir [file join $rootDir subdir8]
192182
cd [file join $rootDir subdir8]
193183
194184
fossil mv --hard [file join $rootDir f8] [file join $rootDir subdir8 f8]
195
-test mv-hard-absolute-3 {
196
- [normalize_result] eq "RENAME f8 subdir8/f8\nMOVED_FILE ${rootDir}/f8"
197
-}
185
+test_eq mv-hard-absolute-3 [normalize_result] \
186
+ "RENAME f8 subdir8/f8\nMOVED_FILE ${rootDir}/f8"
198187
199188
fossil revert
200
-test mv-hard-absolute-4 {
201
- [normalize_result] eq "DELETE subdir8/f8\nREVERT f8${undoMsg}"
202
-}
189
+test_eq mv-hard-absolute-4 [normalize_result] \
190
+ "DELETE subdir8/f8\nREVERT f8${undoMsg}"
203191
204192
cd $rootDir
205193
206194
##########################################
207195
# Test 9: Soft Remove Relative Directory #
@@ -215,13 +203,12 @@
215203
216204
fossil rm ../subdirB
217205
test rm-soft-relative-2 {$RESULT eq "DELETED subdirB/f9"}
218206
219207
fossil rm ../subdirC
220
-test rm-soft-relative-3 {
221
- [normalize_result] eq "DELETED subdirC/f10\nDELETED subdirC/f11"
222
-}
208
+test_eq rm-soft-relative-3 [normalize_result] \
209
+ "DELETED subdirC/f10\nDELETED subdirC/f11"
223210
224211
fossil revert
225212
test rm-soft-relative-4 {
226213
[normalize_result] eq \
227214
"REVERT subdirB/f9\nREVERT subdirC/f10\nREVERT subdirC/f11${undoMsg}"
@@ -238,13 +225,11 @@
238225
239226
fossil rm ../f2
240227
test rm-soft-relative-5 {$RESULT eq "DELETED f2"}
241228
242229
fossil revert
243
-test rm-soft-relative-6 {
244
- [normalize_result] eq "REVERT f2${undoMsg}"
245
-}
230
+test_eq rm-soft-relative-6 [normalize_result] "REVERT f2${undoMsg}"
246231
247232
cd $rootDir
248233
249234
###########################################
250235
# Test 11: Hard Remove Relative Directory #
@@ -252,13 +237,11 @@
252237
253238
file mkdir [file join $rootDir subdir3]
254239
cd [file join $rootDir subdir3]
255240
256241
fossil rm --hard ../subdirA
257
-test rm-hard-relative-1 {
258
- [normalize_result] eq ""
259
-}
242
+test_eq rm-hard-relative-1 [normalize_result] ""
260243
261244
fossil rm --hard ../subdirB
262245
test rm-hard-relative-2 {
263246
[normalize_result] eq \
264247
"DELETED subdirB/f9\nDELETED_FILE ${rootDir}/subdirB/f9"
@@ -285,18 +268,15 @@
285268
286269
file mkdir [file join $rootDir subdir4]
287270
cd [file join $rootDir subdir4]
288271
289272
fossil rm --hard ../f4
290
-test rm-hard-relative-5 {
291
- [normalize_result] eq "DELETED f4\nDELETED_FILE ${rootDir}/f4"
292
-}
273
+test_eq rm-hard-relative-5 [normalize_result] \
274
+ "DELETED f4\nDELETED_FILE ${rootDir}/f4"
293275
294276
fossil revert
295
-test rm-hard-relative-6 {
296
- [normalize_result] eq "REVERT f4${undoMsg}"
297
-}
277
+test_eq rm-hard-relative-6 [normalize_result] "REVERT f4${undoMsg}"
298278
299279
cd $rootDir
300280
301281
###########################################
302282
# Test 13: Soft Remove Absolute Directory #
@@ -310,13 +290,12 @@
310290
311291
fossil rm [file join $rootDir subdirB]
312292
test rm-soft-absolute-2 {$RESULT eq "DELETED subdirB/f9"}
313293
314294
fossil rm [file join $rootDir subdirC]
315
-test rm-soft-absolute-3 {
316
- [normalize_result] eq "DELETED subdirC/f10\nDELETED subdirC/f11"
317
-}
295
+test_eq rm-soft-absolute-3 [normalize_result] \
296
+ "DELETED subdirC/f10\nDELETED subdirC/f11"
318297
319298
fossil revert
320299
test rm-soft-absolute-4 {
321300
[normalize_result] eq \
322301
"REVERT subdirB/f9\nREVERT subdirC/f10\nREVERT subdirC/f11${undoMsg}"
@@ -333,13 +312,11 @@
333312
334313
fossil rm [file join $rootDir f6]
335314
test rm-soft-absolute-5 {$RESULT eq "DELETED f6"}
336315
337316
fossil revert
338
-test rm-soft-absolute-6 {
339
- [normalize_result] eq "REVERT f6${undoMsg}"
340
-}
317
+test_eq rm-soft-absolute-6 [normalize_result] "REVERT f6${undoMsg}"
341318
342319
cd $rootDir
343320
344321
###########################################
345322
# Test 15: Hard Remove Absolute Directory #
@@ -378,93 +355,93 @@
378355
379356
file mkdir [file join $rootDir subdir8]
380357
cd [file join $rootDir subdir8]
381358
382359
fossil rm --hard [file join $rootDir f8]
383
-test rm-hard-absolute-5 {
384
- [normalize_result] eq "DELETED f8\nDELETED_FILE ${rootDir}/f8"
385
-}
360
+test_eq rm-hard-absolute-5 [normalize_result] \
361
+ "DELETED f8\nDELETED_FILE ${rootDir}/f8"
386362
387363
fossil revert
388
-test rm-hard-absolute-6 {
389
- [normalize_result] eq "REVERT f8${undoMsg}"
390
-}
364
+test_eq rm-hard-absolute-6 [normalize_result] "REVERT f8${undoMsg}"
391365
392366
cd $rootDir
393367
394368
#######################################
395369
# Test 17: Move File to New Directory #
396370
#######################################
397371
398372
fossil mv --hard f12 d2/f13
399
-test mv-file-new-directory-1 {
400
- [normalize_result] eq "RENAME f12 d2/f13\nMOVED_FILE ${rootDir}/f12"
401
-}
373
+test_eq mv-file-new-directory-1 [normalize_result] \
374
+ "RENAME f12 d2/f13\nMOVED_FILE ${rootDir}/f12"
402375
403376
test mv-file-new-directory-2 {[file size d2/f13] == 3}
404
-test mv-file-new-directory-3 {[read_file d2/f13] eq "f12"}
377
+test_eq mv-file-new-directory-3 [read_file d2/f13] "f12"
405378
406379
fossil revert
407
-test mv-file-new-directory-4 {
408
- [normalize_result] eq "DELETE d2/f13\nREVERT f12${undoMsg}"
409
-}
380
+test_eq mv-file-new-directory-4 [normalize_result] \
381
+ "DELETE d2/f13\nREVERT f12${undoMsg}"
410382
411383
test mv-file-new-directory-5 {[file size f12] == 3}
412
-test mv-file-new-directory-6 {[read_file f12] eq "f12"}
384
+test_eq mv-file-new-directory-6 [read_file f12] "f12"
413385
414386
cd $rootDir
415387
416388
############################################
417389
# Test 18: Move Directory to New Directory #
418390
############################################
419391
420392
fossil mv --hard subdirC subdirD
421
-test mv-file-new-directory-7 {
422
- [normalize_result] eq "RENAME subdirC/f10 subdirD/f10\nRENAME subdirC/f11 subdirD/f11\nMOVED_FILE ${rootDir}/subdirC/f10\nMOVED_FILE ${rootDir}/subdirC/f11"
423
-}
393
+test_eq mv-file-new-directory-7 [normalize_result] \
394
+ [join [list \
395
+ "RENAME subdirC/f10 subdirD/f10\n" \
396
+ "RENAME subdirC/f11 subdirD/f11\n" \
397
+ "MOVED_FILE ${rootDir}/subdirC/f10\n" \
398
+ "MOVED_FILE ${rootDir}/subdirC/f11"] ""]
424399
425400
test mv-file-new-directory-8 {[file size subdirD/f10] == 3}
426
-test mv-file-new-directory-9 {[read_file subdirD/f10] eq "f10"}
401
+test_eq mv-file-new-directory-9 [read_file subdirD/f10] "f10"
427402
test mv-file-new-directory-10 {[file size subdirD/f11] == 3}
428
-test mv-file-new-directory-11 {[read_file subdirD/f11] eq "f11"}
403
+test_eq mv-file-new-directory-11 [read_file subdirD/f11] "f11"
429404
430405
fossil revert
431
-test mv-file-new-directory-12 {
432
- [normalize_result] eq "DELETE subdirD/f10\nDELETE subdirD/f11\nREVERT subdirC/f10\nREVERT subdirC/f11${undoMsg}"
433
-}
406
+test_eq mv-file-new-directory-12 [normalize_result] \
407
+ [join [list \
408
+ "DELETE subdirD/f10\nDELETE subdirD/f11\n" \
409
+ "REVERT subdirC/f10\nREVERT subdirC/f11${undoMsg}"] ""]
434410
435411
test mv-file-new-directory-13 {[file size subdirC/f10] == 3}
436
-test mv-file-new-directory-14 {[read_file subdirC/f10] eq "f10"}
412
+test_eq mv-file-new-directory-14 [read_file subdirC/f10] "f10"
437413
test mv-file-new-directory-15 {[file size subdirC/f11] == 3}
438
-test mv-file-new-directory-16 {[read_file subdirC/f11] eq "f11"}
414
+test_eq mv-file-new-directory-16 [read_file subdirC/f11] "f11"
439415
440416
cd $rootDir
441417
442418
###############################################################################
443419
# Test 19: Follow-up Soft Rename of a Directory Already Renamed on Filesystem #
444420
###############################################################################
445421
446
-file rename [file join $rootDir subdirE/a] [file join $rootDir subdirE/a_renamed]
422
+file rename [file join $rootDir subdirE/a] \
423
+ [file join $rootDir subdirE/a_renamed]
447424
448425
fossil mv subdirE/a subdirE/a_renamed
449
-test mv-soft-already-renamed-directory-1 {
450
- [normalize_result] eq "RENAME subdirE/a/f14 subdirE/a_renamed/f14"
451
-}
426
+test_eq mv-soft-already-renamed-directory-1 [normalize_result] \
427
+ "RENAME subdirE/a/f14 subdirE/a_renamed/f14"
452428
453
-test mv-soft-already-renamed-directory-2 {[file size subdirE/a_renamed/f14] == 3}
454
-test mv-soft-already-renamed-directory-3 {[read_file subdirE/a_renamed/f14] eq "f14"}
429
+test mv-soft-already-renamed-directory-2 \
430
+ {[file size subdirE/a_renamed/f14] == 3}
431
+test_eq mv-soft-already-renamed-directory-3 [read_file subdirE/a_renamed/f14] \
432
+ "f14"
455433
456434
fossil revert
457
-test mv-soft-already-renamed-directory-4 {
458
- [normalize_result] eq "DELETE subdirE/a_renamed/f14\nREVERT subdirE/a/f14${undoMsg}"
459
-}
435
+test_eq mv-soft-already-renamed-directory-4 [normalize_result] \
436
+ "DELETE subdirE/a_renamed/f14\nREVERT subdirE/a/f14${undoMsg}"
460437
461438
test mv-soft-already-renamed-directory-5 {[file size subdirE/a/f14] == 3}
462
-test mv-soft-already-renamed-directory-6 {[read_file subdirE/a/f14] eq "f14"}
439
+test_eq mv-soft-already-renamed-directory-6 [read_file subdirE/a/f14] "f14"
463440
464441
file delete -force [file join $rootDir subdirE/a_renamed]
465442
466443
cd $rootDir
467444
468445
###############################################################################
469446
470447
test_cleanup
471448
--- test/mv-rm.test
+++ test/mv-rm.test
@@ -68,13 +68,12 @@
68
69 fossil mv ../f1 .
70 test mv-soft-relative-1 {$RESULT eq "RENAME f1 subdir1/f1"}
71
72 fossil revert
73 test mv-soft-relative-2 {
74 [normalize_result] eq "DELETE subdir1/f1\nREVERT f1${undoMsg}"
75 }
76
77 cd $rootDir
78
79 ###################################
80 # Test 2: Soft Move Relative File #
@@ -85,13 +84,12 @@
85
86 fossil mv ../f2 ./f2
87 test mv-soft-relative-3 {$RESULT eq "RENAME f2 subdir2/f2"}
88
89 fossil revert
90 test mv-soft-relative-4 {
91 [normalize_result] eq "DELETE subdir2/f2\nREVERT f2${undoMsg}"
92 }
93
94 cd $rootDir
95
96 ########################################
97 # Test 3: Hard Move Relative Directory #
@@ -99,18 +97,16 @@
99
100 file mkdir [file join $rootDir subdir3]
101 cd [file join $rootDir subdir3]
102
103 fossil mv --hard ../f3 .
104 test mv-hard-relative-1 {
105 [normalize_result] eq "RENAME f3 subdir3/f3\nMOVED_FILE ${rootDir}/f3"
106 }
107
108 fossil revert
109 test mv-hard-relative-2 {
110 [normalize_result] eq "DELETE subdir3/f3\nREVERT f3${undoMsg}"
111 }
112
113 cd $rootDir
114
115 ###################################
116 # Test 4: Hard Move Relative File #
@@ -118,18 +114,16 @@
118
119 file mkdir [file join $rootDir subdir4]
120 cd [file join $rootDir subdir4]
121
122 fossil mv --hard ../f4 ./f4
123 test mv-hard-relative-3 {
124 [normalize_result] eq "RENAME f4 subdir4/f4\nMOVED_FILE ${rootDir}/f4"
125 }
126
127 fossil revert
128 test mv-hard-relative-4 {
129 [normalize_result] eq "DELETE subdir4/f4\nREVERT f4${undoMsg}"
130 }
131
132 cd $rootDir
133
134 ########################################
135 # Test 5: Soft Move Absolute Directory #
@@ -140,13 +134,12 @@
140
141 fossil mv [file join $rootDir f5] [file join $rootDir subdir5]
142 test mv-soft-absolute-1 {$RESULT eq "RENAME f5 subdir5/f5"}
143
144 fossil revert
145 test mv-soft-absolute-2 {
146 [normalize_result] eq "DELETE subdir5/f5\nREVERT f5${undoMsg}"
147 }
148
149 cd $rootDir
150
151 ###################################
152 # Test 6: Soft Move Absolute File #
@@ -157,13 +150,12 @@
157
158 fossil mv [file join $rootDir f6] [file join $rootDir subdir6 f6]
159 test mv-soft-absolute-3 {$RESULT eq "RENAME f6 subdir6/f6"}
160
161 fossil revert
162 test mv-soft-absolute-4 {
163 [normalize_result] eq "DELETE subdir6/f6\nREVERT f6${undoMsg}"
164 }
165
166 cd $rootDir
167
168 ########################################
169 # Test 7: Hard Move Absolute Directory #
@@ -171,18 +163,16 @@
171
172 file mkdir [file join $rootDir subdir7]
173 cd [file join $rootDir subdir7]
174
175 fossil mv --hard [file join $rootDir f7] [file join $rootDir subdir7]
176 test mv-hard-absolute-1 {
177 [normalize_result] eq "RENAME f7 subdir7/f7\nMOVED_FILE ${rootDir}/f7"
178 }
179
180 fossil revert
181 test mv-hard-absolute-2 {
182 [normalize_result] eq "DELETE subdir7/f7\nREVERT f7${undoMsg}"
183 }
184
185 cd $rootDir
186
187 ###################################
188 # Test 8: Hard Move Absolute File #
@@ -190,18 +180,16 @@
190
191 file mkdir [file join $rootDir subdir8]
192 cd [file join $rootDir subdir8]
193
194 fossil mv --hard [file join $rootDir f8] [file join $rootDir subdir8 f8]
195 test mv-hard-absolute-3 {
196 [normalize_result] eq "RENAME f8 subdir8/f8\nMOVED_FILE ${rootDir}/f8"
197 }
198
199 fossil revert
200 test mv-hard-absolute-4 {
201 [normalize_result] eq "DELETE subdir8/f8\nREVERT f8${undoMsg}"
202 }
203
204 cd $rootDir
205
206 ##########################################
207 # Test 9: Soft Remove Relative Directory #
@@ -215,13 +203,12 @@
215
216 fossil rm ../subdirB
217 test rm-soft-relative-2 {$RESULT eq "DELETED subdirB/f9"}
218
219 fossil rm ../subdirC
220 test rm-soft-relative-3 {
221 [normalize_result] eq "DELETED subdirC/f10\nDELETED subdirC/f11"
222 }
223
224 fossil revert
225 test rm-soft-relative-4 {
226 [normalize_result] eq \
227 "REVERT subdirB/f9\nREVERT subdirC/f10\nREVERT subdirC/f11${undoMsg}"
@@ -238,13 +225,11 @@
238
239 fossil rm ../f2
240 test rm-soft-relative-5 {$RESULT eq "DELETED f2"}
241
242 fossil revert
243 test rm-soft-relative-6 {
244 [normalize_result] eq "REVERT f2${undoMsg}"
245 }
246
247 cd $rootDir
248
249 ###########################################
250 # Test 11: Hard Remove Relative Directory #
@@ -252,13 +237,11 @@
252
253 file mkdir [file join $rootDir subdir3]
254 cd [file join $rootDir subdir3]
255
256 fossil rm --hard ../subdirA
257 test rm-hard-relative-1 {
258 [normalize_result] eq ""
259 }
260
261 fossil rm --hard ../subdirB
262 test rm-hard-relative-2 {
263 [normalize_result] eq \
264 "DELETED subdirB/f9\nDELETED_FILE ${rootDir}/subdirB/f9"
@@ -285,18 +268,15 @@
285
286 file mkdir [file join $rootDir subdir4]
287 cd [file join $rootDir subdir4]
288
289 fossil rm --hard ../f4
290 test rm-hard-relative-5 {
291 [normalize_result] eq "DELETED f4\nDELETED_FILE ${rootDir}/f4"
292 }
293
294 fossil revert
295 test rm-hard-relative-6 {
296 [normalize_result] eq "REVERT f4${undoMsg}"
297 }
298
299 cd $rootDir
300
301 ###########################################
302 # Test 13: Soft Remove Absolute Directory #
@@ -310,13 +290,12 @@
310
311 fossil rm [file join $rootDir subdirB]
312 test rm-soft-absolute-2 {$RESULT eq "DELETED subdirB/f9"}
313
314 fossil rm [file join $rootDir subdirC]
315 test rm-soft-absolute-3 {
316 [normalize_result] eq "DELETED subdirC/f10\nDELETED subdirC/f11"
317 }
318
319 fossil revert
320 test rm-soft-absolute-4 {
321 [normalize_result] eq \
322 "REVERT subdirB/f9\nREVERT subdirC/f10\nREVERT subdirC/f11${undoMsg}"
@@ -333,13 +312,11 @@
333
334 fossil rm [file join $rootDir f6]
335 test rm-soft-absolute-5 {$RESULT eq "DELETED f6"}
336
337 fossil revert
338 test rm-soft-absolute-6 {
339 [normalize_result] eq "REVERT f6${undoMsg}"
340 }
341
342 cd $rootDir
343
344 ###########################################
345 # Test 15: Hard Remove Absolute Directory #
@@ -378,93 +355,93 @@
378
379 file mkdir [file join $rootDir subdir8]
380 cd [file join $rootDir subdir8]
381
382 fossil rm --hard [file join $rootDir f8]
383 test rm-hard-absolute-5 {
384 [normalize_result] eq "DELETED f8\nDELETED_FILE ${rootDir}/f8"
385 }
386
387 fossil revert
388 test rm-hard-absolute-6 {
389 [normalize_result] eq "REVERT f8${undoMsg}"
390 }
391
392 cd $rootDir
393
394 #######################################
395 # Test 17: Move File to New Directory #
396 #######################################
397
398 fossil mv --hard f12 d2/f13
399 test mv-file-new-directory-1 {
400 [normalize_result] eq "RENAME f12 d2/f13\nMOVED_FILE ${rootDir}/f12"
401 }
402
403 test mv-file-new-directory-2 {[file size d2/f13] == 3}
404 test mv-file-new-directory-3 {[read_file d2/f13] eq "f12"}
405
406 fossil revert
407 test mv-file-new-directory-4 {
408 [normalize_result] eq "DELETE d2/f13\nREVERT f12${undoMsg}"
409 }
410
411 test mv-file-new-directory-5 {[file size f12] == 3}
412 test mv-file-new-directory-6 {[read_file f12] eq "f12"}
413
414 cd $rootDir
415
416 ############################################
417 # Test 18: Move Directory to New Directory #
418 ############################################
419
420 fossil mv --hard subdirC subdirD
421 test mv-file-new-directory-7 {
422 [normalize_result] eq "RENAME subdirC/f10 subdirD/f10\nRENAME subdirC/f11 subdirD/f11\nMOVED_FILE ${rootDir}/subdirC/f10\nMOVED_FILE ${rootDir}/subdirC/f11"
423 }
 
 
 
424
425 test mv-file-new-directory-8 {[file size subdirD/f10] == 3}
426 test mv-file-new-directory-9 {[read_file subdirD/f10] eq "f10"}
427 test mv-file-new-directory-10 {[file size subdirD/f11] == 3}
428 test mv-file-new-directory-11 {[read_file subdirD/f11] eq "f11"}
429
430 fossil revert
431 test mv-file-new-directory-12 {
432 [normalize_result] eq "DELETE subdirD/f10\nDELETE subdirD/f11\nREVERT subdirC/f10\nREVERT subdirC/f11${undoMsg}"
433 }
 
434
435 test mv-file-new-directory-13 {[file size subdirC/f10] == 3}
436 test mv-file-new-directory-14 {[read_file subdirC/f10] eq "f10"}
437 test mv-file-new-directory-15 {[file size subdirC/f11] == 3}
438 test mv-file-new-directory-16 {[read_file subdirC/f11] eq "f11"}
439
440 cd $rootDir
441
442 ###############################################################################
443 # Test 19: Follow-up Soft Rename of a Directory Already Renamed on Filesystem #
444 ###############################################################################
445
446 file rename [file join $rootDir subdirE/a] [file join $rootDir subdirE/a_renamed]
 
447
448 fossil mv subdirE/a subdirE/a_renamed
449 test mv-soft-already-renamed-directory-1 {
450 [normalize_result] eq "RENAME subdirE/a/f14 subdirE/a_renamed/f14"
451 }
452
453 test mv-soft-already-renamed-directory-2 {[file size subdirE/a_renamed/f14] == 3}
454 test mv-soft-already-renamed-directory-3 {[read_file subdirE/a_renamed/f14] eq "f14"}
 
 
455
456 fossil revert
457 test mv-soft-already-renamed-directory-4 {
458 [normalize_result] eq "DELETE subdirE/a_renamed/f14\nREVERT subdirE/a/f14${undoMsg}"
459 }
460
461 test mv-soft-already-renamed-directory-5 {[file size subdirE/a/f14] == 3}
462 test mv-soft-already-renamed-directory-6 {[read_file subdirE/a/f14] eq "f14"}
463
464 file delete -force [file join $rootDir subdirE/a_renamed]
465
466 cd $rootDir
467
468 ###############################################################################
469
470 test_cleanup
471
--- test/mv-rm.test
+++ test/mv-rm.test
@@ -68,13 +68,12 @@
68
69 fossil mv ../f1 .
70 test mv-soft-relative-1 {$RESULT eq "RENAME f1 subdir1/f1"}
71
72 fossil revert
73 test_eq mv-soft-relative-2 [normalize_result] \
74 "DELETE subdir1/f1\nREVERT f1${undoMsg}"
 
75
76 cd $rootDir
77
78 ###################################
79 # Test 2: Soft Move Relative File #
@@ -85,13 +84,12 @@
84
85 fossil mv ../f2 ./f2
86 test mv-soft-relative-3 {$RESULT eq "RENAME f2 subdir2/f2"}
87
88 fossil revert
89 test_eq mv-soft-relative-4 [normalize_result] \
90 "DELETE subdir2/f2\nREVERT f2${undoMsg}"
 
91
92 cd $rootDir
93
94 ########################################
95 # Test 3: Hard Move Relative Directory #
@@ -99,18 +97,16 @@
97
98 file mkdir [file join $rootDir subdir3]
99 cd [file join $rootDir subdir3]
100
101 fossil mv --hard ../f3 .
102 test_eq mv-hard-relative-1 [normalize_result] \
103 "RENAME f3 subdir3/f3\nMOVED_FILE ${rootDir}/f3"
 
104
105 fossil revert
106 test_eq mv-hard-relative-2 [normalize_result] \
107 "DELETE subdir3/f3\nREVERT f3${undoMsg}"
 
108
109 cd $rootDir
110
111 ###################################
112 # Test 4: Hard Move Relative File #
@@ -118,18 +114,16 @@
114
115 file mkdir [file join $rootDir subdir4]
116 cd [file join $rootDir subdir4]
117
118 fossil mv --hard ../f4 ./f4
119 test_eq mv-hard-relative-3 [normalize_result] \
120 "RENAME f4 subdir4/f4\nMOVED_FILE ${rootDir}/f4"
 
121
122 fossil revert
123 test_eq mv-hard-relative-4 [normalize_result] \
124 "DELETE subdir4/f4\nREVERT f4${undoMsg}"
 
125
126 cd $rootDir
127
128 ########################################
129 # Test 5: Soft Move Absolute Directory #
@@ -140,13 +134,12 @@
134
135 fossil mv [file join $rootDir f5] [file join $rootDir subdir5]
136 test mv-soft-absolute-1 {$RESULT eq "RENAME f5 subdir5/f5"}
137
138 fossil revert
139 test_eq mv-soft-absolute-2 [normalize_result] \
140 "DELETE subdir5/f5\nREVERT f5${undoMsg}"
 
141
142 cd $rootDir
143
144 ###################################
145 # Test 6: Soft Move Absolute File #
@@ -157,13 +150,12 @@
150
151 fossil mv [file join $rootDir f6] [file join $rootDir subdir6 f6]
152 test mv-soft-absolute-3 {$RESULT eq "RENAME f6 subdir6/f6"}
153
154 fossil revert
155 test_eq mv-soft-absolute-4 [normalize_result] \
156 "DELETE subdir6/f6\nREVERT f6${undoMsg}"
 
157
158 cd $rootDir
159
160 ########################################
161 # Test 7: Hard Move Absolute Directory #
@@ -171,18 +163,16 @@
163
164 file mkdir [file join $rootDir subdir7]
165 cd [file join $rootDir subdir7]
166
167 fossil mv --hard [file join $rootDir f7] [file join $rootDir subdir7]
168 test_eq mv-hard-absolute-1 [normalize_result] \
169 "RENAME f7 subdir7/f7\nMOVED_FILE ${rootDir}/f7"
 
170
171 fossil revert
172 test_eq mv-hard-absolute-2 [normalize_result] \
173 "DELETE subdir7/f7\nREVERT f7${undoMsg}"
 
174
175 cd $rootDir
176
177 ###################################
178 # Test 8: Hard Move Absolute File #
@@ -190,18 +180,16 @@
180
181 file mkdir [file join $rootDir subdir8]
182 cd [file join $rootDir subdir8]
183
184 fossil mv --hard [file join $rootDir f8] [file join $rootDir subdir8 f8]
185 test_eq mv-hard-absolute-3 [normalize_result] \
186 "RENAME f8 subdir8/f8\nMOVED_FILE ${rootDir}/f8"
 
187
188 fossil revert
189 test_eq mv-hard-absolute-4 [normalize_result] \
190 "DELETE subdir8/f8\nREVERT f8${undoMsg}"
 
191
192 cd $rootDir
193
194 ##########################################
195 # Test 9: Soft Remove Relative Directory #
@@ -215,13 +203,12 @@
203
204 fossil rm ../subdirB
205 test rm-soft-relative-2 {$RESULT eq "DELETED subdirB/f9"}
206
207 fossil rm ../subdirC
208 test_eq rm-soft-relative-3 [normalize_result] \
209 "DELETED subdirC/f10\nDELETED subdirC/f11"
 
210
211 fossil revert
212 test rm-soft-relative-4 {
213 [normalize_result] eq \
214 "REVERT subdirB/f9\nREVERT subdirC/f10\nREVERT subdirC/f11${undoMsg}"
@@ -238,13 +225,11 @@
225
226 fossil rm ../f2
227 test rm-soft-relative-5 {$RESULT eq "DELETED f2"}
228
229 fossil revert
230 test_eq rm-soft-relative-6 [normalize_result] "REVERT f2${undoMsg}"
 
 
231
232 cd $rootDir
233
234 ###########################################
235 # Test 11: Hard Remove Relative Directory #
@@ -252,13 +237,11 @@
237
238 file mkdir [file join $rootDir subdir3]
239 cd [file join $rootDir subdir3]
240
241 fossil rm --hard ../subdirA
242 test_eq rm-hard-relative-1 [normalize_result] ""
 
 
243
244 fossil rm --hard ../subdirB
245 test rm-hard-relative-2 {
246 [normalize_result] eq \
247 "DELETED subdirB/f9\nDELETED_FILE ${rootDir}/subdirB/f9"
@@ -285,18 +268,15 @@
268
269 file mkdir [file join $rootDir subdir4]
270 cd [file join $rootDir subdir4]
271
272 fossil rm --hard ../f4
273 test_eq rm-hard-relative-5 [normalize_result] \
274 "DELETED f4\nDELETED_FILE ${rootDir}/f4"
 
275
276 fossil revert
277 test_eq rm-hard-relative-6 [normalize_result] "REVERT f4${undoMsg}"
 
 
278
279 cd $rootDir
280
281 ###########################################
282 # Test 13: Soft Remove Absolute Directory #
@@ -310,13 +290,12 @@
290
291 fossil rm [file join $rootDir subdirB]
292 test rm-soft-absolute-2 {$RESULT eq "DELETED subdirB/f9"}
293
294 fossil rm [file join $rootDir subdirC]
295 test_eq rm-soft-absolute-3 [normalize_result] \
296 "DELETED subdirC/f10\nDELETED subdirC/f11"
 
297
298 fossil revert
299 test rm-soft-absolute-4 {
300 [normalize_result] eq \
301 "REVERT subdirB/f9\nREVERT subdirC/f10\nREVERT subdirC/f11${undoMsg}"
@@ -333,13 +312,11 @@
312
313 fossil rm [file join $rootDir f6]
314 test rm-soft-absolute-5 {$RESULT eq "DELETED f6"}
315
316 fossil revert
317 test_eq rm-soft-absolute-6 [normalize_result] "REVERT f6${undoMsg}"
 
 
318
319 cd $rootDir
320
321 ###########################################
322 # Test 15: Hard Remove Absolute Directory #
@@ -378,93 +355,93 @@
355
356 file mkdir [file join $rootDir subdir8]
357 cd [file join $rootDir subdir8]
358
359 fossil rm --hard [file join $rootDir f8]
360 test_eq rm-hard-absolute-5 [normalize_result] \
361 "DELETED f8\nDELETED_FILE ${rootDir}/f8"
 
362
363 fossil revert
364 test_eq rm-hard-absolute-6 [normalize_result] "REVERT f8${undoMsg}"
 
 
365
366 cd $rootDir
367
368 #######################################
369 # Test 17: Move File to New Directory #
370 #######################################
371
372 fossil mv --hard f12 d2/f13
373 test_eq mv-file-new-directory-1 [normalize_result] \
374 "RENAME f12 d2/f13\nMOVED_FILE ${rootDir}/f12"
 
375
376 test mv-file-new-directory-2 {[file size d2/f13] == 3}
377 test_eq mv-file-new-directory-3 [read_file d2/f13] "f12"
378
379 fossil revert
380 test_eq mv-file-new-directory-4 [normalize_result] \
381 "DELETE d2/f13\nREVERT f12${undoMsg}"
 
382
383 test mv-file-new-directory-5 {[file size f12] == 3}
384 test_eq mv-file-new-directory-6 [read_file f12] "f12"
385
386 cd $rootDir
387
388 ############################################
389 # Test 18: Move Directory to New Directory #
390 ############################################
391
392 fossil mv --hard subdirC subdirD
393 test_eq mv-file-new-directory-7 [normalize_result] \
394 [join [list \
395 "RENAME subdirC/f10 subdirD/f10\n" \
396 "RENAME subdirC/f11 subdirD/f11\n" \
397 "MOVED_FILE ${rootDir}/subdirC/f10\n" \
398 "MOVED_FILE ${rootDir}/subdirC/f11"] ""]
399
400 test mv-file-new-directory-8 {[file size subdirD/f10] == 3}
401 test_eq mv-file-new-directory-9 [read_file subdirD/f10] "f10"
402 test mv-file-new-directory-10 {[file size subdirD/f11] == 3}
403 test_eq mv-file-new-directory-11 [read_file subdirD/f11] "f11"
404
405 fossil revert
406 test_eq mv-file-new-directory-12 [normalize_result] \
407 [join [list \
408 "DELETE subdirD/f10\nDELETE subdirD/f11\n" \
409 "REVERT subdirC/f10\nREVERT subdirC/f11${undoMsg}"] ""]
410
411 test mv-file-new-directory-13 {[file size subdirC/f10] == 3}
412 test_eq mv-file-new-directory-14 [read_file subdirC/f10] "f10"
413 test mv-file-new-directory-15 {[file size subdirC/f11] == 3}
414 test_eq mv-file-new-directory-16 [read_file subdirC/f11] "f11"
415
416 cd $rootDir
417
418 ###############################################################################
419 # Test 19: Follow-up Soft Rename of a Directory Already Renamed on Filesystem #
420 ###############################################################################
421
422 file rename [file join $rootDir subdirE/a] \
423 [file join $rootDir subdirE/a_renamed]
424
425 fossil mv subdirE/a subdirE/a_renamed
426 test_eq mv-soft-already-renamed-directory-1 [normalize_result] \
427 "RENAME subdirE/a/f14 subdirE/a_renamed/f14"
 
428
429 test mv-soft-already-renamed-directory-2 \
430 {[file size subdirE/a_renamed/f14] == 3}
431 test_eq mv-soft-already-renamed-directory-3 [read_file subdirE/a_renamed/f14] \
432 "f14"
433
434 fossil revert
435 test_eq mv-soft-already-renamed-directory-4 [normalize_result] \
436 "DELETE subdirE/a_renamed/f14\nREVERT subdirE/a/f14${undoMsg}"
 
437
438 test mv-soft-already-renamed-directory-5 {[file size subdirE/a/f14] == 3}
439 test_eq mv-soft-already-renamed-directory-6 [read_file subdirE/a/f14] "f14"
440
441 file delete -force [file join $rootDir subdirE/a_renamed]
442
443 cd $rootDir
444
445 ###############################################################################
446
447 test_cleanup
448
--- test/reserved-names.test
+++ test/reserved-names.test
@@ -85,37 +85,29 @@
8585
set reserved_result [lindex $reserved_names_test 0]
8686
set reserved_name [lindex $reserved_names_test 1]
8787
8888
fossil test-is-reserved-name $reserved_name
8989
90
- test reserved-result-$testNo {
91
- [lindex [normalize_result] 0] eq $reserved_result
92
- }
90
+ test_eq reserved-result-$testNo [lindex [normalize_result] 0] $reserved_result
9391
94
- test reserved-name-$testNo {
95
- [lindex [normalize_result] 1] eq $reserved_name
96
- }
92
+ test_eq reserved-name-$testNo [lindex [normalize_result] 1] $reserved_name
9793
9894
fossil test-is-reserved-name [string toupper $reserved_name]
9995
100
- test reserved-result-upper-$testNo {
101
- [lindex [normalize_result] 0] eq $reserved_result
102
- }
96
+ test_eq reserved-result-upper-$testNo [lindex [normalize_result] 0] \
97
+ $reserved_result
10398
104
- test reserved-name-upper-$testNo {
105
- [lindex [normalize_result] 1] eq [string toupper $reserved_name]
106
- }
99
+ test_eq reserved-name-upper-$testNo [lindex [normalize_result] 1] \
100
+ [string toupper $reserved_name]
107101
108102
fossil test-is-reserved-name [string tolower $reserved_name]
109103
110
- test reserved-result-lower-$testNo {
111
- [lindex [normalize_result] 0] eq $reserved_result
112
- }
104
+ test_eq reserved-result-lower-$testNo [lindex [normalize_result] 0] \
105
+ $reserved_result
113106
114
- test reserved-name-lower-$testNo {
115
- [lindex [normalize_result] 1] eq [string tolower $reserved_name]
116
- }
107
+ test_eq reserved-name-lower-$testNo [lindex [normalize_result] 1] \
108
+ [string tolower $reserved_name]
117109
}
118110
119111
###############################################################################
120112
121113
test_cleanup
122114
--- test/reserved-names.test
+++ test/reserved-names.test
@@ -85,37 +85,29 @@
85 set reserved_result [lindex $reserved_names_test 0]
86 set reserved_name [lindex $reserved_names_test 1]
87
88 fossil test-is-reserved-name $reserved_name
89
90 test reserved-result-$testNo {
91 [lindex [normalize_result] 0] eq $reserved_result
92 }
93
94 test reserved-name-$testNo {
95 [lindex [normalize_result] 1] eq $reserved_name
96 }
97
98 fossil test-is-reserved-name [string toupper $reserved_name]
99
100 test reserved-result-upper-$testNo {
101 [lindex [normalize_result] 0] eq $reserved_result
102 }
103
104 test reserved-name-upper-$testNo {
105 [lindex [normalize_result] 1] eq [string toupper $reserved_name]
106 }
107
108 fossil test-is-reserved-name [string tolower $reserved_name]
109
110 test reserved-result-lower-$testNo {
111 [lindex [normalize_result] 0] eq $reserved_result
112 }
113
114 test reserved-name-lower-$testNo {
115 [lindex [normalize_result] 1] eq [string tolower $reserved_name]
116 }
117 }
118
119 ###############################################################################
120
121 test_cleanup
122
--- test/reserved-names.test
+++ test/reserved-names.test
@@ -85,37 +85,29 @@
85 set reserved_result [lindex $reserved_names_test 0]
86 set reserved_name [lindex $reserved_names_test 1]
87
88 fossil test-is-reserved-name $reserved_name
89
90 test_eq reserved-result-$testNo [lindex [normalize_result] 0] $reserved_result
 
 
91
92 test_eq reserved-name-$testNo [lindex [normalize_result] 1] $reserved_name
 
 
93
94 fossil test-is-reserved-name [string toupper $reserved_name]
95
96 test_eq reserved-result-upper-$testNo [lindex [normalize_result] 0] \
97 $reserved_result
 
98
99 test_eq reserved-name-upper-$testNo [lindex [normalize_result] 1] \
100 [string toupper $reserved_name]
 
101
102 fossil test-is-reserved-name [string tolower $reserved_name]
103
104 test_eq reserved-result-lower-$testNo [lindex [normalize_result] 0] \
105 $reserved_result
 
106
107 test_eq reserved-name-lower-$testNo [lindex [normalize_result] 1] \
108 [string tolower $reserved_name]
 
109 }
110
111 ###############################################################################
112
113 test_cleanup
114
--- test/revert.test
+++ test/revert.test
@@ -67,19 +67,15 @@
6767
fossil add f1 f2 f3
6868
fossil commit -m "c1"
6969
7070
# Make changes to be reverted
7171
#
72
-# Add f0
7372
write_file f0 "f0"
7473
fossil add f0
75
-# Remove f1
7674
file delete f1
7775
fossil rm f1
78
-# Edit f2
7976
write_file f2 "f2.1"
80
-# Rename f3 to f3n
8177
file rename -force f3 f3n
8278
fossil mv f3 f3n
8379
8480
# Test 'fossil revert' with no arguments
8581
#
@@ -238,11 +234,11 @@
238234
EDITED d/f2
239235
DELETED d/f3
240236
} -exists {d/f4} -notexists {d/f4new}
241237
242238
## Commit changes before testing reverting of directory rename,
243
-## otherwise there're could be sequencing issues
239
+## otherwise there could be sequencing issues
244240
fossil redo
245241
fossil commit -m "4-5:setup"
246242
247243
fossil mv --soft d dnew
248244
revert-test 4-5 {d/f1 d/f2 d/f3 d/f4} {
@@ -295,11 +291,11 @@
295291
} -addremove {
296292
ADDED d/f1
297293
} -exists {f0 d/f1 d/f2 d/f3}
298294
299295
## Commit changes before testing the revert of directory rename,
300
-## otherwise there're could be sequencing issues
296
+## otherwise there could be sequencing issues
301297
fossil commit -m "5-3:setup"
302298
303299
fossil changes
304300
305301
fossil mv --soft d dnew
306302
--- test/revert.test
+++ test/revert.test
@@ -67,19 +67,15 @@
67 fossil add f1 f2 f3
68 fossil commit -m "c1"
69
70 # Make changes to be reverted
71 #
72 # Add f0
73 write_file f0 "f0"
74 fossil add f0
75 # Remove f1
76 file delete f1
77 fossil rm f1
78 # Edit f2
79 write_file f2 "f2.1"
80 # Rename f3 to f3n
81 file rename -force f3 f3n
82 fossil mv f3 f3n
83
84 # Test 'fossil revert' with no arguments
85 #
@@ -238,11 +234,11 @@
238 EDITED d/f2
239 DELETED d/f3
240 } -exists {d/f4} -notexists {d/f4new}
241
242 ## Commit changes before testing reverting of directory rename,
243 ## otherwise there're could be sequencing issues
244 fossil redo
245 fossil commit -m "4-5:setup"
246
247 fossil mv --soft d dnew
248 revert-test 4-5 {d/f1 d/f2 d/f3 d/f4} {
@@ -295,11 +291,11 @@
295 } -addremove {
296 ADDED d/f1
297 } -exists {f0 d/f1 d/f2 d/f3}
298
299 ## Commit changes before testing the revert of directory rename,
300 ## otherwise there're could be sequencing issues
301 fossil commit -m "5-3:setup"
302
303 fossil changes
304
305 fossil mv --soft d dnew
306
--- test/revert.test
+++ test/revert.test
@@ -67,19 +67,15 @@
67 fossil add f1 f2 f3
68 fossil commit -m "c1"
69
70 # Make changes to be reverted
71 #
 
72 write_file f0 "f0"
73 fossil add f0
 
74 file delete f1
75 fossil rm f1
 
76 write_file f2 "f2.1"
 
77 file rename -force f3 f3n
78 fossil mv f3 f3n
79
80 # Test 'fossil revert' with no arguments
81 #
@@ -238,11 +234,11 @@
234 EDITED d/f2
235 DELETED d/f3
236 } -exists {d/f4} -notexists {d/f4new}
237
238 ## Commit changes before testing reverting of directory rename,
239 ## otherwise there could be sequencing issues
240 fossil redo
241 fossil commit -m "4-5:setup"
242
243 fossil mv --soft d dnew
244 revert-test 4-5 {d/f1 d/f2 d/f3 d/f4} {
@@ -295,11 +291,11 @@
291 } -addremove {
292 ADDED d/f1
293 } -exists {f0 d/f1 d/f2 d/f3}
294
295 ## Commit changes before testing the revert of directory rename,
296 ## otherwise there could be sequencing issues
297 fossil commit -m "5-3:setup"
298
299 fossil changes
300
301 fossil mv --soft d dnew
302
--- test/rewrite-test-output.tcl
+++ test/rewrite-test-output.tcl
@@ -326,11 +326,11 @@
326326
{^Z [0-9a-f]{32}$}
327327
{Z CHECKSUM}
328328
}
329329
330330
#
331
-# Some pattersn are used in multiple groups
331
+# Some patterns are used in multiple groups
332332
#
333333
334334
set testnames {"th1" "th1-docs" "th1-hooks"}
335335
set pat {^((?:ERROR \(1\): )?/[*]{5} Subprocess) \d+ (exit)}
336336
set sub {\1 PID \2}
@@ -381,11 +381,11 @@
381381
set symlinks_lines [list]
382382
set symlinks_failed 0
383383
set test_simplify_name_lines [list]
384384
set test_simplify_name_failed 0
385385
386
-# State information s we progress
386
+# State information as we progress
387387
set check_json_empty_line 0
388388
set lineno 0
389389
set platform $UNKOWN_PLATFORM
390390
set prev_line ""
391391
set testname ""
@@ -511,11 +511,11 @@
511511
if { [regexp {^(micro-smile|pale facepalm) .*} $line match desc] } {
512512
set line "$desc PLATFORM_SPECIFIC_BYTES"
513513
}
514514
} elseif { $testname eq "file1" } {
515515
# test-simplify-name with question marks is specific to Windows
516
- # They all immediately preceed "fossil test-relative-name --chdir . ."
516
+ # They all immediately precede "fossil test-relative-name --chdir . ."
517517
if { $line eq "fossil test-relative-name --chdir . ." } {
518518
if { $test_simplify_name_failed } {
519519
foreach l $test_simplify_name_lines {
520520
puts "$l"
521521
}
522522
--- test/rewrite-test-output.tcl
+++ test/rewrite-test-output.tcl
@@ -326,11 +326,11 @@
326 {^Z [0-9a-f]{32}$}
327 {Z CHECKSUM}
328 }
329
330 #
331 # Some pattersn are used in multiple groups
332 #
333
334 set testnames {"th1" "th1-docs" "th1-hooks"}
335 set pat {^((?:ERROR \(1\): )?/[*]{5} Subprocess) \d+ (exit)}
336 set sub {\1 PID \2}
@@ -381,11 +381,11 @@
381 set symlinks_lines [list]
382 set symlinks_failed 0
383 set test_simplify_name_lines [list]
384 set test_simplify_name_failed 0
385
386 # State information s we progress
387 set check_json_empty_line 0
388 set lineno 0
389 set platform $UNKOWN_PLATFORM
390 set prev_line ""
391 set testname ""
@@ -511,11 +511,11 @@
511 if { [regexp {^(micro-smile|pale facepalm) .*} $line match desc] } {
512 set line "$desc PLATFORM_SPECIFIC_BYTES"
513 }
514 } elseif { $testname eq "file1" } {
515 # test-simplify-name with question marks is specific to Windows
516 # They all immediately preceed "fossil test-relative-name --chdir . ."
517 if { $line eq "fossil test-relative-name --chdir . ." } {
518 if { $test_simplify_name_failed } {
519 foreach l $test_simplify_name_lines {
520 puts "$l"
521 }
522
--- test/rewrite-test-output.tcl
+++ test/rewrite-test-output.tcl
@@ -326,11 +326,11 @@
326 {^Z [0-9a-f]{32}$}
327 {Z CHECKSUM}
328 }
329
330 #
331 # Some patterns are used in multiple groups
332 #
333
334 set testnames {"th1" "th1-docs" "th1-hooks"}
335 set pat {^((?:ERROR \(1\): )?/[*]{5} Subprocess) \d+ (exit)}
336 set sub {\1 PID \2}
@@ -381,11 +381,11 @@
381 set symlinks_lines [list]
382 set symlinks_failed 0
383 set test_simplify_name_lines [list]
384 set test_simplify_name_failed 0
385
386 # State information as we progress
387 set check_json_empty_line 0
388 set lineno 0
389 set platform $UNKOWN_PLATFORM
390 set prev_line ""
391 set testname ""
@@ -511,11 +511,11 @@
511 if { [regexp {^(micro-smile|pale facepalm) .*} $line match desc] } {
512 set line "$desc PLATFORM_SPECIFIC_BYTES"
513 }
514 } elseif { $testname eq "file1" } {
515 # test-simplify-name with question marks is specific to Windows
516 # They all immediately precede "fossil test-relative-name --chdir . ."
517 if { $line eq "fossil test-relative-name --chdir . ." } {
518 if { $test_simplify_name_failed } {
519 foreach l $test_simplify_name_lines {
520 puts "$l"
521 }
522
--- test/set-manifest.test
+++ test/set-manifest.test
@@ -46,11 +46,12 @@
4646
set truths [list true on 1]
4747
foreach v $truths {
4848
fossil settings manifest $v
4949
test "set-manifest-2-$v" {$RESULT eq ""}
5050
fossil settings manifest
51
- test "set-manifest-2-$v-a" {[regexp "^manifest\\s+\\(local\\)\\s+$v\\s*$" $RESULT]}
51
+ test "set-manifest-2-$v-a" \
52
+ {[regexp "^manifest\\s+\\(local\\)\\s+$v\\s*$" $RESULT]}
5253
set filelist [lsort [glob manifest*]]
5354
test "set-manifest-2-$v-n" {[llength $filelist] == 2}
5455
foreach f $filelist {
5556
test "set-manifest-2-$v-f-$f" {[file isfile $f]}
5657
}
@@ -61,28 +62,19 @@
6162
regexp {(?m)^checkout:\s+([0-9a-f]{40,64})\s.*$} $RESULT ckoutline ckid
6263
set uuid [string trim [read_file "manifest.uuid"]]
6364
test "set-manifest-2-uuid" {[same_uuid $ckid $uuid]}
6465
6566
66
-# ... which is also the SHA1 of the file "manifest" before it was
67
-# sterilized by appending an extra line when writing the file. The
68
-# extra text begins with # and is a full line, so we'll just strip
69
-# it with a brute-force substitution. This probably has the right
70
-# effect even if the checkin was PGP-signed, but we don't have that
71
-# setting turned on for this manifest in any case.
72
-#regsub {(?m)^#.*\n} [read_file "manifest"] "" manifest
73
-#set muuid [::sha1::sha1 $manifest]
74
-#test "set-manifest-2-manifest" {[same_uuid $muuid $uuid]}
75
-
7667
7768
# Classic behavior: FALSE value removes manifest and manifest.uuid
7869
set falses [list false off 0]
7970
foreach v $falses {
8071
fossil settings manifest $v
8172
test "set-manifest-3-$v" {$RESULT eq ""}
8273
fossil settings manifest
83
- test "set-manifest-3-$v-a" {[regexp "^manifest\\s+\\(local\\)\\s+$v\\s*$" $RESULT]}
74
+ test "set-manifest-3-$v-a" \
75
+ {[regexp "^manifest\\s+\\(local\\)\\s+$v\\s*$" $RESULT]}
8476
set filelist [lsort [glob -nocomplain manifest*]]
8577
test "set-manifest-3-$v-n" {[llength $filelist] == 0}
8678
}
8779
8880
@@ -102,11 +94,12 @@
10294
set truths [list r u t ru ut rt rut]
10395
foreach v $truths {
10496
fossil settings manifest $v
10597
test "set-manifest-5-$v" {$RESULT eq ""}
10698
fossil settings manifest
107
- test "set-manifest-5-$v-a" {[regexp "^manifest\\s+\\(local\\)\\s+$v\\s*$" $RESULT]}
99
+ test "set-manifest-5-$v-a" \
100
+ {[regexp "^manifest\\s+\\(local\\)\\s+$v\\s*$" $RESULT]}
108101
set filelist [lsort [glob manifest*]]
109102
test "set-manifest-5-$v-n" {[llength $filelist] == [string length $v]}
110103
foreach f $filelist {
111104
test "set-manifest-5-$v-f-$f" {[file isfile $f]}
112105
}
@@ -122,25 +115,29 @@
122115
fossil set manifest t
123116
test "set-manifest-7-1" {[file isfile manifest.tags]}
124117
125118
# Add a tag and make sure it appears in manifest.tags
126119
fossil tag add manifest-7-tag-1 tip
127
-test "set-manifest-7-2" {[file_contains "manifest.tags" "^tag manifest-7-tag-1$"]}
120
+test "set-manifest-7-2" {[file_contains "manifest.tags" \
121
+ "^tag manifest-7-tag-1$"]}
128122
129123
# Add a file and make sure tag has disappeared from manifest.tags
130124
commit_file file1 "file1 contents" "Added file1."
131
-test "set-manifest-7-3" {![file_contains "manifest.tags" "^tag manifest-7-tag-1$"]}
125
+test "set-manifest-7-3" {![file_contains "manifest.tags" \
126
+ "^tag manifest-7-tag-1$"]}
132127
133128
# Add new tag and check that it is in manifest.tags
134129
fossil tag add manifest-7-tag-2 tip
135
-test "set-manifest-7-4" {[file_contains "manifest.tags" "^tag manifest-7-tag-2$"]}
130
+test "set-manifest-7-4" {[file_contains "manifest.tags" \
131
+ "^tag manifest-7-tag-2$"]}
136132
137133
138134
##### Tags manifest branch= updates
139135
140136
# Add file, create new branch on commit and check that
141137
# manifest.tags has been updated appropriately
142138
commit_file file3 "file3 contents" "Added file3." --branch manifest-8-branch
143
-test "set-manifest-8" {[file_contains "manifest.tags" "^branch manifest-8-branch$"]}
139
+test "set-manifest-8" {[file_contains "manifest.tags" \
140
+ "^branch manifest-8-branch$"]}
144141
145142
146143
test_cleanup
147144
--- test/set-manifest.test
+++ test/set-manifest.test
@@ -46,11 +46,12 @@
46 set truths [list true on 1]
47 foreach v $truths {
48 fossil settings manifest $v
49 test "set-manifest-2-$v" {$RESULT eq ""}
50 fossil settings manifest
51 test "set-manifest-2-$v-a" {[regexp "^manifest\\s+\\(local\\)\\s+$v\\s*$" $RESULT]}
 
52 set filelist [lsort [glob manifest*]]
53 test "set-manifest-2-$v-n" {[llength $filelist] == 2}
54 foreach f $filelist {
55 test "set-manifest-2-$v-f-$f" {[file isfile $f]}
56 }
@@ -61,28 +62,19 @@
61 regexp {(?m)^checkout:\s+([0-9a-f]{40,64})\s.*$} $RESULT ckoutline ckid
62 set uuid [string trim [read_file "manifest.uuid"]]
63 test "set-manifest-2-uuid" {[same_uuid $ckid $uuid]}
64
65
66 # ... which is also the SHA1 of the file "manifest" before it was
67 # sterilized by appending an extra line when writing the file. The
68 # extra text begins with # and is a full line, so we'll just strip
69 # it with a brute-force substitution. This probably has the right
70 # effect even if the checkin was PGP-signed, but we don't have that
71 # setting turned on for this manifest in any case.
72 #regsub {(?m)^#.*\n} [read_file "manifest"] "" manifest
73 #set muuid [::sha1::sha1 $manifest]
74 #test "set-manifest-2-manifest" {[same_uuid $muuid $uuid]}
75
76
77 # Classic behavior: FALSE value removes manifest and manifest.uuid
78 set falses [list false off 0]
79 foreach v $falses {
80 fossil settings manifest $v
81 test "set-manifest-3-$v" {$RESULT eq ""}
82 fossil settings manifest
83 test "set-manifest-3-$v-a" {[regexp "^manifest\\s+\\(local\\)\\s+$v\\s*$" $RESULT]}
 
84 set filelist [lsort [glob -nocomplain manifest*]]
85 test "set-manifest-3-$v-n" {[llength $filelist] == 0}
86 }
87
88
@@ -102,11 +94,12 @@
102 set truths [list r u t ru ut rt rut]
103 foreach v $truths {
104 fossil settings manifest $v
105 test "set-manifest-5-$v" {$RESULT eq ""}
106 fossil settings manifest
107 test "set-manifest-5-$v-a" {[regexp "^manifest\\s+\\(local\\)\\s+$v\\s*$" $RESULT]}
 
108 set filelist [lsort [glob manifest*]]
109 test "set-manifest-5-$v-n" {[llength $filelist] == [string length $v]}
110 foreach f $filelist {
111 test "set-manifest-5-$v-f-$f" {[file isfile $f]}
112 }
@@ -122,25 +115,29 @@
122 fossil set manifest t
123 test "set-manifest-7-1" {[file isfile manifest.tags]}
124
125 # Add a tag and make sure it appears in manifest.tags
126 fossil tag add manifest-7-tag-1 tip
127 test "set-manifest-7-2" {[file_contains "manifest.tags" "^tag manifest-7-tag-1$"]}
 
128
129 # Add a file and make sure tag has disappeared from manifest.tags
130 commit_file file1 "file1 contents" "Added file1."
131 test "set-manifest-7-3" {![file_contains "manifest.tags" "^tag manifest-7-tag-1$"]}
 
132
133 # Add new tag and check that it is in manifest.tags
134 fossil tag add manifest-7-tag-2 tip
135 test "set-manifest-7-4" {[file_contains "manifest.tags" "^tag manifest-7-tag-2$"]}
 
136
137
138 ##### Tags manifest branch= updates
139
140 # Add file, create new branch on commit and check that
141 # manifest.tags has been updated appropriately
142 commit_file file3 "file3 contents" "Added file3." --branch manifest-8-branch
143 test "set-manifest-8" {[file_contains "manifest.tags" "^branch manifest-8-branch$"]}
 
144
145
146 test_cleanup
147
--- test/set-manifest.test
+++ test/set-manifest.test
@@ -46,11 +46,12 @@
46 set truths [list true on 1]
47 foreach v $truths {
48 fossil settings manifest $v
49 test "set-manifest-2-$v" {$RESULT eq ""}
50 fossil settings manifest
51 test "set-manifest-2-$v-a" \
52 {[regexp "^manifest\\s+\\(local\\)\\s+$v\\s*$" $RESULT]}
53 set filelist [lsort [glob manifest*]]
54 test "set-manifest-2-$v-n" {[llength $filelist] == 2}
55 foreach f $filelist {
56 test "set-manifest-2-$v-f-$f" {[file isfile $f]}
57 }
@@ -61,28 +62,19 @@
62 regexp {(?m)^checkout:\s+([0-9a-f]{40,64})\s.*$} $RESULT ckoutline ckid
63 set uuid [string trim [read_file "manifest.uuid"]]
64 test "set-manifest-2-uuid" {[same_uuid $ckid $uuid]}
65
66
 
 
 
 
 
 
 
 
 
 
67
68 # Classic behavior: FALSE value removes manifest and manifest.uuid
69 set falses [list false off 0]
70 foreach v $falses {
71 fossil settings manifest $v
72 test "set-manifest-3-$v" {$RESULT eq ""}
73 fossil settings manifest
74 test "set-manifest-3-$v-a" \
75 {[regexp "^manifest\\s+\\(local\\)\\s+$v\\s*$" $RESULT]}
76 set filelist [lsort [glob -nocomplain manifest*]]
77 test "set-manifest-3-$v-n" {[llength $filelist] == 0}
78 }
79
80
@@ -102,11 +94,12 @@
94 set truths [list r u t ru ut rt rut]
95 foreach v $truths {
96 fossil settings manifest $v
97 test "set-manifest-5-$v" {$RESULT eq ""}
98 fossil settings manifest
99 test "set-manifest-5-$v-a" \
100 {[regexp "^manifest\\s+\\(local\\)\\s+$v\\s*$" $RESULT]}
101 set filelist [lsort [glob manifest*]]
102 test "set-manifest-5-$v-n" {[llength $filelist] == [string length $v]}
103 foreach f $filelist {
104 test "set-manifest-5-$v-f-$f" {[file isfile $f]}
105 }
@@ -122,25 +115,29 @@
115 fossil set manifest t
116 test "set-manifest-7-1" {[file isfile manifest.tags]}
117
118 # Add a tag and make sure it appears in manifest.tags
119 fossil tag add manifest-7-tag-1 tip
120 test "set-manifest-7-2" {[file_contains "manifest.tags" \
121 "^tag manifest-7-tag-1$"]}
122
123 # Add a file and make sure tag has disappeared from manifest.tags
124 commit_file file1 "file1 contents" "Added file1."
125 test "set-manifest-7-3" {![file_contains "manifest.tags" \
126 "^tag manifest-7-tag-1$"]}
127
128 # Add new tag and check that it is in manifest.tags
129 fossil tag add manifest-7-tag-2 tip
130 test "set-manifest-7-4" {[file_contains "manifest.tags" \
131 "^tag manifest-7-tag-2$"]}
132
133
134 ##### Tags manifest branch= updates
135
136 # Add file, create new branch on commit and check that
137 # manifest.tags has been updated appropriately
138 commit_file file3 "file3 contents" "Added file3." --branch manifest-8-branch
139 test "set-manifest-8" {[file_contains "manifest.tags" \
140 "^branch manifest-8-branch$"]}
141
142
143 test_cleanup
144
+8 -25
--- test/stash.test
+++ test/stash.test
@@ -61,11 +61,12 @@
6161
test $testid-CODE {!$code} [knownBug "-code" $knownbugs]
6262
if {$code} {
6363
return
6464
}
6565
}
66
- test_status_list $testid $result $expectedOutput [knownBug "-result" $knownbugs]
66
+ test_status_list $testid $result $expectedOutput \
67
+ [knownBug "-result" $knownbugs]
6768
6869
set statusListTests [list -changes changes -addremove {addremove -n}]
6970
foreach {key fossilArgs} $statusListTests {
7071
set expected [dict get $args $key]
7172
set result [fossil {*}$fossilArgs]
@@ -81,17 +82,16 @@
8182
protOut " Failure: File $verb not exist: $path"
8283
}
8384
}
8485
test $testid$key $passed [knownBug $key $knownbugs]
8586
}
86
-
87
- #fossil undo
8887
}
8988
9089
proc stash-test {testid stashArgs expectedStashOutput args} {
9190
fossil stash {*}$stashArgs
92
- return [test_result_state stash-$testid "stash $stashArgs" $expectedStashOutput {*}$args]
91
+ return [test_result_state stash-$testid "stash $stashArgs" \
92
+ $expectedStashOutput {*}$args]
9393
}
9494
9595
require_no_open_checkout
9696
test_setup
9797
@@ -131,13 +131,10 @@
131131
########
132132
# fossil stash list|ls ?-v|--verbose? ?-W|--width <num>?
133133
134134
# Confirm there is a stash saved
135135
fossil stash list
136
-#protOut "{[normalize_result]}"
137
-#{1: [21bc64cff8c702] on 2016-02-10 19:48:44
138
-# stash 1}
139136
test stash-1-list-1 {[regexp {^1: \[[0-9a-z]+\] on } [first_data_line]]}
140137
test stash-1-list-2 {[regexp {^\s+stash 1\s*$} [second_data_line]]}
141138
142139
set diff_stash_1 {DELETE f1
143140
Index: f1
@@ -168,15 +165,10 @@
168165
169166
########
170167
# fossil stash show|cat ?STASHID? ?DIFF-OPTIONS?
171168
# fossil stash [g]diff ?STASHID? ?DIFF-OPTIONS?
172169
173
-#fossil stash show
174
-#test stash-1-show {[normalize_result] eq $diff_stash_1}
175
-#fossil stash diff
176
-#test stash-1-diff {[normalize_result] eq $diff_stash_1} knownBug
177
-
178170
########
179171
# fossil stash pop
180172
181173
stash-test 2 pop {
182174
DELETE f1
@@ -192,11 +184,11 @@
192184
DELETED f1
193185
} -exists {f0 f2 f3n} -notexists {f1 f3}
194186
195187
# Confirm there is no longer a stash saved
196188
fossil stash list
197
-test stash-2-list {[first_data_line] eq "empty stash"}
189
+test_eq stash-2-list [first_data_line] "empty stash"
198190
199191
200192
# Test stashed mv without touching the file system
201193
# Issue reported by email to fossil-users
202194
# from Warren Young, dated Tue, 9 Feb 2016 01:22:54 -0700
@@ -206,16 +198,10 @@
206198
# fossil: ./src/delta.c:231: checksum: Assertion '...' failed.
207199
# Should be triggered by this stash-WY-1 test.
208200
fossil checkout --force c1
209201
fossil clean
210202
fossil mv --soft f1 f1new
211
-#stash-test WY-1 {-expectError save -m "Reported 2016-02-09"} {
212
-# REVERT f1
213
-# DELETE f1new
214
-#} -changes {
215
-#} -addremove {
216
-#} -exists {f1 f2 f3} -notexists {f1new} -knownbugs {-code -result}
217203
# TODO: add tests that verify the saved stash is sensible. Possibly
218204
# by applying it and checking results. But until the SQLITE_CONSTRAINT
219205
# error is fixed, there is nothing stashed to test.
220206
221207
@@ -257,19 +243,19 @@
257243
stash-test 3-1 {save -m f3} {
258244
UNMANAGE f3
259245
} -addremove {
260246
ADDED f3
261247
} -exists {f1 f2 f3} -notexists {}
262
-#fossil status
263248
fossil stash show
264
-test stash-3-1-show {[normalize_result] eq "ADDED f3
249
+test_eq stash-3-1-show [normalize_result] \
250
+ "ADDED f3
265251
Index: f3
266252
==================================================================
267253
--- /dev/null\t
268254
+++ f3\t
269255
@@ -0,0 +1,1 @@
270
-+f3"}
256
++f3"
271257
stash-test 3-1-pop {pop} {
272258
ADDED f3
273259
} -changes {
274260
ADDED f3
275261
} -addremove {
@@ -381,11 +367,8 @@
381367
382368
# fossil stash apply ?STASHID?
383369
# fossil stash goto ?STASHID?
384370
# fossil stash rm|drop ?STASHID? ?-a|--all?
385371
386
-#fossil checkout --force c1
387
-#fossil clean
388
-
389372
###############################################################################
390373
391374
test_cleanup
392375
--- test/stash.test
+++ test/stash.test
@@ -61,11 +61,12 @@
61 test $testid-CODE {!$code} [knownBug "-code" $knownbugs]
62 if {$code} {
63 return
64 }
65 }
66 test_status_list $testid $result $expectedOutput [knownBug "-result" $knownbugs]
 
67
68 set statusListTests [list -changes changes -addremove {addremove -n}]
69 foreach {key fossilArgs} $statusListTests {
70 set expected [dict get $args $key]
71 set result [fossil {*}$fossilArgs]
@@ -81,17 +82,16 @@
81 protOut " Failure: File $verb not exist: $path"
82 }
83 }
84 test $testid$key $passed [knownBug $key $knownbugs]
85 }
86
87 #fossil undo
88 }
89
90 proc stash-test {testid stashArgs expectedStashOutput args} {
91 fossil stash {*}$stashArgs
92 return [test_result_state stash-$testid "stash $stashArgs" $expectedStashOutput {*}$args]
 
93 }
94
95 require_no_open_checkout
96 test_setup
97
@@ -131,13 +131,10 @@
131 ########
132 # fossil stash list|ls ?-v|--verbose? ?-W|--width <num>?
133
134 # Confirm there is a stash saved
135 fossil stash list
136 #protOut "{[normalize_result]}"
137 #{1: [21bc64cff8c702] on 2016-02-10 19:48:44
138 # stash 1}
139 test stash-1-list-1 {[regexp {^1: \[[0-9a-z]+\] on } [first_data_line]]}
140 test stash-1-list-2 {[regexp {^\s+stash 1\s*$} [second_data_line]]}
141
142 set diff_stash_1 {DELETE f1
143 Index: f1
@@ -168,15 +165,10 @@
168
169 ########
170 # fossil stash show|cat ?STASHID? ?DIFF-OPTIONS?
171 # fossil stash [g]diff ?STASHID? ?DIFF-OPTIONS?
172
173 #fossil stash show
174 #test stash-1-show {[normalize_result] eq $diff_stash_1}
175 #fossil stash diff
176 #test stash-1-diff {[normalize_result] eq $diff_stash_1} knownBug
177
178 ########
179 # fossil stash pop
180
181 stash-test 2 pop {
182 DELETE f1
@@ -192,11 +184,11 @@
192 DELETED f1
193 } -exists {f0 f2 f3n} -notexists {f1 f3}
194
195 # Confirm there is no longer a stash saved
196 fossil stash list
197 test stash-2-list {[first_data_line] eq "empty stash"}
198
199
200 # Test stashed mv without touching the file system
201 # Issue reported by email to fossil-users
202 # from Warren Young, dated Tue, 9 Feb 2016 01:22:54 -0700
@@ -206,16 +198,10 @@
206 # fossil: ./src/delta.c:231: checksum: Assertion '...' failed.
207 # Should be triggered by this stash-WY-1 test.
208 fossil checkout --force c1
209 fossil clean
210 fossil mv --soft f1 f1new
211 #stash-test WY-1 {-expectError save -m "Reported 2016-02-09"} {
212 # REVERT f1
213 # DELETE f1new
214 #} -changes {
215 #} -addremove {
216 #} -exists {f1 f2 f3} -notexists {f1new} -knownbugs {-code -result}
217 # TODO: add tests that verify the saved stash is sensible. Possibly
218 # by applying it and checking results. But until the SQLITE_CONSTRAINT
219 # error is fixed, there is nothing stashed to test.
220
221
@@ -257,19 +243,19 @@
257 stash-test 3-1 {save -m f3} {
258 UNMANAGE f3
259 } -addremove {
260 ADDED f3
261 } -exists {f1 f2 f3} -notexists {}
262 #fossil status
263 fossil stash show
264 test stash-3-1-show {[normalize_result] eq "ADDED f3
 
265 Index: f3
266 ==================================================================
267 --- /dev/null\t
268 +++ f3\t
269 @@ -0,0 +1,1 @@
270 +f3"}
271 stash-test 3-1-pop {pop} {
272 ADDED f3
273 } -changes {
274 ADDED f3
275 } -addremove {
@@ -381,11 +367,8 @@
381
382 # fossil stash apply ?STASHID?
383 # fossil stash goto ?STASHID?
384 # fossil stash rm|drop ?STASHID? ?-a|--all?
385
386 #fossil checkout --force c1
387 #fossil clean
388
389 ###############################################################################
390
391 test_cleanup
392
--- test/stash.test
+++ test/stash.test
@@ -61,11 +61,12 @@
61 test $testid-CODE {!$code} [knownBug "-code" $knownbugs]
62 if {$code} {
63 return
64 }
65 }
66 test_status_list $testid $result $expectedOutput \
67 [knownBug "-result" $knownbugs]
68
69 set statusListTests [list -changes changes -addremove {addremove -n}]
70 foreach {key fossilArgs} $statusListTests {
71 set expected [dict get $args $key]
72 set result [fossil {*}$fossilArgs]
@@ -81,17 +82,16 @@
82 protOut " Failure: File $verb not exist: $path"
83 }
84 }
85 test $testid$key $passed [knownBug $key $knownbugs]
86 }
 
 
87 }
88
89 proc stash-test {testid stashArgs expectedStashOutput args} {
90 fossil stash {*}$stashArgs
91 return [test_result_state stash-$testid "stash $stashArgs" \
92 $expectedStashOutput {*}$args]
93 }
94
95 require_no_open_checkout
96 test_setup
97
@@ -131,13 +131,10 @@
131 ########
132 # fossil stash list|ls ?-v|--verbose? ?-W|--width <num>?
133
134 # Confirm there is a stash saved
135 fossil stash list
 
 
 
136 test stash-1-list-1 {[regexp {^1: \[[0-9a-z]+\] on } [first_data_line]]}
137 test stash-1-list-2 {[regexp {^\s+stash 1\s*$} [second_data_line]]}
138
139 set diff_stash_1 {DELETE f1
140 Index: f1
@@ -168,15 +165,10 @@
165
166 ########
167 # fossil stash show|cat ?STASHID? ?DIFF-OPTIONS?
168 # fossil stash [g]diff ?STASHID? ?DIFF-OPTIONS?
169
 
 
 
 
 
170 ########
171 # fossil stash pop
172
173 stash-test 2 pop {
174 DELETE f1
@@ -192,11 +184,11 @@
184 DELETED f1
185 } -exists {f0 f2 f3n} -notexists {f1 f3}
186
187 # Confirm there is no longer a stash saved
188 fossil stash list
189 test_eq stash-2-list [first_data_line] "empty stash"
190
191
192 # Test stashed mv without touching the file system
193 # Issue reported by email to fossil-users
194 # from Warren Young, dated Tue, 9 Feb 2016 01:22:54 -0700
@@ -206,16 +198,10 @@
198 # fossil: ./src/delta.c:231: checksum: Assertion '...' failed.
199 # Should be triggered by this stash-WY-1 test.
200 fossil checkout --force c1
201 fossil clean
202 fossil mv --soft f1 f1new
 
 
 
 
 
 
203 # TODO: add tests that verify the saved stash is sensible. Possibly
204 # by applying it and checking results. But until the SQLITE_CONSTRAINT
205 # error is fixed, there is nothing stashed to test.
206
207
@@ -257,19 +243,19 @@
243 stash-test 3-1 {save -m f3} {
244 UNMANAGE f3
245 } -addremove {
246 ADDED f3
247 } -exists {f1 f2 f3} -notexists {}
 
248 fossil stash show
249 test_eq stash-3-1-show [normalize_result] \
250 "ADDED f3
251 Index: f3
252 ==================================================================
253 --- /dev/null\t
254 +++ f3\t
255 @@ -0,0 +1,1 @@
256 +f3"
257 stash-test 3-1-pop {pop} {
258 ADDED f3
259 } -changes {
260 ADDED f3
261 } -addremove {
@@ -381,11 +367,8 @@
367
368 # fossil stash apply ?STASHID?
369 # fossil stash goto ?STASHID?
370 # fossil stash rm|drop ?STASHID? ?-a|--all?
371
 
 
 
372 ###############################################################################
373
374 test_cleanup
375
+14 -14
--- test/symlinks.test
+++ test/symlinks.test
@@ -51,14 +51,14 @@
5151
###############################################################################
5252
5353
write_file [file join $rootDir subdirA f1.txt] "f1"
5454
write_file [file join $rootDir subdirA f2.txt] "f2"
5555
56
-test symlinks-dir-1 {[file exists [file join $rootDir subdirA f1.txt]] eq 1}
57
-test symlinks-dir-2 {[file exists [file join $rootDir symdirA f1.txt]] eq 1}
58
-test symlinks-dir-3 {[file exists [file join $rootDir subdirA f2.txt]] eq 1}
59
-test symlinks-dir-4 {[file exists [file join $rootDir symdirA f2.txt]] eq 1}
56
+test_eq symlinks-dir-1 [file exists [file join $rootDir subdirA f1.txt]] 1
57
+test_eq symlinks-dir-2 [file exists [file join $rootDir symdirA f1.txt]] 1
58
+test_eq symlinks-dir-3 [file exists [file join $rootDir subdirA f2.txt]] 1
59
+test_eq symlinks-dir-4 [file exists [file join $rootDir symdirA f2.txt]] 1
6060
6161
fossil add [file join $rootDir symdirA f1.txt]
6262
test symlinks-skip-dir-traversal {[normalize_result] eq \
6363
"SKIP symdirA/f1.txt"}
6464
@@ -68,11 +68,11 @@
6868
"nothing has changed; use --allow-empty to override"}
6969
7070
###############################################################################
7171
7272
fossil ls
73
-test symlinks-dir-5 {[normalize_result] eq ""}
73
+test_eq symlinks-dir-5 [normalize_result] ""
7474
7575
###############################################################################
7676
7777
fossil extras
7878
test symlinks-dir-6 {[normalize_result] eq \
@@ -81,30 +81,30 @@
8181
###############################################################################
8282
8383
fossil close
8484
file delete [file join $rootDir subdirA f1.txt]
8585
86
-test symlinks-dir-7 {[file exists [file join $rootDir subdirA f1.txt]] eq 0}
87
-test symlinks-dir-8 {[file exists [file join $rootDir symdirA f1.txt]] eq 0}
88
-test symlinks-dir-9 {[file exists [file join $rootDir subdirA f2.txt]] eq 1}
89
-test symlinks-dir-10 {[file exists [file join $rootDir symdirA f2.txt]] eq 1}
86
+test_eq symlinks-dir-7 [file exists [file join $rootDir subdirA f1.txt]] 0
87
+test_eq symlinks-dir-8 [file exists [file join $rootDir symdirA f1.txt]] 0
88
+test_eq symlinks-dir-9 [file exists [file join $rootDir subdirA f2.txt]] 1
89
+test_eq symlinks-dir-10 [file exists [file join $rootDir symdirA f2.txt]] 1
9090
9191
###############################################################################
9292
9393
fossil open --force $repository
9494
set code [catch {file readlink [file join $rootDir symdirA]} result]
9595
9696
test symlinks-dir-11 {$code == 0}
97
-test symlinks-dir-12 {$result eq [file join $rootDir subdirA]}
98
-test symlinks-dir-13 {[file exists [file join $rootDir subdirA f1.txt]] eq 0}
99
-test symlinks-dir-14 {[file exists [file join $rootDir symdirA f1.txt]] eq 0}
100
-test symlinks-dir-15 {[file exists [file join $rootDir subdirA f2.txt]] eq 1}
101
-test symlinks-dir-16 {[file exists [file join $rootDir symdirA f2.txt]] eq 1}
97
+test_eq symlinks-dir-12 $result [file join $rootDir subdirA]
98
+test_eq symlinks-dir-13 [file exists [file join $rootDir subdirA f1.txt]] 0
99
+test_eq symlinks-dir-14 [file exists [file join $rootDir symdirA f1.txt]] 0
100
+test_eq symlinks-dir-15 [file exists [file join $rootDir subdirA f2.txt]] 1
101
+test_eq symlinks-dir-16 [file exists [file join $rootDir symdirA f2.txt]] 1
102102
103103
###############################################################################
104104
#
105105
# TODO: Add tests for symbolic links as files here, including tests with the
106106
# "allow-symlinks" setting on and off.
107107
#
108108
###############################################################################
109109
110110
test_cleanup
111111
--- test/symlinks.test
+++ test/symlinks.test
@@ -51,14 +51,14 @@
51 ###############################################################################
52
53 write_file [file join $rootDir subdirA f1.txt] "f1"
54 write_file [file join $rootDir subdirA f2.txt] "f2"
55
56 test symlinks-dir-1 {[file exists [file join $rootDir subdirA f1.txt]] eq 1}
57 test symlinks-dir-2 {[file exists [file join $rootDir symdirA f1.txt]] eq 1}
58 test symlinks-dir-3 {[file exists [file join $rootDir subdirA f2.txt]] eq 1}
59 test symlinks-dir-4 {[file exists [file join $rootDir symdirA f2.txt]] eq 1}
60
61 fossil add [file join $rootDir symdirA f1.txt]
62 test symlinks-skip-dir-traversal {[normalize_result] eq \
63 "SKIP symdirA/f1.txt"}
64
@@ -68,11 +68,11 @@
68 "nothing has changed; use --allow-empty to override"}
69
70 ###############################################################################
71
72 fossil ls
73 test symlinks-dir-5 {[normalize_result] eq ""}
74
75 ###############################################################################
76
77 fossil extras
78 test symlinks-dir-6 {[normalize_result] eq \
@@ -81,30 +81,30 @@
81 ###############################################################################
82
83 fossil close
84 file delete [file join $rootDir subdirA f1.txt]
85
86 test symlinks-dir-7 {[file exists [file join $rootDir subdirA f1.txt]] eq 0}
87 test symlinks-dir-8 {[file exists [file join $rootDir symdirA f1.txt]] eq 0}
88 test symlinks-dir-9 {[file exists [file join $rootDir subdirA f2.txt]] eq 1}
89 test symlinks-dir-10 {[file exists [file join $rootDir symdirA f2.txt]] eq 1}
90
91 ###############################################################################
92
93 fossil open --force $repository
94 set code [catch {file readlink [file join $rootDir symdirA]} result]
95
96 test symlinks-dir-11 {$code == 0}
97 test symlinks-dir-12 {$result eq [file join $rootDir subdirA]}
98 test symlinks-dir-13 {[file exists [file join $rootDir subdirA f1.txt]] eq 0}
99 test symlinks-dir-14 {[file exists [file join $rootDir symdirA f1.txt]] eq 0}
100 test symlinks-dir-15 {[file exists [file join $rootDir subdirA f2.txt]] eq 1}
101 test symlinks-dir-16 {[file exists [file join $rootDir symdirA f2.txt]] eq 1}
102
103 ###############################################################################
104 #
105 # TODO: Add tests for symbolic links as files here, including tests with the
106 # "allow-symlinks" setting on and off.
107 #
108 ###############################################################################
109
110 test_cleanup
111
--- test/symlinks.test
+++ test/symlinks.test
@@ -51,14 +51,14 @@
51 ###############################################################################
52
53 write_file [file join $rootDir subdirA f1.txt] "f1"
54 write_file [file join $rootDir subdirA f2.txt] "f2"
55
56 test_eq symlinks-dir-1 [file exists [file join $rootDir subdirA f1.txt]] 1
57 test_eq symlinks-dir-2 [file exists [file join $rootDir symdirA f1.txt]] 1
58 test_eq symlinks-dir-3 [file exists [file join $rootDir subdirA f2.txt]] 1
59 test_eq symlinks-dir-4 [file exists [file join $rootDir symdirA f2.txt]] 1
60
61 fossil add [file join $rootDir symdirA f1.txt]
62 test symlinks-skip-dir-traversal {[normalize_result] eq \
63 "SKIP symdirA/f1.txt"}
64
@@ -68,11 +68,11 @@
68 "nothing has changed; use --allow-empty to override"}
69
70 ###############################################################################
71
72 fossil ls
73 test_eq symlinks-dir-5 [normalize_result] ""
74
75 ###############################################################################
76
77 fossil extras
78 test symlinks-dir-6 {[normalize_result] eq \
@@ -81,30 +81,30 @@
81 ###############################################################################
82
83 fossil close
84 file delete [file join $rootDir subdirA f1.txt]
85
86 test_eq symlinks-dir-7 [file exists [file join $rootDir subdirA f1.txt]] 0
87 test_eq symlinks-dir-8 [file exists [file join $rootDir symdirA f1.txt]] 0
88 test_eq symlinks-dir-9 [file exists [file join $rootDir subdirA f2.txt]] 1
89 test_eq symlinks-dir-10 [file exists [file join $rootDir symdirA f2.txt]] 1
90
91 ###############################################################################
92
93 fossil open --force $repository
94 set code [catch {file readlink [file join $rootDir symdirA]} result]
95
96 test symlinks-dir-11 {$code == 0}
97 test_eq symlinks-dir-12 $result [file join $rootDir subdirA]
98 test_eq symlinks-dir-13 [file exists [file join $rootDir subdirA f1.txt]] 0
99 test_eq symlinks-dir-14 [file exists [file join $rootDir symdirA f1.txt]] 0
100 test_eq symlinks-dir-15 [file exists [file join $rootDir subdirA f2.txt]] 1
101 test_eq symlinks-dir-16 [file exists [file join $rootDir symdirA f2.txt]] 1
102
103 ###############################################################################
104 #
105 # TODO: Add tests for symbolic links as files here, including tests with the
106 # "allow-symlinks" setting on and off.
107 #
108 ###############################################################################
109
110 test_cleanup
111
+64 -5
--- test/tester.tcl
+++ test/tester.tcl
@@ -157,11 +157,12 @@
157157
158158
# write a dict with enough formatting
159159
# to make it human readable
160160
#
161161
proc protOutDict {dict {pattern *}} {
162
- set longest [tcl::mathfunc::max 0 {*}[lmap key [dict keys $dict $pattern] {string length $key}]]
162
+ set longest [tcl::mathfunc::max 0 \
163
+ {*}[lmap key [dict keys $dict $pattern] {string length $key}]]
163164
dict for {key value} $dict {
164165
protOut [format "%-${longest}s = %s" $key $value]
165166
}
166167
}
167168
@@ -344,10 +345,55 @@
344345
return 0
345346
}
346347
}
347348
return 1
348349
}
350
+
351
+# Listens on a port on 127.0.0.1 that the system chooses, and returns
352
+# the port. Calls HANDLER with each connection and the request on it,
353
+# once the whole request has arrived or the client has closed its side,
354
+# and then closes the connection. The request is whole when it has its
355
+# header lines and as many bytes after them as Content-Length says.
356
+#
357
+set testListeners [list]
358
+proc test_listen {handler} {
359
+ set server [socket -server [list test_listen_accept $handler] \
360
+ -myaddr 127.0.0.1 0]
361
+ lappend ::testListeners $server
362
+ return [lindex [fconfigure $server -sockname] 2]
363
+}
364
+
365
+proc test_listen_accept {handler chan address port} {
366
+ fconfigure $chan -translation binary -blocking 0
367
+ set ::testListenRequest($chan) ""
368
+ fileevent $chan readable [list test_listen_receive $handler $chan]
369
+}
370
+
371
+proc test_listen_receive {handler chan} {
372
+ append ::testListenRequest($chan) [read $chan]
373
+ set request $::testListenRequest($chan)
374
+ set end [string first "\r\n\r\n" $request]
375
+ set length 0
376
+ regexp -nocase -line {^content-length:\s*(\d+)} $request -> length
377
+ if {![eof $chan] &&
378
+ ($end < 0 || [string length $request] < $end + 4 + $length)} {
379
+ return
380
+ }
381
+ unset ::testListenRequest($chan)
382
+ fileevent $chan readable {}
383
+ fconfigure $chan -blocking 1
384
+ catch {{*}$handler $chan $request}
385
+ catch {close $chan}
386
+}
387
+
388
+# Closes every server that test_listen has started.
389
+#
390
+proc test_listen_stop {} {
391
+ update
392
+ foreach server $::testListeners {close $server}
393
+ set ::testListeners [list]
394
+}
349395
350396
proc test_standin {name destination} {
351397
file copy -force [file join $::testfiledir standin $name] $destination
352398
file attributes $destination -permissions 0755
353399
return $destination
@@ -627,11 +673,12 @@
627673
# Deletes the temporary repositories that test_setup made for the test
628674
# file SCRIPTNAME, by default the file being sourced.
629675
proc test_cleanup {{scriptName ""}} {
630676
if {$::KEEP} {
631677
# To avoid errors with require_no_open_checkout, cd out of here.
632
- if {[info exists ::tempSavedPwd]} {cd $::tempSavedPwd; unset ::tempSavedPwd}
678
+ if {[info exists ::tempSavedPwd]} \
679
+ {cd $::tempSavedPwd; unset ::tempSavedPwd}
633680
return
634681
}
635682
if {![info exists ::tempRepoPath]} {return}
636683
if {![file exists $::tempRepoPath]} {return}
637684
if {![file isdirectory $::tempRepoPath]} {return}
@@ -1025,10 +1072,22 @@
10251072
}
10261073
10271074
# Test NAME passes if ACTUAL matches the regular expression PATTERN. A
10281075
# failure is reported with the pattern and the actual value.
10291076
#
1077
+# Tests that ACTUAL equals EXPECTED, as test_eq does, and counts the
1078
+# result in the global variable PREFIXPredMet or PREFIXPredUnmet.
1079
+#
1080
+proc test_predict {prefix name actual expected} {
1081
+ if {$actual eq $expected} {
1082
+ incr ::${prefix}PredMet
1083
+ } else {
1084
+ incr ::${prefix}PredUnmet
1085
+ }
1086
+ test_eq $name $actual $expected
1087
+}
1088
+
10301089
proc test_match {name actual pattern {constraints ""}} {
10311090
set detail [concat [list "pattern: $pattern"] \
10321091
[test_value_lines "actual: " $actual]]
10331092
test_report $name [regexp -- $pattern $actual] $constraints $detail
10341093
}
@@ -1180,12 +1239,12 @@
11801239
# requests on TCP port localhost:8081, IPv4 and IPv6". The port is
11811240
# followed by a comma or the end of the line.
11821241
set listening {Listening for [^\n]+ requests on }
11831242
append listening {(?:TCP port )?(?:\S*:)?(\d+)[,\r\n]}
11841243
set port ""
1185
- for {set i 0} {$i < 100 && $port eq ""} {incr i} {
1186
- after 100
1244
+ for {set i 0} {$i < 1000 && $port eq ""} {incr i} {
1245
+ after 10
11871246
set output [read_file $outFileName]
11881247
regexp $listening $output -> port
11891248
}
11901249
if {$port eq ""} {
11911250
test_stop_server $stopArg $pid $outFileName
@@ -1224,11 +1283,11 @@
12241283
if {[catch {
12251284
exec ps -p $pid
12261285
} result] != 0 || ![regexp -- "(?:^$pid| $pid) " $result]} {
12271286
break
12281287
}
1229
- after 1000; # wait a bit...
1288
+ after 10; # wait a bit...
12301289
}
12311290
if {[string length $fileName] > 0} {
12321291
file delete $fileName
12331292
}
12341293
return true
12351294
--- test/tester.tcl
+++ test/tester.tcl
@@ -157,11 +157,12 @@
157
158 # write a dict with enough formatting
159 # to make it human readable
160 #
161 proc protOutDict {dict {pattern *}} {
162 set longest [tcl::mathfunc::max 0 {*}[lmap key [dict keys $dict $pattern] {string length $key}]]
 
163 dict for {key value} $dict {
164 protOut [format "%-${longest}s = %s" $key $value]
165 }
166 }
167
@@ -344,10 +345,55 @@
344 return 0
345 }
346 }
347 return 1
348 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
349
350 proc test_standin {name destination} {
351 file copy -force [file join $::testfiledir standin $name] $destination
352 file attributes $destination -permissions 0755
353 return $destination
@@ -627,11 +673,12 @@
627 # Deletes the temporary repositories that test_setup made for the test
628 # file SCRIPTNAME, by default the file being sourced.
629 proc test_cleanup {{scriptName ""}} {
630 if {$::KEEP} {
631 # To avoid errors with require_no_open_checkout, cd out of here.
632 if {[info exists ::tempSavedPwd]} {cd $::tempSavedPwd; unset ::tempSavedPwd}
 
633 return
634 }
635 if {![info exists ::tempRepoPath]} {return}
636 if {![file exists $::tempRepoPath]} {return}
637 if {![file isdirectory $::tempRepoPath]} {return}
@@ -1025,10 +1072,22 @@
1025 }
1026
1027 # Test NAME passes if ACTUAL matches the regular expression PATTERN. A
1028 # failure is reported with the pattern and the actual value.
1029 #
 
 
 
 
 
 
 
 
 
 
 
 
1030 proc test_match {name actual pattern {constraints ""}} {
1031 set detail [concat [list "pattern: $pattern"] \
1032 [test_value_lines "actual: " $actual]]
1033 test_report $name [regexp -- $pattern $actual] $constraints $detail
1034 }
@@ -1180,12 +1239,12 @@
1180 # requests on TCP port localhost:8081, IPv4 and IPv6". The port is
1181 # followed by a comma or the end of the line.
1182 set listening {Listening for [^\n]+ requests on }
1183 append listening {(?:TCP port )?(?:\S*:)?(\d+)[,\r\n]}
1184 set port ""
1185 for {set i 0} {$i < 100 && $port eq ""} {incr i} {
1186 after 100
1187 set output [read_file $outFileName]
1188 regexp $listening $output -> port
1189 }
1190 if {$port eq ""} {
1191 test_stop_server $stopArg $pid $outFileName
@@ -1224,11 +1283,11 @@
1224 if {[catch {
1225 exec ps -p $pid
1226 } result] != 0 || ![regexp -- "(?:^$pid| $pid) " $result]} {
1227 break
1228 }
1229 after 1000; # wait a bit...
1230 }
1231 if {[string length $fileName] > 0} {
1232 file delete $fileName
1233 }
1234 return true
1235
--- test/tester.tcl
+++ test/tester.tcl
@@ -157,11 +157,12 @@
157
158 # write a dict with enough formatting
159 # to make it human readable
160 #
161 proc protOutDict {dict {pattern *}} {
162 set longest [tcl::mathfunc::max 0 \
163 {*}[lmap key [dict keys $dict $pattern] {string length $key}]]
164 dict for {key value} $dict {
165 protOut [format "%-${longest}s = %s" $key $value]
166 }
167 }
168
@@ -344,10 +345,55 @@
345 return 0
346 }
347 }
348 return 1
349 }
350
351 # Listens on a port on 127.0.0.1 that the system chooses, and returns
352 # the port. Calls HANDLER with each connection and the request on it,
353 # once the whole request has arrived or the client has closed its side,
354 # and then closes the connection. The request is whole when it has its
355 # header lines and as many bytes after them as Content-Length says.
356 #
357 set testListeners [list]
358 proc test_listen {handler} {
359 set server [socket -server [list test_listen_accept $handler] \
360 -myaddr 127.0.0.1 0]
361 lappend ::testListeners $server
362 return [lindex [fconfigure $server -sockname] 2]
363 }
364
365 proc test_listen_accept {handler chan address port} {
366 fconfigure $chan -translation binary -blocking 0
367 set ::testListenRequest($chan) ""
368 fileevent $chan readable [list test_listen_receive $handler $chan]
369 }
370
371 proc test_listen_receive {handler chan} {
372 append ::testListenRequest($chan) [read $chan]
373 set request $::testListenRequest($chan)
374 set end [string first "\r\n\r\n" $request]
375 set length 0
376 regexp -nocase -line {^content-length:\s*(\d+)} $request -> length
377 if {![eof $chan] &&
378 ($end < 0 || [string length $request] < $end + 4 + $length)} {
379 return
380 }
381 unset ::testListenRequest($chan)
382 fileevent $chan readable {}
383 fconfigure $chan -blocking 1
384 catch {{*}$handler $chan $request}
385 catch {close $chan}
386 }
387
388 # Closes every server that test_listen has started.
389 #
390 proc test_listen_stop {} {
391 update
392 foreach server $::testListeners {close $server}
393 set ::testListeners [list]
394 }
395
396 proc test_standin {name destination} {
397 file copy -force [file join $::testfiledir standin $name] $destination
398 file attributes $destination -permissions 0755
399 return $destination
@@ -627,11 +673,12 @@
673 # Deletes the temporary repositories that test_setup made for the test
674 # file SCRIPTNAME, by default the file being sourced.
675 proc test_cleanup {{scriptName ""}} {
676 if {$::KEEP} {
677 # To avoid errors with require_no_open_checkout, cd out of here.
678 if {[info exists ::tempSavedPwd]} \
679 {cd $::tempSavedPwd; unset ::tempSavedPwd}
680 return
681 }
682 if {![info exists ::tempRepoPath]} {return}
683 if {![file exists $::tempRepoPath]} {return}
684 if {![file isdirectory $::tempRepoPath]} {return}
@@ -1025,10 +1072,22 @@
1072 }
1073
1074 # Test NAME passes if ACTUAL matches the regular expression PATTERN. A
1075 # failure is reported with the pattern and the actual value.
1076 #
1077 # Tests that ACTUAL equals EXPECTED, as test_eq does, and counts the
1078 # result in the global variable PREFIXPredMet or PREFIXPredUnmet.
1079 #
1080 proc test_predict {prefix name actual expected} {
1081 if {$actual eq $expected} {
1082 incr ::${prefix}PredMet
1083 } else {
1084 incr ::${prefix}PredUnmet
1085 }
1086 test_eq $name $actual $expected
1087 }
1088
1089 proc test_match {name actual pattern {constraints ""}} {
1090 set detail [concat [list "pattern: $pattern"] \
1091 [test_value_lines "actual: " $actual]]
1092 test_report $name [regexp -- $pattern $actual] $constraints $detail
1093 }
@@ -1180,12 +1239,12 @@
1239 # requests on TCP port localhost:8081, IPv4 and IPv6". The port is
1240 # followed by a comma or the end of the line.
1241 set listening {Listening for [^\n]+ requests on }
1242 append listening {(?:TCP port )?(?:\S*:)?(\d+)[,\r\n]}
1243 set port ""
1244 for {set i 0} {$i < 1000 && $port eq ""} {incr i} {
1245 after 10
1246 set output [read_file $outFileName]
1247 regexp $listening $output -> port
1248 }
1249 if {$port eq ""} {
1250 test_stop_server $stopArg $pid $outFileName
@@ -1224,11 +1283,11 @@
1283 if {[catch {
1284 exec ps -p $pid
1285 } result] != 0 || ![regexp -- "(?:^$pid| $pid) " $result]} {
1286 break
1287 }
1288 after 10; # wait a bit...
1289 }
1290 if {[string length $fileName] > 0} {
1291 file delete $fileName
1292 }
1293 return true
1294
--- test/th1-docs.test
+++ test/th1-docs.test
@@ -61,11 +61,12 @@
6161
###############################################################################
6262
6363
set RESULT [test_fossil_http \
6464
$repository $dataFileName /doc/trunk/fileStat.th1]
6565
66
-test th1-docs-1a {[regexp {<title>Unnamed Fossil Project: fileStat.th1</title>} $RESULT]}
66
+test th1-docs-1a {[regexp \
67
+ {<title>Unnamed Fossil Project: fileStat.th1</title>} $RESULT]}
6768
test th1-docs-1b {[regexp {>\[[0-9a-f]{40,64}\]<} $RESULT]}
6869
test th1-docs-1c {[regexp { contains \d+ files\.} $RESULT]}
6970
7071
###############################################################################
7172
7273
--- test/th1-docs.test
+++ test/th1-docs.test
@@ -61,11 +61,12 @@
61 ###############################################################################
62
63 set RESULT [test_fossil_http \
64 $repository $dataFileName /doc/trunk/fileStat.th1]
65
66 test th1-docs-1a {[regexp {<title>Unnamed Fossil Project: fileStat.th1</title>} $RESULT]}
 
67 test th1-docs-1b {[regexp {>\[[0-9a-f]{40,64}\]<} $RESULT]}
68 test th1-docs-1c {[regexp { contains \d+ files\.} $RESULT]}
69
70 ###############################################################################
71
72
--- test/th1-docs.test
+++ test/th1-docs.test
@@ -61,11 +61,12 @@
61 ###############################################################################
62
63 set RESULT [test_fossil_http \
64 $repository $dataFileName /doc/trunk/fileStat.th1]
65
66 test th1-docs-1a {[regexp \
67 {<title>Unnamed Fossil Project: fileStat.th1</title>} $RESULT]}
68 test th1-docs-1b {[regexp {>\[[0-9a-f]{40,64}\]<} $RESULT]}
69 test th1-docs-1c {[regexp { contains \d+ files\.} $RESULT]}
70
71 ###############################################################################
72
73
--- test/th1-hooks.test
+++ test/th1-hooks.test
@@ -156,11 +156,11 @@
156156
157157
fossil timeline
158158
test th1-cmd-hooks-2a {[first_data_line] eq \
159159
{<h1><b>command_hook timeline</b></h1>}}
160160
161
-test th1-cmd-hooks-2b {[second_data_line] eq {ERROR: unsupported timeline}}
161
+test_eq th1-cmd-hooks-2b [second_data_line] {ERROR: unsupported timeline}
162162
163163
###############################################################################
164164
165165
fossil timeline -n -1 now
166166
test th1-cmd-hooks-3a {[first_data_line] eq \
@@ -176,19 +176,19 @@
176176
{<h1><b>command_hook timeline command_notify timeline</b></h1>}}
177177
178178
###############################################################################
179179
180180
fossil test1
181
-test th1-custom-cmd-1a {[next_to_last_data_line] eq $repository}
181
+test_eq th1-custom-cmd-1a [next_to_last_data_line] $repository
182182
183183
test th1-custom-cmd-1b {[last_data_line] eq \
184184
{<h1><b>command_hook test1 command_notify test1</b></h1>}}
185185
186186
###############################################################################
187187
188188
fossil test2
189
-test th1-custom-cmd-2a {[first_data_line] eq {ERROR: unsupported command}}
189
+test_eq th1-custom-cmd-2a [first_data_line] {ERROR: unsupported command}
190190
191191
###############################################################################
192192
193193
fossil test3
194194
test th1-custom-cmd-3a {[string trim $RESULT] eq \
@@ -219,11 +219,11 @@
219219
{webpage_notify timeline</b></h1>}] $RESULT]}
220220
221221
###############################################################################
222222
223223
set RESULT [test_fossil_http $repository $dataFileName /test1]
224
-test th1-custom-web-1a {[next_to_last_data_line] eq $repository}
224
+test_eq th1-custom-web-1a [next_to_last_data_line] $repository
225225
226226
test th1-custom-web-1b {[last_data_line] eq \
227227
{<h1><b>command_hook http webpage_hook test1 webpage_notify test1</b></h1>}}
228228
229229
###############################################################################
230230
--- test/th1-hooks.test
+++ test/th1-hooks.test
@@ -156,11 +156,11 @@
156
157 fossil timeline
158 test th1-cmd-hooks-2a {[first_data_line] eq \
159 {<h1><b>command_hook timeline</b></h1>}}
160
161 test th1-cmd-hooks-2b {[second_data_line] eq {ERROR: unsupported timeline}}
162
163 ###############################################################################
164
165 fossil timeline -n -1 now
166 test th1-cmd-hooks-3a {[first_data_line] eq \
@@ -176,19 +176,19 @@
176 {<h1><b>command_hook timeline command_notify timeline</b></h1>}}
177
178 ###############################################################################
179
180 fossil test1
181 test th1-custom-cmd-1a {[next_to_last_data_line] eq $repository}
182
183 test th1-custom-cmd-1b {[last_data_line] eq \
184 {<h1><b>command_hook test1 command_notify test1</b></h1>}}
185
186 ###############################################################################
187
188 fossil test2
189 test th1-custom-cmd-2a {[first_data_line] eq {ERROR: unsupported command}}
190
191 ###############################################################################
192
193 fossil test3
194 test th1-custom-cmd-3a {[string trim $RESULT] eq \
@@ -219,11 +219,11 @@
219 {webpage_notify timeline</b></h1>}] $RESULT]}
220
221 ###############################################################################
222
223 set RESULT [test_fossil_http $repository $dataFileName /test1]
224 test th1-custom-web-1a {[next_to_last_data_line] eq $repository}
225
226 test th1-custom-web-1b {[last_data_line] eq \
227 {<h1><b>command_hook http webpage_hook test1 webpage_notify test1</b></h1>}}
228
229 ###############################################################################
230
--- test/th1-hooks.test
+++ test/th1-hooks.test
@@ -156,11 +156,11 @@
156
157 fossil timeline
158 test th1-cmd-hooks-2a {[first_data_line] eq \
159 {<h1><b>command_hook timeline</b></h1>}}
160
161 test_eq th1-cmd-hooks-2b [second_data_line] {ERROR: unsupported timeline}
162
163 ###############################################################################
164
165 fossil timeline -n -1 now
166 test th1-cmd-hooks-3a {[first_data_line] eq \
@@ -176,19 +176,19 @@
176 {<h1><b>command_hook timeline command_notify timeline</b></h1>}}
177
178 ###############################################################################
179
180 fossil test1
181 test_eq th1-custom-cmd-1a [next_to_last_data_line] $repository
182
183 test th1-custom-cmd-1b {[last_data_line] eq \
184 {<h1><b>command_hook test1 command_notify test1</b></h1>}}
185
186 ###############################################################################
187
188 fossil test2
189 test_eq th1-custom-cmd-2a [first_data_line] {ERROR: unsupported command}
190
191 ###############################################################################
192
193 fossil test3
194 test th1-custom-cmd-3a {[string trim $RESULT] eq \
@@ -219,11 +219,11 @@
219 {webpage_notify timeline</b></h1>}] $RESULT]}
220
221 ###############################################################################
222
223 set RESULT [test_fossil_http $repository $dataFileName /test1]
224 test_eq th1-custom-web-1a [next_to_last_data_line] $repository
225
226 test th1-custom-web-1b {[last_data_line] eq \
227 {<h1><b>command_hook http webpage_hook test1 webpage_notify test1</b></h1>}}
228
229 ###############################################################################
230
--- test/th1-repo.test
+++ test/th1-repo.test
@@ -56,11 +56,11 @@
5656
fossil commit -m "c1"
5757
5858
###############################################################################
5959
6060
fossil test-th-eval --open-config "dir trunk subdir*/*.md"
61
-test th1-dir-1 {[llength $RESULT] eq [llength $files_md]}
61
+test_eq th1-dir-1 [llength $RESULT] [llength $files_md]
6262
6363
set n 1
6464
foreach i $RESULT j $files_md {
6565
test th1-dir-2.$n {$i eq $j}
6666
set n [expr {$n + 1}]
@@ -68,21 +68,21 @@
6868
6969
###############################################################################
7070
7171
set dateTime {\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}}
7272
fossil test-th-eval --open-config "dir trunk subdir*/*.md 1"
73
-test th1-dir-3.1 {[lindex [lindex $RESULT 0] 0] eq "subdirB/f5.md"}
73
+test_eq th1-dir-3.1 [lindex [lindex $RESULT 0] 0] "subdirB/f5.md"
7474
test th1-dir-3.2 {[lindex [lindex $RESULT 0] 1] == 2}
7575
test th1-dir-3.3 {[regexp -- $dateTime [lindex [lindex $RESULT 0] 2]]}
76
-test th1-dir-3.4 {[lindex [lindex $RESULT 1] 0] eq "subdirB/f6.md"}
76
+test_eq th1-dir-3.4 [lindex [lindex $RESULT 1] 0] "subdirB/f6.md"
7777
test th1-dir-3.5 {[lindex [lindex $RESULT 1] 1] == 2}
7878
test th1-dir-3.6 {[regexp -- $dateTime [lindex [lindex $RESULT 1] 2]]}
79
-test th1-dir-3.7 {[lindex [lindex $RESULT 2] 0] eq "subdirB/f8.md"}
79
+test_eq th1-dir-3.7 [lindex [lindex $RESULT 2] 0] "subdirB/f8.md"
8080
test th1-dir-3.8 {[lindex [lindex $RESULT 2] 1] == 2}
8181
test th1-dir-3.9 {[regexp -- $dateTime [lindex [lindex $RESULT 2] 2]]}
82
-test th1-dir-3.10 {[lindex [lindex $RESULT 3] 0] eq "subdirC/f10.md"}
82
+test_eq th1-dir-3.10 [lindex [lindex $RESULT 3] 0] "subdirC/f10.md"
8383
test th1-dir-3.11 {[lindex [lindex $RESULT 3] 1] == 3}
8484
test th1-dir-3.12 {[regexp -- $dateTime [lindex [lindex $RESULT 3] 2]]}
8585
8686
###############################################################################
8787
8888
test_cleanup
8989
--- test/th1-repo.test
+++ test/th1-repo.test
@@ -56,11 +56,11 @@
56 fossil commit -m "c1"
57
58 ###############################################################################
59
60 fossil test-th-eval --open-config "dir trunk subdir*/*.md"
61 test th1-dir-1 {[llength $RESULT] eq [llength $files_md]}
62
63 set n 1
64 foreach i $RESULT j $files_md {
65 test th1-dir-2.$n {$i eq $j}
66 set n [expr {$n + 1}]
@@ -68,21 +68,21 @@
68
69 ###############################################################################
70
71 set dateTime {\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}}
72 fossil test-th-eval --open-config "dir trunk subdir*/*.md 1"
73 test th1-dir-3.1 {[lindex [lindex $RESULT 0] 0] eq "subdirB/f5.md"}
74 test th1-dir-3.2 {[lindex [lindex $RESULT 0] 1] == 2}
75 test th1-dir-3.3 {[regexp -- $dateTime [lindex [lindex $RESULT 0] 2]]}
76 test th1-dir-3.4 {[lindex [lindex $RESULT 1] 0] eq "subdirB/f6.md"}
77 test th1-dir-3.5 {[lindex [lindex $RESULT 1] 1] == 2}
78 test th1-dir-3.6 {[regexp -- $dateTime [lindex [lindex $RESULT 1] 2]]}
79 test th1-dir-3.7 {[lindex [lindex $RESULT 2] 0] eq "subdirB/f8.md"}
80 test th1-dir-3.8 {[lindex [lindex $RESULT 2] 1] == 2}
81 test th1-dir-3.9 {[regexp -- $dateTime [lindex [lindex $RESULT 2] 2]]}
82 test th1-dir-3.10 {[lindex [lindex $RESULT 3] 0] eq "subdirC/f10.md"}
83 test th1-dir-3.11 {[lindex [lindex $RESULT 3] 1] == 3}
84 test th1-dir-3.12 {[regexp -- $dateTime [lindex [lindex $RESULT 3] 2]]}
85
86 ###############################################################################
87
88 test_cleanup
89
--- test/th1-repo.test
+++ test/th1-repo.test
@@ -56,11 +56,11 @@
56 fossil commit -m "c1"
57
58 ###############################################################################
59
60 fossil test-th-eval --open-config "dir trunk subdir*/*.md"
61 test_eq th1-dir-1 [llength $RESULT] [llength $files_md]
62
63 set n 1
64 foreach i $RESULT j $files_md {
65 test th1-dir-2.$n {$i eq $j}
66 set n [expr {$n + 1}]
@@ -68,21 +68,21 @@
68
69 ###############################################################################
70
71 set dateTime {\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}}
72 fossil test-th-eval --open-config "dir trunk subdir*/*.md 1"
73 test_eq th1-dir-3.1 [lindex [lindex $RESULT 0] 0] "subdirB/f5.md"
74 test th1-dir-3.2 {[lindex [lindex $RESULT 0] 1] == 2}
75 test th1-dir-3.3 {[regexp -- $dateTime [lindex [lindex $RESULT 0] 2]]}
76 test_eq th1-dir-3.4 [lindex [lindex $RESULT 1] 0] "subdirB/f6.md"
77 test th1-dir-3.5 {[lindex [lindex $RESULT 1] 1] == 2}
78 test th1-dir-3.6 {[regexp -- $dateTime [lindex [lindex $RESULT 1] 2]]}
79 test_eq th1-dir-3.7 [lindex [lindex $RESULT 2] 0] "subdirB/f8.md"
80 test th1-dir-3.8 {[lindex [lindex $RESULT 2] 1] == 2}
81 test th1-dir-3.9 {[regexp -- $dateTime [lindex [lindex $RESULT 2] 2]]}
82 test_eq th1-dir-3.10 [lindex [lindex $RESULT 3] 0] "subdirC/f10.md"
83 test th1-dir-3.11 {[lindex [lindex $RESULT 3] 1] == 3}
84 test th1-dir-3.12 {[regexp -- $dateTime [lindex [lindex $RESULT 3] 2]]}
85
86 ###############################################################################
87
88 test_cleanup
89
--- test/th1-tcl.test
+++ test/th1-tcl.test
@@ -135,13 +135,14 @@
135135
set fossilexeref [string range $fossilexe 0 end-4]
136136
} else {
137137
set fossilexeref $fossilexe
138138
}
139139
140
-test th1-tcl-9 {[string trim $RESULT] eq [list [file tail $fossilexeref] 3 \
140
+test_eq th1-tcl-9 [string trim $RESULT] \
141
+ [list [file tail $fossilexeref] 3 \
141142
[list test-th-render --open-config [file nativename [file join $path \
142
-th1-tcl9.txt]]]]}
143
+th1-tcl9.txt]]]]
143144
144145
###############################################################################
145146
146147
fossil test-th-eval "tclMakeSafe a"
147148
test th1-tcl-10 {[normalize_result] eq \
@@ -148,11 +149,11 @@
148149
{TH_ERROR: wrong # args: should be "tclMakeSafe"}}
149150
150151
###############################################################################
151152
152153
fossil test-th-eval "list \[tclIsSafe\] \[tclMakeSafe\] \[tclIsSafe\]"
153
-test th1-tcl-11 {[normalize_result] eq {0 {} 1}}
154
+test_eq th1-tcl-11 [normalize_result] {0 {} 1}
154155
155156
###############################################################################
156157
157158
fossil test-th-eval "tclMakeSafe; tclMakeSafe"
158159
test th1-tcl-12 {[normalize_result] eq \
@@ -159,30 +160,30 @@
159160
{TH_ERROR: Tcl interpreter is already 'safe'}}
160161
161162
###############################################################################
162163
163164
fossil test-th-eval "tclEval pwd; tclMakeSafe; tclEval pwd"
164
-test th1-tcl-13 {[normalize_result] eq {TH_ERROR: invalid command name "pwd"}}
165
+test_eq th1-tcl-13 [normalize_result] {TH_ERROR: invalid command name "pwd"}
165166
166167
###############################################################################
167168
168169
fossil test-th-eval "tclMakeSafe; tclExpr {0 + \[string length \[pwd\]\]}"
169
-test th1-tcl-14 {[normalize_result] eq {TH_ERROR: invalid command name "pwd"}}
170
+test_eq th1-tcl-14 [normalize_result] {TH_ERROR: invalid command name "pwd"}
170171
171172
###############################################################################
172173
173174
fossil test-th-eval "tclInvoke pwd; tclMakeSafe; tclInvoke pwd"
174
-test th1-tcl-15 {[normalize_result] eq {TH_ERROR: Tcl command not found: pwd}}
175
+test_eq th1-tcl-15 [normalize_result] {TH_ERROR: Tcl command not found: pwd}
175176
176177
###############################################################################
177178
178179
fossil test-th-eval "tclMakeSafe; tclEval set x 2"
179
-test th1-tcl-16 {[normalize_result] eq {2}}
180
+test_eq th1-tcl-16 [normalize_result] {2}
180181
181182
###############################################################################
182183
183184
fossil test-th-eval "tclMakeSafe; tclEval set x 2; tclEval info vars x"
184
-test th1-tcl-17 {[normalize_result] eq {x}}
185
+test_eq th1-tcl-17 [normalize_result] {x}
185186
186187
###############################################################################
187188
188189
test_cleanup
189190
--- test/th1-tcl.test
+++ test/th1-tcl.test
@@ -135,13 +135,14 @@
135 set fossilexeref [string range $fossilexe 0 end-4]
136 } else {
137 set fossilexeref $fossilexe
138 }
139
140 test th1-tcl-9 {[string trim $RESULT] eq [list [file tail $fossilexeref] 3 \
 
141 [list test-th-render --open-config [file nativename [file join $path \
142 th1-tcl9.txt]]]]}
143
144 ###############################################################################
145
146 fossil test-th-eval "tclMakeSafe a"
147 test th1-tcl-10 {[normalize_result] eq \
@@ -148,11 +149,11 @@
148 {TH_ERROR: wrong # args: should be "tclMakeSafe"}}
149
150 ###############################################################################
151
152 fossil test-th-eval "list \[tclIsSafe\] \[tclMakeSafe\] \[tclIsSafe\]"
153 test th1-tcl-11 {[normalize_result] eq {0 {} 1}}
154
155 ###############################################################################
156
157 fossil test-th-eval "tclMakeSafe; tclMakeSafe"
158 test th1-tcl-12 {[normalize_result] eq \
@@ -159,30 +160,30 @@
159 {TH_ERROR: Tcl interpreter is already 'safe'}}
160
161 ###############################################################################
162
163 fossil test-th-eval "tclEval pwd; tclMakeSafe; tclEval pwd"
164 test th1-tcl-13 {[normalize_result] eq {TH_ERROR: invalid command name "pwd"}}
165
166 ###############################################################################
167
168 fossil test-th-eval "tclMakeSafe; tclExpr {0 + \[string length \[pwd\]\]}"
169 test th1-tcl-14 {[normalize_result] eq {TH_ERROR: invalid command name "pwd"}}
170
171 ###############################################################################
172
173 fossil test-th-eval "tclInvoke pwd; tclMakeSafe; tclInvoke pwd"
174 test th1-tcl-15 {[normalize_result] eq {TH_ERROR: Tcl command not found: pwd}}
175
176 ###############################################################################
177
178 fossil test-th-eval "tclMakeSafe; tclEval set x 2"
179 test th1-tcl-16 {[normalize_result] eq {2}}
180
181 ###############################################################################
182
183 fossil test-th-eval "tclMakeSafe; tclEval set x 2; tclEval info vars x"
184 test th1-tcl-17 {[normalize_result] eq {x}}
185
186 ###############################################################################
187
188 test_cleanup
189
--- test/th1-tcl.test
+++ test/th1-tcl.test
@@ -135,13 +135,14 @@
135 set fossilexeref [string range $fossilexe 0 end-4]
136 } else {
137 set fossilexeref $fossilexe
138 }
139
140 test_eq th1-tcl-9 [string trim $RESULT] \
141 [list [file tail $fossilexeref] 3 \
142 [list test-th-render --open-config [file nativename [file join $path \
143 th1-tcl9.txt]]]]
144
145 ###############################################################################
146
147 fossil test-th-eval "tclMakeSafe a"
148 test th1-tcl-10 {[normalize_result] eq \
@@ -148,11 +149,11 @@
149 {TH_ERROR: wrong # args: should be "tclMakeSafe"}}
150
151 ###############################################################################
152
153 fossil test-th-eval "list \[tclIsSafe\] \[tclMakeSafe\] \[tclIsSafe\]"
154 test_eq th1-tcl-11 [normalize_result] {0 {} 1}
155
156 ###############################################################################
157
158 fossil test-th-eval "tclMakeSafe; tclMakeSafe"
159 test th1-tcl-12 {[normalize_result] eq \
@@ -159,30 +160,30 @@
160 {TH_ERROR: Tcl interpreter is already 'safe'}}
161
162 ###############################################################################
163
164 fossil test-th-eval "tclEval pwd; tclMakeSafe; tclEval pwd"
165 test_eq th1-tcl-13 [normalize_result] {TH_ERROR: invalid command name "pwd"}
166
167 ###############################################################################
168
169 fossil test-th-eval "tclMakeSafe; tclExpr {0 + \[string length \[pwd\]\]}"
170 test_eq th1-tcl-14 [normalize_result] {TH_ERROR: invalid command name "pwd"}
171
172 ###############################################################################
173
174 fossil test-th-eval "tclInvoke pwd; tclMakeSafe; tclInvoke pwd"
175 test_eq th1-tcl-15 [normalize_result] {TH_ERROR: Tcl command not found: pwd}
176
177 ###############################################################################
178
179 fossil test-th-eval "tclMakeSafe; tclEval set x 2"
180 test_eq th1-tcl-16 [normalize_result] {2}
181
182 ###############################################################################
183
184 fossil test-th-eval "tclMakeSafe; tclEval set x 2; tclEval info vars x"
185 test_eq th1-tcl-17 [normalize_result] {x}
186
187 ###############################################################################
188
189 test_cleanup
190
+23 -15
--- test/th1.test
+++ test/th1.test
@@ -564,16 +564,20 @@
564564
fossil test-th-eval "setParameter test3 value3; getParameter test3 defValue3"
565565
test th1-set-parameter-5 {$RESULT eq {value3}}
566566
567567
###############################################################################
568568
569
-fossil test-th-eval "setParameter test4 value4; setParameter test4 value5; getParameter test4"
569
+fossil test-th-eval \
570
+ "setParameter test4 value4; setParameter test4 value5; getParameter test4"
570571
test th1-set-parameter-6 {$RESULT eq {value5}}
571572
572573
###############################################################################
573574
574
-fossil test-th-eval "setParameter test4 value4; setParameter test4 value5; getParameter test4 defValue4"
575
+fossil test-th-eval \
576
+ [join [list \
577
+ "setParameter test4 value4; setParameter test4 value5; " \
578
+ "getParameter test4 defValue4"] ""]
575579
test th1-set-parameter-7 {$RESULT eq {value5}}
576580
577581
###############################################################################
578582
579583
fossil test-th-eval "artifact"
@@ -636,11 +640,11 @@
636640
###############################################################################
637641
638642
test_block_in_checkout th1-globalState-2 {
639643
if {$th1Hooks} {
640644
fossil test-th-eval "globalState checkout"
641
- test th1-globalState-2 {$RESULT eq [fossil test-th-eval checkout]}
645
+ test_eq th1-globalState-2 $RESULT [fossil test-th-eval checkout]
642646
} else {
643647
# NOTE: No TH1 hooks, force checkout to be populated.
644648
fossil test-th-eval --open-config "globalState checkout"
645649
646650
test th1-globalState-2 {$RESULT eq \
@@ -659,11 +663,11 @@
659663
test th1-globalState-4 {[string length $RESULT] > 0}
660664
661665
###############################################################################
662666
663667
fossil test-th-eval "globalState executable"
664
-test th1-globalState-5 {[file rootname [file tail $RESULT]] eq "fossil"}
668
+test_eq th1-globalState-5 [file rootname [file tail $RESULT]] "fossil"
665669
666670
###############################################################################
667671
668672
fossil test-th-eval "globalState log"
669673
test th1-globalState-6 {[string length $RESULT] == 0}
@@ -687,11 +691,11 @@
687691
###############################################################################
688692
689693
test_block_in_checkout th1-globalState-9 {
690694
if {$th1Hooks} {
691695
fossil test-th-eval "globalState repository"
692
- test th1-globalState-9 {$RESULT eq [fossil test-th-eval repository]}
696
+ test_eq th1-globalState-9 $RESULT [fossil test-th-eval repository]
693697
} else {
694698
# NOTE: No TH1 hooks, force repository to be populated.
695699
fossil test-th-eval --open-config "globalState repository"
696700
697701
test th1-globalState-9 {$RESULT eq \
@@ -772,11 +776,12 @@
772776
# repository return searchable set setParameter setting stime string \
773777
# styleFooter styleHeader styleScript submenu tclReady trace unset \
774778
# unversioned uplevel upvar utime verifyCsrf verifyLogin wiki}
775779
#set tcl_commands {tclEval tclExpr tclInvoke tclIsSafe tclMakeSafe}
776780
#if {$th1Tcl} {
777
-# test th1-info-commands-1 {$sorted_result eq [lsort "$base_commands $tcl_commands"]}
781
+# test th1-info-commands-1 {$sorted_result eq [lsort "$base_commands
782
+# $tcl_commands"]}
778783
#} else {
779784
# test th1-info-commands-1 {$sorted_result eq [lsort "$base_commands"]}
780785
#}
781786
782787
###############################################################################
@@ -796,11 +801,11 @@
796801
797802
if {$th1Hooks} {
798803
test th1-info-vars-2 {[lsort $RESULT] eq \
799804
[lsort "x th_stack_trace cmd_flags tcl_platform cmd_name cmd_args"]}
800805
} else {
801
- test th1-info-vars-2 {[lsort $RESULT] eq [lsort "x tcl_platform"]}
806
+ test_eq th1-info-vars-2 [lsort $RESULT] [lsort "x tcl_platform"]
802807
}
803808
804809
###############################################################################
805810
806811
fossil test-th-eval "set x 1; unset x; info vars"
@@ -823,11 +828,11 @@
823828
824829
if {$th1Hooks} {
825830
test th1-info-vars-5 {[lsort $RESULT] eq \
826831
[lsort "th_stack_trace y cmd_flags tcl_platform cmd_name cmd_args"]}
827832
} else {
828
- test th1-info-vars-5 {[lsort $RESULT] eq [lsort "y tcl_platform"]}
833
+ test_eq th1-info-vars-5 [lsort $RESULT] [lsort "y tcl_platform"]
829834
}
830835
831836
###############################################################################
832837
833838
fossil test-th-eval "array exists foo"
@@ -1002,26 +1007,28 @@
10021007
{TH_ERROR: wrong # args: should be "markdown STRING"}}
10031008
10041009
###############################################################################
10051010
10061011
fossil test-th-eval {markdown "*This is a test.*"}
1007
-test th1-markdown-3 {[normalize_result] eq {{} {<div class="markdown">
1012
+test_eq th1-markdown-3 [normalize_result] \
1013
+ {{} {<div class="markdown">
10081014
10091015
<p><em>This is a test.</em></p>
10101016
10111017
</div>
1012
-}}}
1018
+}}
10131019
10141020
###############################################################################
10151021
10161022
fossil test-th-eval {markdown "Test1\n=====\n*This is a test.*"}
1017
-test th1-markdown-4 {[normalize_result] eq {Test1 {<div class="markdown">
1023
+test_eq th1-markdown-4 [normalize_result] \
1024
+ {Test1 {<div class="markdown">
10181025
10191026
<p><em>This is a test.</em></p>
10201027
10211028
</div>
1022
-}}}
1029
+}}
10231030
10241031
###############################################################################
10251032
10261033
set markdown [read_file [file join $path markdown-test1.md]]
10271034
fossil test-th-eval [string map \
@@ -1060,17 +1067,18 @@
10601067
###############################################################################
10611068
10621069
# Verify that quoted delimiters like * and _ don't terminate their
10631070
# span. This was fixed by checkin [dd41f85acf].
10641071
fossil test-th-eval {markdown "*This is\\*a test.*\n_second\\_test_"}
1065
-test th1-markdown-6 {[normalize_result] eq {{} {<div class="markdown">
1072
+test_eq th1-markdown-6 [normalize_result] \
1073
+ {{} {<div class="markdown">
10661074
10671075
<p><em>This is*a test.</em>
10681076
<em>second_test</em></p>
10691077
10701078
</div>
1071
-}}}
1079
+}}
10721080
10731081
###############################################################################
10741082
10751083
th1_cases {
10761084
th1-encode64-1 {encode64 test} dGVzdA==
@@ -1124,11 +1132,11 @@
11241132
fossil unversioned add ten.txt
11251133
fossil unversioned list
11261134
11271135
# unversioned list
11281136
fossil test-th-eval --open-config "unversioned list"
1129
-test th1-unversioned-1 {[normalize_result] eq {ten.txt}}
1137
+test_eq th1-unversioned-1 [normalize_result] {ten.txt}
11301138
11311139
# unversioned content
11321140
fossil test-th-eval --open-config \
11331141
{string length [unversioned content ten.txt]}
11341142
test th1-unversioned-2 {$RESULT eq {10}}
11351143
--- test/th1.test
+++ test/th1.test
@@ -564,16 +564,20 @@
564 fossil test-th-eval "setParameter test3 value3; getParameter test3 defValue3"
565 test th1-set-parameter-5 {$RESULT eq {value3}}
566
567 ###############################################################################
568
569 fossil test-th-eval "setParameter test4 value4; setParameter test4 value5; getParameter test4"
 
570 test th1-set-parameter-6 {$RESULT eq {value5}}
571
572 ###############################################################################
573
574 fossil test-th-eval "setParameter test4 value4; setParameter test4 value5; getParameter test4 defValue4"
 
 
 
575 test th1-set-parameter-7 {$RESULT eq {value5}}
576
577 ###############################################################################
578
579 fossil test-th-eval "artifact"
@@ -636,11 +640,11 @@
636 ###############################################################################
637
638 test_block_in_checkout th1-globalState-2 {
639 if {$th1Hooks} {
640 fossil test-th-eval "globalState checkout"
641 test th1-globalState-2 {$RESULT eq [fossil test-th-eval checkout]}
642 } else {
643 # NOTE: No TH1 hooks, force checkout to be populated.
644 fossil test-th-eval --open-config "globalState checkout"
645
646 test th1-globalState-2 {$RESULT eq \
@@ -659,11 +663,11 @@
659 test th1-globalState-4 {[string length $RESULT] > 0}
660
661 ###############################################################################
662
663 fossil test-th-eval "globalState executable"
664 test th1-globalState-5 {[file rootname [file tail $RESULT]] eq "fossil"}
665
666 ###############################################################################
667
668 fossil test-th-eval "globalState log"
669 test th1-globalState-6 {[string length $RESULT] == 0}
@@ -687,11 +691,11 @@
687 ###############################################################################
688
689 test_block_in_checkout th1-globalState-9 {
690 if {$th1Hooks} {
691 fossil test-th-eval "globalState repository"
692 test th1-globalState-9 {$RESULT eq [fossil test-th-eval repository]}
693 } else {
694 # NOTE: No TH1 hooks, force repository to be populated.
695 fossil test-th-eval --open-config "globalState repository"
696
697 test th1-globalState-9 {$RESULT eq \
@@ -772,11 +776,12 @@
772 # repository return searchable set setParameter setting stime string \
773 # styleFooter styleHeader styleScript submenu tclReady trace unset \
774 # unversioned uplevel upvar utime verifyCsrf verifyLogin wiki}
775 #set tcl_commands {tclEval tclExpr tclInvoke tclIsSafe tclMakeSafe}
776 #if {$th1Tcl} {
777 # test th1-info-commands-1 {$sorted_result eq [lsort "$base_commands $tcl_commands"]}
 
778 #} else {
779 # test th1-info-commands-1 {$sorted_result eq [lsort "$base_commands"]}
780 #}
781
782 ###############################################################################
@@ -796,11 +801,11 @@
796
797 if {$th1Hooks} {
798 test th1-info-vars-2 {[lsort $RESULT] eq \
799 [lsort "x th_stack_trace cmd_flags tcl_platform cmd_name cmd_args"]}
800 } else {
801 test th1-info-vars-2 {[lsort $RESULT] eq [lsort "x tcl_platform"]}
802 }
803
804 ###############################################################################
805
806 fossil test-th-eval "set x 1; unset x; info vars"
@@ -823,11 +828,11 @@
823
824 if {$th1Hooks} {
825 test th1-info-vars-5 {[lsort $RESULT] eq \
826 [lsort "th_stack_trace y cmd_flags tcl_platform cmd_name cmd_args"]}
827 } else {
828 test th1-info-vars-5 {[lsort $RESULT] eq [lsort "y tcl_platform"]}
829 }
830
831 ###############################################################################
832
833 fossil test-th-eval "array exists foo"
@@ -1002,26 +1007,28 @@
1002 {TH_ERROR: wrong # args: should be "markdown STRING"}}
1003
1004 ###############################################################################
1005
1006 fossil test-th-eval {markdown "*This is a test.*"}
1007 test th1-markdown-3 {[normalize_result] eq {{} {<div class="markdown">
 
1008
1009 <p><em>This is a test.</em></p>
1010
1011 </div>
1012 }}}
1013
1014 ###############################################################################
1015
1016 fossil test-th-eval {markdown "Test1\n=====\n*This is a test.*"}
1017 test th1-markdown-4 {[normalize_result] eq {Test1 {<div class="markdown">
 
1018
1019 <p><em>This is a test.</em></p>
1020
1021 </div>
1022 }}}
1023
1024 ###############################################################################
1025
1026 set markdown [read_file [file join $path markdown-test1.md]]
1027 fossil test-th-eval [string map \
@@ -1060,17 +1067,18 @@
1060 ###############################################################################
1061
1062 # Verify that quoted delimiters like * and _ don't terminate their
1063 # span. This was fixed by checkin [dd41f85acf].
1064 fossil test-th-eval {markdown "*This is\\*a test.*\n_second\\_test_"}
1065 test th1-markdown-6 {[normalize_result] eq {{} {<div class="markdown">
 
1066
1067 <p><em>This is*a test.</em>
1068 <em>second_test</em></p>
1069
1070 </div>
1071 }}}
1072
1073 ###############################################################################
1074
1075 th1_cases {
1076 th1-encode64-1 {encode64 test} dGVzdA==
@@ -1124,11 +1132,11 @@
1124 fossil unversioned add ten.txt
1125 fossil unversioned list
1126
1127 # unversioned list
1128 fossil test-th-eval --open-config "unversioned list"
1129 test th1-unversioned-1 {[normalize_result] eq {ten.txt}}
1130
1131 # unversioned content
1132 fossil test-th-eval --open-config \
1133 {string length [unversioned content ten.txt]}
1134 test th1-unversioned-2 {$RESULT eq {10}}
1135
--- test/th1.test
+++ test/th1.test
@@ -564,16 +564,20 @@
564 fossil test-th-eval "setParameter test3 value3; getParameter test3 defValue3"
565 test th1-set-parameter-5 {$RESULT eq {value3}}
566
567 ###############################################################################
568
569 fossil test-th-eval \
570 "setParameter test4 value4; setParameter test4 value5; getParameter test4"
571 test th1-set-parameter-6 {$RESULT eq {value5}}
572
573 ###############################################################################
574
575 fossil test-th-eval \
576 [join [list \
577 "setParameter test4 value4; setParameter test4 value5; " \
578 "getParameter test4 defValue4"] ""]
579 test th1-set-parameter-7 {$RESULT eq {value5}}
580
581 ###############################################################################
582
583 fossil test-th-eval "artifact"
@@ -636,11 +640,11 @@
640 ###############################################################################
641
642 test_block_in_checkout th1-globalState-2 {
643 if {$th1Hooks} {
644 fossil test-th-eval "globalState checkout"
645 test_eq th1-globalState-2 $RESULT [fossil test-th-eval checkout]
646 } else {
647 # NOTE: No TH1 hooks, force checkout to be populated.
648 fossil test-th-eval --open-config "globalState checkout"
649
650 test th1-globalState-2 {$RESULT eq \
@@ -659,11 +663,11 @@
663 test th1-globalState-4 {[string length $RESULT] > 0}
664
665 ###############################################################################
666
667 fossil test-th-eval "globalState executable"
668 test_eq th1-globalState-5 [file rootname [file tail $RESULT]] "fossil"
669
670 ###############################################################################
671
672 fossil test-th-eval "globalState log"
673 test th1-globalState-6 {[string length $RESULT] == 0}
@@ -687,11 +691,11 @@
691 ###############################################################################
692
693 test_block_in_checkout th1-globalState-9 {
694 if {$th1Hooks} {
695 fossil test-th-eval "globalState repository"
696 test_eq th1-globalState-9 $RESULT [fossil test-th-eval repository]
697 } else {
698 # NOTE: No TH1 hooks, force repository to be populated.
699 fossil test-th-eval --open-config "globalState repository"
700
701 test th1-globalState-9 {$RESULT eq \
@@ -772,11 +776,12 @@
776 # repository return searchable set setParameter setting stime string \
777 # styleFooter styleHeader styleScript submenu tclReady trace unset \
778 # unversioned uplevel upvar utime verifyCsrf verifyLogin wiki}
779 #set tcl_commands {tclEval tclExpr tclInvoke tclIsSafe tclMakeSafe}
780 #if {$th1Tcl} {
781 # test th1-info-commands-1 {$sorted_result eq [lsort "$base_commands
782 # $tcl_commands"]}
783 #} else {
784 # test th1-info-commands-1 {$sorted_result eq [lsort "$base_commands"]}
785 #}
786
787 ###############################################################################
@@ -796,11 +801,11 @@
801
802 if {$th1Hooks} {
803 test th1-info-vars-2 {[lsort $RESULT] eq \
804 [lsort "x th_stack_trace cmd_flags tcl_platform cmd_name cmd_args"]}
805 } else {
806 test_eq th1-info-vars-2 [lsort $RESULT] [lsort "x tcl_platform"]
807 }
808
809 ###############################################################################
810
811 fossil test-th-eval "set x 1; unset x; info vars"
@@ -823,11 +828,11 @@
828
829 if {$th1Hooks} {
830 test th1-info-vars-5 {[lsort $RESULT] eq \
831 [lsort "th_stack_trace y cmd_flags tcl_platform cmd_name cmd_args"]}
832 } else {
833 test_eq th1-info-vars-5 [lsort $RESULT] [lsort "y tcl_platform"]
834 }
835
836 ###############################################################################
837
838 fossil test-th-eval "array exists foo"
@@ -1002,26 +1007,28 @@
1007 {TH_ERROR: wrong # args: should be "markdown STRING"}}
1008
1009 ###############################################################################
1010
1011 fossil test-th-eval {markdown "*This is a test.*"}
1012 test_eq th1-markdown-3 [normalize_result] \
1013 {{} {<div class="markdown">
1014
1015 <p><em>This is a test.</em></p>
1016
1017 </div>
1018 }}
1019
1020 ###############################################################################
1021
1022 fossil test-th-eval {markdown "Test1\n=====\n*This is a test.*"}
1023 test_eq th1-markdown-4 [normalize_result] \
1024 {Test1 {<div class="markdown">
1025
1026 <p><em>This is a test.</em></p>
1027
1028 </div>
1029 }}
1030
1031 ###############################################################################
1032
1033 set markdown [read_file [file join $path markdown-test1.md]]
1034 fossil test-th-eval [string map \
@@ -1060,17 +1067,18 @@
1067 ###############################################################################
1068
1069 # Verify that quoted delimiters like * and _ don't terminate their
1070 # span. This was fixed by checkin [dd41f85acf].
1071 fossil test-th-eval {markdown "*This is\\*a test.*\n_second\\_test_"}
1072 test_eq th1-markdown-6 [normalize_result] \
1073 {{} {<div class="markdown">
1074
1075 <p><em>This is*a test.</em>
1076 <em>second_test</em></p>
1077
1078 </div>
1079 }}
1080
1081 ###############################################################################
1082
1083 th1_cases {
1084 th1-encode64-1 {encode64 test} dGVzdA==
@@ -1124,11 +1132,11 @@
1132 fossil unversioned add ten.txt
1133 fossil unversioned list
1134
1135 # unversioned list
1136 fossil test-th-eval --open-config "unversioned list"
1137 test_eq th1-unversioned-1 [normalize_result] {ten.txt}
1138
1139 # unversioned content
1140 fossil test-th-eval --open-config \
1141 {string length [unversioned content ten.txt]}
1142 test th1-unversioned-2 {$RESULT eq {10}}
1143
--- test/unicode-pathnames.test
+++ test/unicode-pathnames.test
@@ -116,21 +116,10 @@
116116
proc up_argv_maps {a b} {
117117
fossil test-echo $b
118118
return [expr {[string first "argv\[2\] = \[$a\]" $::RESULT] >= 0}]
119119
}
120120
121
-# Record whether ACTUAL equals EXPECTED for prediction NAME.
122
-#
123
-proc up_expect {name actual expected} {
124
- set ok [expr {$actual eq $expected}]
125
- if {$ok} {
126
- incr ::upPredMet
127
- } else {
128
- incr ::upPredUnmet
129
- }
130
- test_eq $name $actual $expected
131
-}
132121
133122
# Each row is a label, the pathname that is checked in, and another
134123
# spelling that is a D145 caseless match (or treated as one file in
135124
# the header for compatibility pairs).
136125
#
@@ -276,14 +265,14 @@
276265
#
277266
foreach {label a b} $upSame {
278267
up_show $label $a $b
279268
set converted [expr {$label in $upConverted}]
280269
fossil ls $b
281
- up_expect unicode-pathnames-on-$label-ls [normalize_result] \
270
+ test_predict up unicode-pathnames-on-$label-ls [normalize_result] \
282271
[expr {$converted ? $a : ""}]
283272
fossil cat $b {*}[expr {$converted ? "" : "-expectError"}]
284
- up_expect unicode-pathnames-on-$label-cat $CODE [expr {!$converted}]
273
+ test_predict up unicode-pathnames-on-$label-cat $CODE [expr {!$converted}]
285274
}
286275
287276
# With the setting off, D145 matches must be found by the other
288277
# spelling; upDifferent pairs must not.
289278
#
@@ -290,26 +279,27 @@
290279
fossil settings case-sensitive 0
291280
292281
foreach {label a b} $upSame {
293282
up_show $label $a $b
294283
fossil ls $b
295
- up_expect unicode-pathnames-off-$label-ls [normalize_result] $a
284
+ test_predict up unicode-pathnames-off-$label-ls [normalize_result] $a
296285
fossil cat $b
297
- up_expect unicode-pathnames-off-$label-cat-code $CODE 0
298
- up_expect unicode-pathnames-off-$label-cat [normalize_result] $label
286
+ test_predict up unicode-pathnames-off-$label-cat-code $CODE 0
287
+ test_predict up unicode-pathnames-off-$label-cat [normalize_result] $label
299288
fossil rm --soft -n $b
300
- up_expect unicode-pathnames-off-$label-rm [normalize_result] "DELETED $a"
289
+ test_predict up unicode-pathnames-off-$label-rm [normalize_result] \
290
+ "DELETED $a"
301291
}
302292
303293
foreach {label a b} $upDifferent {
304294
up_show $label $a $b
305295
fossil ls $b
306
- up_expect unicode-pathnames-off-$label-ls [normalize_result] ""
296
+ test_predict up unicode-pathnames-off-$label-ls [normalize_result] ""
307297
fossil cat $b -expectError
308
- up_expect unicode-pathnames-off-$label-cat $CODE 1
298
+ test_predict up unicode-pathnames-off-$label-cat $CODE 1
309299
fossil rm --soft -n $b
310
- up_expect unicode-pathnames-off-$label-rm [normalize_result] ""
300
+ test_predict up unicode-pathnames-off-$label-rm [normalize_result] ""
311301
}
312302
313303
# A file on disk under the other spelling is not an extra file, and
314304
# "fossil add" does not add it. Needs a volume that stores two names.
315305
#
@@ -326,14 +316,14 @@
326316
continue
327317
}
328318
file mkdir [file dirname $b]
329319
write_file $b "other spelling\n"
330320
fossil extras
331
- up_expect unicode-pathnames-off-$label-extras [normalize_result] ""
321
+ test_predict up unicode-pathnames-off-$label-extras [normalize_result] ""
332322
fossil add $b
333323
fossil changes
334
- up_expect unicode-pathnames-off-$label-add [normalize_result] ""
324
+ test_predict up unicode-pathnames-off-$label-add [normalize_result] ""
335325
fossil revert
336326
file delete $b
337327
if {[file dirname $b] ne "."} {
338328
catch {file delete [file dirname $b]}
339329
}
@@ -375,19 +365,19 @@
375365
set upBoth [up_new_version]
376366
377367
fossil settings case-sensitive 0
378368
write_file plain.txt "edited\n"
379369
fossil commit -m "edit plain.txt" -expectError
380
- up_expect unicode-pathnames-collide-$label-commit $CODE 1
370
+ test_predict up unicode-pathnames-collide-$label-commit $CODE 1
381371
382372
fossil settings case-sensitive 1
383373
fossil revert
384374
fossil update $upFirst
385375
fossil settings case-sensitive 0
386376
fossil update $upBoth -expectError
387
- up_expect unicode-pathnames-collide-$label-update $CODE 1
388
- up_expect unicode-pathnames-collide-$label-update-file \
377
+ test_predict up unicode-pathnames-collide-$label-update $CODE 1
378
+ test_predict up unicode-pathnames-collide-$label-update-file \
389379
[file exists $b] 0
390380
}
391381
if {[llength $upOneFile] > 0} {
392382
test_skip_part "commit and update tests of [join $upOneFile {, }]:\
393383
filesystem type or argv rewriting has one name for both spellings\
394384
--- test/unicode-pathnames.test
+++ test/unicode-pathnames.test
@@ -116,21 +116,10 @@
116 proc up_argv_maps {a b} {
117 fossil test-echo $b
118 return [expr {[string first "argv\[2\] = \[$a\]" $::RESULT] >= 0}]
119 }
120
121 # Record whether ACTUAL equals EXPECTED for prediction NAME.
122 #
123 proc up_expect {name actual expected} {
124 set ok [expr {$actual eq $expected}]
125 if {$ok} {
126 incr ::upPredMet
127 } else {
128 incr ::upPredUnmet
129 }
130 test_eq $name $actual $expected
131 }
132
133 # Each row is a label, the pathname that is checked in, and another
134 # spelling that is a D145 caseless match (or treated as one file in
135 # the header for compatibility pairs).
136 #
@@ -276,14 +265,14 @@
276 #
277 foreach {label a b} $upSame {
278 up_show $label $a $b
279 set converted [expr {$label in $upConverted}]
280 fossil ls $b
281 up_expect unicode-pathnames-on-$label-ls [normalize_result] \
282 [expr {$converted ? $a : ""}]
283 fossil cat $b {*}[expr {$converted ? "" : "-expectError"}]
284 up_expect unicode-pathnames-on-$label-cat $CODE [expr {!$converted}]
285 }
286
287 # With the setting off, D145 matches must be found by the other
288 # spelling; upDifferent pairs must not.
289 #
@@ -290,26 +279,27 @@
290 fossil settings case-sensitive 0
291
292 foreach {label a b} $upSame {
293 up_show $label $a $b
294 fossil ls $b
295 up_expect unicode-pathnames-off-$label-ls [normalize_result] $a
296 fossil cat $b
297 up_expect unicode-pathnames-off-$label-cat-code $CODE 0
298 up_expect unicode-pathnames-off-$label-cat [normalize_result] $label
299 fossil rm --soft -n $b
300 up_expect unicode-pathnames-off-$label-rm [normalize_result] "DELETED $a"
 
301 }
302
303 foreach {label a b} $upDifferent {
304 up_show $label $a $b
305 fossil ls $b
306 up_expect unicode-pathnames-off-$label-ls [normalize_result] ""
307 fossil cat $b -expectError
308 up_expect unicode-pathnames-off-$label-cat $CODE 1
309 fossil rm --soft -n $b
310 up_expect unicode-pathnames-off-$label-rm [normalize_result] ""
311 }
312
313 # A file on disk under the other spelling is not an extra file, and
314 # "fossil add" does not add it. Needs a volume that stores two names.
315 #
@@ -326,14 +316,14 @@
326 continue
327 }
328 file mkdir [file dirname $b]
329 write_file $b "other spelling\n"
330 fossil extras
331 up_expect unicode-pathnames-off-$label-extras [normalize_result] ""
332 fossil add $b
333 fossil changes
334 up_expect unicode-pathnames-off-$label-add [normalize_result] ""
335 fossil revert
336 file delete $b
337 if {[file dirname $b] ne "."} {
338 catch {file delete [file dirname $b]}
339 }
@@ -375,19 +365,19 @@
375 set upBoth [up_new_version]
376
377 fossil settings case-sensitive 0
378 write_file plain.txt "edited\n"
379 fossil commit -m "edit plain.txt" -expectError
380 up_expect unicode-pathnames-collide-$label-commit $CODE 1
381
382 fossil settings case-sensitive 1
383 fossil revert
384 fossil update $upFirst
385 fossil settings case-sensitive 0
386 fossil update $upBoth -expectError
387 up_expect unicode-pathnames-collide-$label-update $CODE 1
388 up_expect unicode-pathnames-collide-$label-update-file \
389 [file exists $b] 0
390 }
391 if {[llength $upOneFile] > 0} {
392 test_skip_part "commit and update tests of [join $upOneFile {, }]:\
393 filesystem type or argv rewriting has one name for both spellings\
394
--- test/unicode-pathnames.test
+++ test/unicode-pathnames.test
@@ -116,21 +116,10 @@
116 proc up_argv_maps {a b} {
117 fossil test-echo $b
118 return [expr {[string first "argv\[2\] = \[$a\]" $::RESULT] >= 0}]
119 }
120
 
 
 
 
 
 
 
 
 
 
 
121
122 # Each row is a label, the pathname that is checked in, and another
123 # spelling that is a D145 caseless match (or treated as one file in
124 # the header for compatibility pairs).
125 #
@@ -276,14 +265,14 @@
265 #
266 foreach {label a b} $upSame {
267 up_show $label $a $b
268 set converted [expr {$label in $upConverted}]
269 fossil ls $b
270 test_predict up unicode-pathnames-on-$label-ls [normalize_result] \
271 [expr {$converted ? $a : ""}]
272 fossil cat $b {*}[expr {$converted ? "" : "-expectError"}]
273 test_predict up unicode-pathnames-on-$label-cat $CODE [expr {!$converted}]
274 }
275
276 # With the setting off, D145 matches must be found by the other
277 # spelling; upDifferent pairs must not.
278 #
@@ -290,26 +279,27 @@
279 fossil settings case-sensitive 0
280
281 foreach {label a b} $upSame {
282 up_show $label $a $b
283 fossil ls $b
284 test_predict up unicode-pathnames-off-$label-ls [normalize_result] $a
285 fossil cat $b
286 test_predict up unicode-pathnames-off-$label-cat-code $CODE 0
287 test_predict up unicode-pathnames-off-$label-cat [normalize_result] $label
288 fossil rm --soft -n $b
289 test_predict up unicode-pathnames-off-$label-rm [normalize_result] \
290 "DELETED $a"
291 }
292
293 foreach {label a b} $upDifferent {
294 up_show $label $a $b
295 fossil ls $b
296 test_predict up unicode-pathnames-off-$label-ls [normalize_result] ""
297 fossil cat $b -expectError
298 test_predict up unicode-pathnames-off-$label-cat $CODE 1
299 fossil rm --soft -n $b
300 test_predict up unicode-pathnames-off-$label-rm [normalize_result] ""
301 }
302
303 # A file on disk under the other spelling is not an extra file, and
304 # "fossil add" does not add it. Needs a volume that stores two names.
305 #
@@ -326,14 +316,14 @@
316 continue
317 }
318 file mkdir [file dirname $b]
319 write_file $b "other spelling\n"
320 fossil extras
321 test_predict up unicode-pathnames-off-$label-extras [normalize_result] ""
322 fossil add $b
323 fossil changes
324 test_predict up unicode-pathnames-off-$label-add [normalize_result] ""
325 fossil revert
326 file delete $b
327 if {[file dirname $b] ne "."} {
328 catch {file delete [file dirname $b]}
329 }
@@ -375,19 +365,19 @@
365 set upBoth [up_new_version]
366
367 fossil settings case-sensitive 0
368 write_file plain.txt "edited\n"
369 fossil commit -m "edit plain.txt" -expectError
370 test_predict up unicode-pathnames-collide-$label-commit $CODE 1
371
372 fossil settings case-sensitive 1
373 fossil revert
374 fossil update $upFirst
375 fossil settings case-sensitive 0
376 fossil update $upBoth -expectError
377 test_predict up unicode-pathnames-collide-$label-update $CODE 1
378 test_predict up unicode-pathnames-collide-$label-update-file \
379 [file exists $b] 0
380 }
381 if {[llength $upOneFile] > 0} {
382 test_skip_part "commit and update tests of [join $upOneFile {, }]:\
383 filesystem type or argv rewriting has one name for both spellings\
384
--- test/unversioned.test
+++ test/unversioned.test
@@ -58,31 +58,31 @@
5858
unversioned add|cat|edit|export|list|revert|remove|sync|touch}]}
5959
6060
###############################################################################
6161
6262
fossil unversioned list
63
-test unversioned-2 {[normalize_result] eq {}}
63
+test_eq unversioned-2 [normalize_result] {}
6464
6565
###############################################################################
6666
6767
fossil unversioned cat not-found.txt
68
-test unversioned-3 {[normalize_result] eq {}}
68
+test_eq unversioned-3 [normalize_result] {}
6969
7070
###############################################################################
7171
7272
fossil unversioned cat unversioned1.txt
73
-test unversioned-4 {[normalize_result] eq {}}
73
+test_eq unversioned-4 [normalize_result] {}
7474
7575
###############################################################################
7676
7777
fossil unversioned add unversioned1.txt
78
-test unversioned-5 {[normalize_result] eq {}}
78
+test_eq unversioned-5 [normalize_result] {}
7979
8080
###############################################################################
8181
8282
fossil unversioned cat unversioned1.txt
83
-test unversioned-6 {[normalize_result] eq {This is unversioned file #1.}}
83
+test_eq unversioned-6 [normalize_result] {This is unversioned file #1.}
8484
8585
###############################################################################
8686
8787
fossil unversioned list
8888
test unversioned-7 {[regexp \
@@ -90,26 +90,26 @@
9090
unversioned1\.txt$} [normalize_result]]}
9191
9292
###############################################################################
9393
9494
fossil unversioned ls
95
-test unversioned-8 {[normalize_result] eq {unversioned1.txt}}
95
+test_eq unversioned-8 [normalize_result] {unversioned1.txt}
9696
9797
###############################################################################
9898
9999
fossil unversioned remove unversioned1.txt
100
-test unversioned-9 {[normalize_result] eq {}}
100
+test_eq unversioned-9 [normalize_result] {}
101101
102102
###############################################################################
103103
104104
fossil unversioned list
105
-test unversioned-10 {[normalize_result] eq {}}
105
+test_eq unversioned-10 [normalize_result] {}
106106
107107
###############################################################################
108108
109109
fossil unversioned ls
110
-test unversioned-11 {[normalize_result] eq {}}
110
+test_eq unversioned-11 [normalize_result] {}
111111
112112
###############################################################################
113113
114114
fossil unversioned list --all
115115
test unversioned-12 {[regexp \
@@ -117,11 +117,11 @@
117117
unversioned1\.txt$} [normalize_result]]}
118118
119119
###############################################################################
120120
121121
fossil unversioned ls --all
122
-test unversioned-13 {[normalize_result] eq {unversioned1.txt}}
122
+test_eq unversioned-13 [normalize_result] {unversioned1.txt}
123123
124124
###############################################################################
125125
126126
fossil unversioned add "unversioned space.txt" -expectError
127127
test unversioned-14 {[normalize_result] eq \
@@ -128,11 +128,11 @@
128128
{unversioned filenames may not contain whitespace: 'unversioned space.txt'}}
129129
130130
###############################################################################
131131
132132
fossil unversioned add "unversioned space.txt" --as unversioned3.txt
133
-test unversioned-15 {[normalize_result] eq {}}
133
+test_eq unversioned-15 [normalize_result] {}
134134
135135
###############################################################################
136136
137137
fossil unversioned list
138138
test unversioned-16 {[regexp \
@@ -147,16 +147,16 @@
147147
unversioned3\.txt$} [normalize_result]]}
148148
149149
###############################################################################
150150
151151
fossil unversioned ls
152
-test unversioned-18 {[normalize_result] eq {unversioned3.txt}}
152
+test_eq unversioned-18 [normalize_result] {unversioned3.txt}
153153
154154
###############################################################################
155155
156156
fossil unversioned add unversioned2.txt --mtime 2016-10-01
157
-test unversioned-19 {[normalize_result] eq {}}
157
+test_eq unversioned-19 [normalize_result] {}
158158
159159
###############################################################################
160160
161161
fossil unversioned list
162162
test unversioned-20 {[regexp \
@@ -166,17 +166,18 @@
166166
unversioned3\.txt$} [normalize_result]]}
167167
168168
###############################################################################
169169
170170
fossil unversioned ls
171
-test unversioned-21 {[normalize_result] eq {unversioned2.txt
172
-unversioned3.txt}}
171
+test_eq unversioned-21 [normalize_result] \
172
+ {unversioned2.txt
173
+unversioned3.txt}
173174
174175
###############################################################################
175176
176177
fossil unversioned cat unversioned1.txt
177
-test unversioned-22 {[normalize_result] eq {}}
178
+test_eq unversioned-22 [normalize_result] {}
178179
179180
###############################################################################
180181
181182
fossil unversioned cat unversioned2.txt
182183
test unversioned-23 {[sha1_text $RESULT] eq \
@@ -189,16 +190,16 @@
189190
{c6b95509120d9703cc4fbe5cdfcb435b5912b3e4}}
190191
191192
###############################################################################
192193
193194
fossil unversioned rm unversioned3.txt
194
-test unversioned-25 {[normalize_result] eq {}}
195
+test_eq unversioned-25 [normalize_result] {}
195196
196197
###############################################################################
197198
198199
fossil unversioned add unversioned4.txt
199
-test unversioned-26 {[normalize_result] eq {}}
200
+test_eq unversioned-26 [normalize_result] {}
200201
201202
###############################################################################
202203
203204
fossil unversioned cat unversioned4.txt
204205
set hash(before) [sha1_text $RESULT]
@@ -206,11 +207,11 @@
206207
{b48ba8e2d0b498321dfd13de84867effda399af5}}
207208
208209
###############################################################################
209210
210211
fossil unversioned edit unversioned4.txt
211
-test unversioned-28 {[normalize_result] eq {}}
212
+test_eq unversioned-28 [normalize_result] {}
212213
213214
###############################################################################
214215
215216
fossil unversioned cat unversioned4.txt
216217
set hash(after) [sha1_text $RESULT]
@@ -218,11 +219,11 @@
218219
test unversioned-30 {[regexp { \d+ (?:-)?\d+$} $RESULT]}
219220
220221
###############################################################################
221222
222223
fossil unversioned edit unversioned4.txt --mtime 2016-10-01
223
-test unversioned-31 {[normalize_result] eq {}}
224
+test_eq unversioned-31 [normalize_result] {}
224225
225226
###############################################################################
226227
227228
fossil unversioned cat unversioned4.txt
228229
test unversioned-32 {[regexp { \d+ (?:-)?\d+ \d+ (?:-)?\d+$} $RESULT]}
@@ -237,11 +238,11 @@
237238
unversioned4\.txt$} [normalize_result]]}
238239
239240
###############################################################################
240241
241242
fossil unversioned export unversioned2.txt unversioned2-ex.txt
242
-test unversioned-34 {[normalize_result] eq {}}
243
+test_eq unversioned-34 [normalize_result] {}
243244
test unversioned-35 {[sha1_file unversioned2-ex.txt] eq \
244245
{962f96ebd613e4fdd9aa2d20bd9fe21a64e925f2}}
245246
246247
###############################################################################
247248
@@ -257,11 +258,11 @@
257258
[0-9a-f]{40,64}$} [normalize_result]]}
258259
259260
###############################################################################
260261
261262
fossil unversioned remove unversioned4.txt --mtime "2016-10-02 13:47:29"
262
-test unversioned-38 {[normalize_result] eq {}}
263
+test_eq unversioned-38 [normalize_result] {}
263264
264265
###############################################################################
265266
266267
fossil unversioned list --all
267268
test unversioned-39 {[regexp \
@@ -274,11 +275,11 @@
274275
[normalize_result]]}
275276
276277
###############################################################################
277278
278279
fossil unversioned touch unversioned1.txt --mtime "2016-10-03 23:01:44"
279
-test unversioned-40 {[normalize_result] eq {}}
280
+test_eq unversioned-40 [normalize_result] {}
280281
281282
###############################################################################
282283
283284
fossil unversioned list --all
284285
test unversioned-41 {[regexp \
@@ -291,16 +292,16 @@
291292
[normalize_result]]}
292293
293294
###############################################################################
294295
295296
fossil unversioned add unversioned5.txt
296
-test unversioned-42 {[normalize_result] eq {}}
297
+test_eq unversioned-42 [normalize_result] {}
297298
298299
###############################################################################
299300
300301
fossil unversioned touch unversioned5.txt
301
-test unversioned-43 {[normalize_result] eq {}}
302
+test_eq unversioned-43 [normalize_result] {}
302303
303304
###############################################################################
304305
305306
fossil unversioned list
306307
test unversioned-44 {[regexp \
@@ -322,11 +323,12 @@
322323
\"fossil server\" cannot start a server."
323324
}
324325
325326
foreach {pid port outTmpFile} [test_start_server $repository stopArg] {}
326327
if {! $::QUIET} {
327
- puts [appendArgs "Started Fossil server, pid \"" $pid \" ", port \"" $port \".]
328
+ puts [appendArgs "Started Fossil server, pid \"" $pid \" ", port \"" \
329
+ $port \".]
328330
}
329331
set remote [appendArgs http://uvtester: $password @localhost: $port /]
330332
331333
###############################################################################
332334
@@ -346,11 +348,11 @@
346348
fossil open -f uvrepo.fossil
347349
348350
###############################################################################
349351
350352
fossil unversioned list
351
-test unversioned-45 {[normalize_result] eq {}}
353
+test_eq unversioned-45 [normalize_result] {}
352354
353355
###############################################################################
354356
355357
fossil_maybe_answer y unversioned sync $remote
356358
test unversioned-46 {[regexp \
@@ -359,19 +361,20 @@
359361
[normalize_result]]}
360362
361363
###############################################################################
362364
363365
fossil unversioned ls
364
-test unversioned-47 {[normalize_result] eq {unversioned2.txt
365
-unversioned5.txt}}
366
+test_eq unversioned-47 [normalize_result] \
367
+ {unversioned2.txt
368
+unversioned5.txt}
366369
367370
###############################################################################
368371
369372
set env(FAKE_EDITOR_SCRIPT) "append data this_is_a_test"; # deterministic
370373
371374
fossil unversioned edit unversioned2.txt
372
-test unversioned-48 {[normalize_result] eq {}}
375
+test_eq unversioned-48 [normalize_result] {}
373376
374377
unset env(FAKE_EDITOR_SCRIPT)
375378
376379
###############################################################################
377380
@@ -380,11 +383,11 @@
380383
{e15d4b576fc04e3bb5e44a33d44d104dd5b19428}}
381384
382385
###############################################################################
383386
384387
fossil unversioned remove unversioned5.txt
385
-test unversioned-50 {[normalize_result] eq {}}
388
+test_eq unversioned-50 [normalize_result] {}
386389
387390
###############################################################################
388391
389392
fossil unversioned list --all
390393
test unversioned-51 {[regexp \
@@ -411,11 +414,11 @@
411414
unversioned5\.txt$} [normalize_result]]}
412415
413416
###############################################################################
414417
415418
fossil unversioned add unversioned-client1.txt
416
-test unversioned-54 {[normalize_result] eq {}}
419
+test_eq unversioned-54 [normalize_result] {}
417420
418421
###############################################################################
419422
420423
fossil_maybe_answer y unversioned sync $remote
421424
test unversioned-55 {[regexp \
@@ -424,11 +427,11 @@
424427
[normalize_result]]}
425428
426429
###############################################################################
427430
428431
fossil close
429
-test unversioned-56 {[normalize_result] eq {}}
432
+test_eq unversioned-56 [normalize_result] {}
430433
431434
###############################################################################
432435
433436
cd $savedPwd; unset savedPwd
434437
file delete -force $clientDir
435438
--- test/unversioned.test
+++ test/unversioned.test
@@ -58,31 +58,31 @@
58 unversioned add|cat|edit|export|list|revert|remove|sync|touch}]}
59
60 ###############################################################################
61
62 fossil unversioned list
63 test unversioned-2 {[normalize_result] eq {}}
64
65 ###############################################################################
66
67 fossil unversioned cat not-found.txt
68 test unversioned-3 {[normalize_result] eq {}}
69
70 ###############################################################################
71
72 fossil unversioned cat unversioned1.txt
73 test unversioned-4 {[normalize_result] eq {}}
74
75 ###############################################################################
76
77 fossil unversioned add unversioned1.txt
78 test unversioned-5 {[normalize_result] eq {}}
79
80 ###############################################################################
81
82 fossil unversioned cat unversioned1.txt
83 test unversioned-6 {[normalize_result] eq {This is unversioned file #1.}}
84
85 ###############################################################################
86
87 fossil unversioned list
88 test unversioned-7 {[regexp \
@@ -90,26 +90,26 @@
90 unversioned1\.txt$} [normalize_result]]}
91
92 ###############################################################################
93
94 fossil unversioned ls
95 test unversioned-8 {[normalize_result] eq {unversioned1.txt}}
96
97 ###############################################################################
98
99 fossil unversioned remove unversioned1.txt
100 test unversioned-9 {[normalize_result] eq {}}
101
102 ###############################################################################
103
104 fossil unversioned list
105 test unversioned-10 {[normalize_result] eq {}}
106
107 ###############################################################################
108
109 fossil unversioned ls
110 test unversioned-11 {[normalize_result] eq {}}
111
112 ###############################################################################
113
114 fossil unversioned list --all
115 test unversioned-12 {[regexp \
@@ -117,11 +117,11 @@
117 unversioned1\.txt$} [normalize_result]]}
118
119 ###############################################################################
120
121 fossil unversioned ls --all
122 test unversioned-13 {[normalize_result] eq {unversioned1.txt}}
123
124 ###############################################################################
125
126 fossil unversioned add "unversioned space.txt" -expectError
127 test unversioned-14 {[normalize_result] eq \
@@ -128,11 +128,11 @@
128 {unversioned filenames may not contain whitespace: 'unversioned space.txt'}}
129
130 ###############################################################################
131
132 fossil unversioned add "unversioned space.txt" --as unversioned3.txt
133 test unversioned-15 {[normalize_result] eq {}}
134
135 ###############################################################################
136
137 fossil unversioned list
138 test unversioned-16 {[regexp \
@@ -147,16 +147,16 @@
147 unversioned3\.txt$} [normalize_result]]}
148
149 ###############################################################################
150
151 fossil unversioned ls
152 test unversioned-18 {[normalize_result] eq {unversioned3.txt}}
153
154 ###############################################################################
155
156 fossil unversioned add unversioned2.txt --mtime 2016-10-01
157 test unversioned-19 {[normalize_result] eq {}}
158
159 ###############################################################################
160
161 fossil unversioned list
162 test unversioned-20 {[regexp \
@@ -166,17 +166,18 @@
166 unversioned3\.txt$} [normalize_result]]}
167
168 ###############################################################################
169
170 fossil unversioned ls
171 test unversioned-21 {[normalize_result] eq {unversioned2.txt
172 unversioned3.txt}}
 
173
174 ###############################################################################
175
176 fossil unversioned cat unversioned1.txt
177 test unversioned-22 {[normalize_result] eq {}}
178
179 ###############################################################################
180
181 fossil unversioned cat unversioned2.txt
182 test unversioned-23 {[sha1_text $RESULT] eq \
@@ -189,16 +190,16 @@
189 {c6b95509120d9703cc4fbe5cdfcb435b5912b3e4}}
190
191 ###############################################################################
192
193 fossil unversioned rm unversioned3.txt
194 test unversioned-25 {[normalize_result] eq {}}
195
196 ###############################################################################
197
198 fossil unversioned add unversioned4.txt
199 test unversioned-26 {[normalize_result] eq {}}
200
201 ###############################################################################
202
203 fossil unversioned cat unversioned4.txt
204 set hash(before) [sha1_text $RESULT]
@@ -206,11 +207,11 @@
206 {b48ba8e2d0b498321dfd13de84867effda399af5}}
207
208 ###############################################################################
209
210 fossil unversioned edit unversioned4.txt
211 test unversioned-28 {[normalize_result] eq {}}
212
213 ###############################################################################
214
215 fossil unversioned cat unversioned4.txt
216 set hash(after) [sha1_text $RESULT]
@@ -218,11 +219,11 @@
218 test unversioned-30 {[regexp { \d+ (?:-)?\d+$} $RESULT]}
219
220 ###############################################################################
221
222 fossil unversioned edit unversioned4.txt --mtime 2016-10-01
223 test unversioned-31 {[normalize_result] eq {}}
224
225 ###############################################################################
226
227 fossil unversioned cat unversioned4.txt
228 test unversioned-32 {[regexp { \d+ (?:-)?\d+ \d+ (?:-)?\d+$} $RESULT]}
@@ -237,11 +238,11 @@
237 unversioned4\.txt$} [normalize_result]]}
238
239 ###############################################################################
240
241 fossil unversioned export unversioned2.txt unversioned2-ex.txt
242 test unversioned-34 {[normalize_result] eq {}}
243 test unversioned-35 {[sha1_file unversioned2-ex.txt] eq \
244 {962f96ebd613e4fdd9aa2d20bd9fe21a64e925f2}}
245
246 ###############################################################################
247
@@ -257,11 +258,11 @@
257 [0-9a-f]{40,64}$} [normalize_result]]}
258
259 ###############################################################################
260
261 fossil unversioned remove unversioned4.txt --mtime "2016-10-02 13:47:29"
262 test unversioned-38 {[normalize_result] eq {}}
263
264 ###############################################################################
265
266 fossil unversioned list --all
267 test unversioned-39 {[regexp \
@@ -274,11 +275,11 @@
274 [normalize_result]]}
275
276 ###############################################################################
277
278 fossil unversioned touch unversioned1.txt --mtime "2016-10-03 23:01:44"
279 test unversioned-40 {[normalize_result] eq {}}
280
281 ###############################################################################
282
283 fossil unversioned list --all
284 test unversioned-41 {[regexp \
@@ -291,16 +292,16 @@
291 [normalize_result]]}
292
293 ###############################################################################
294
295 fossil unversioned add unversioned5.txt
296 test unversioned-42 {[normalize_result] eq {}}
297
298 ###############################################################################
299
300 fossil unversioned touch unversioned5.txt
301 test unversioned-43 {[normalize_result] eq {}}
302
303 ###############################################################################
304
305 fossil unversioned list
306 test unversioned-44 {[regexp \
@@ -322,11 +323,12 @@
322 \"fossil server\" cannot start a server."
323 }
324
325 foreach {pid port outTmpFile} [test_start_server $repository stopArg] {}
326 if {! $::QUIET} {
327 puts [appendArgs "Started Fossil server, pid \"" $pid \" ", port \"" $port \".]
 
328 }
329 set remote [appendArgs http://uvtester: $password @localhost: $port /]
330
331 ###############################################################################
332
@@ -346,11 +348,11 @@
346 fossil open -f uvrepo.fossil
347
348 ###############################################################################
349
350 fossil unversioned list
351 test unversioned-45 {[normalize_result] eq {}}
352
353 ###############################################################################
354
355 fossil_maybe_answer y unversioned sync $remote
356 test unversioned-46 {[regexp \
@@ -359,19 +361,20 @@
359 [normalize_result]]}
360
361 ###############################################################################
362
363 fossil unversioned ls
364 test unversioned-47 {[normalize_result] eq {unversioned2.txt
365 unversioned5.txt}}
 
366
367 ###############################################################################
368
369 set env(FAKE_EDITOR_SCRIPT) "append data this_is_a_test"; # deterministic
370
371 fossil unversioned edit unversioned2.txt
372 test unversioned-48 {[normalize_result] eq {}}
373
374 unset env(FAKE_EDITOR_SCRIPT)
375
376 ###############################################################################
377
@@ -380,11 +383,11 @@
380 {e15d4b576fc04e3bb5e44a33d44d104dd5b19428}}
381
382 ###############################################################################
383
384 fossil unversioned remove unversioned5.txt
385 test unversioned-50 {[normalize_result] eq {}}
386
387 ###############################################################################
388
389 fossil unversioned list --all
390 test unversioned-51 {[regexp \
@@ -411,11 +414,11 @@
411 unversioned5\.txt$} [normalize_result]]}
412
413 ###############################################################################
414
415 fossil unversioned add unversioned-client1.txt
416 test unversioned-54 {[normalize_result] eq {}}
417
418 ###############################################################################
419
420 fossil_maybe_answer y unversioned sync $remote
421 test unversioned-55 {[regexp \
@@ -424,11 +427,11 @@
424 [normalize_result]]}
425
426 ###############################################################################
427
428 fossil close
429 test unversioned-56 {[normalize_result] eq {}}
430
431 ###############################################################################
432
433 cd $savedPwd; unset savedPwd
434 file delete -force $clientDir
435
--- test/unversioned.test
+++ test/unversioned.test
@@ -58,31 +58,31 @@
58 unversioned add|cat|edit|export|list|revert|remove|sync|touch}]}
59
60 ###############################################################################
61
62 fossil unversioned list
63 test_eq unversioned-2 [normalize_result] {}
64
65 ###############################################################################
66
67 fossil unversioned cat not-found.txt
68 test_eq unversioned-3 [normalize_result] {}
69
70 ###############################################################################
71
72 fossil unversioned cat unversioned1.txt
73 test_eq unversioned-4 [normalize_result] {}
74
75 ###############################################################################
76
77 fossil unversioned add unversioned1.txt
78 test_eq unversioned-5 [normalize_result] {}
79
80 ###############################################################################
81
82 fossil unversioned cat unversioned1.txt
83 test_eq unversioned-6 [normalize_result] {This is unversioned file #1.}
84
85 ###############################################################################
86
87 fossil unversioned list
88 test unversioned-7 {[regexp \
@@ -90,26 +90,26 @@
90 unversioned1\.txt$} [normalize_result]]}
91
92 ###############################################################################
93
94 fossil unversioned ls
95 test_eq unversioned-8 [normalize_result] {unversioned1.txt}
96
97 ###############################################################################
98
99 fossil unversioned remove unversioned1.txt
100 test_eq unversioned-9 [normalize_result] {}
101
102 ###############################################################################
103
104 fossil unversioned list
105 test_eq unversioned-10 [normalize_result] {}
106
107 ###############################################################################
108
109 fossil unversioned ls
110 test_eq unversioned-11 [normalize_result] {}
111
112 ###############################################################################
113
114 fossil unversioned list --all
115 test unversioned-12 {[regexp \
@@ -117,11 +117,11 @@
117 unversioned1\.txt$} [normalize_result]]}
118
119 ###############################################################################
120
121 fossil unversioned ls --all
122 test_eq unversioned-13 [normalize_result] {unversioned1.txt}
123
124 ###############################################################################
125
126 fossil unversioned add "unversioned space.txt" -expectError
127 test unversioned-14 {[normalize_result] eq \
@@ -128,11 +128,11 @@
128 {unversioned filenames may not contain whitespace: 'unversioned space.txt'}}
129
130 ###############################################################################
131
132 fossil unversioned add "unversioned space.txt" --as unversioned3.txt
133 test_eq unversioned-15 [normalize_result] {}
134
135 ###############################################################################
136
137 fossil unversioned list
138 test unversioned-16 {[regexp \
@@ -147,16 +147,16 @@
147 unversioned3\.txt$} [normalize_result]]}
148
149 ###############################################################################
150
151 fossil unversioned ls
152 test_eq unversioned-18 [normalize_result] {unversioned3.txt}
153
154 ###############################################################################
155
156 fossil unversioned add unversioned2.txt --mtime 2016-10-01
157 test_eq unversioned-19 [normalize_result] {}
158
159 ###############################################################################
160
161 fossil unversioned list
162 test unversioned-20 {[regexp \
@@ -166,17 +166,18 @@
166 unversioned3\.txt$} [normalize_result]]}
167
168 ###############################################################################
169
170 fossil unversioned ls
171 test_eq unversioned-21 [normalize_result] \
172 {unversioned2.txt
173 unversioned3.txt}
174
175 ###############################################################################
176
177 fossil unversioned cat unversioned1.txt
178 test_eq unversioned-22 [normalize_result] {}
179
180 ###############################################################################
181
182 fossil unversioned cat unversioned2.txt
183 test unversioned-23 {[sha1_text $RESULT] eq \
@@ -189,16 +190,16 @@
190 {c6b95509120d9703cc4fbe5cdfcb435b5912b3e4}}
191
192 ###############################################################################
193
194 fossil unversioned rm unversioned3.txt
195 test_eq unversioned-25 [normalize_result] {}
196
197 ###############################################################################
198
199 fossil unversioned add unversioned4.txt
200 test_eq unversioned-26 [normalize_result] {}
201
202 ###############################################################################
203
204 fossil unversioned cat unversioned4.txt
205 set hash(before) [sha1_text $RESULT]
@@ -206,11 +207,11 @@
207 {b48ba8e2d0b498321dfd13de84867effda399af5}}
208
209 ###############################################################################
210
211 fossil unversioned edit unversioned4.txt
212 test_eq unversioned-28 [normalize_result] {}
213
214 ###############################################################################
215
216 fossil unversioned cat unversioned4.txt
217 set hash(after) [sha1_text $RESULT]
@@ -218,11 +219,11 @@
219 test unversioned-30 {[regexp { \d+ (?:-)?\d+$} $RESULT]}
220
221 ###############################################################################
222
223 fossil unversioned edit unversioned4.txt --mtime 2016-10-01
224 test_eq unversioned-31 [normalize_result] {}
225
226 ###############################################################################
227
228 fossil unversioned cat unversioned4.txt
229 test unversioned-32 {[regexp { \d+ (?:-)?\d+ \d+ (?:-)?\d+$} $RESULT]}
@@ -237,11 +238,11 @@
238 unversioned4\.txt$} [normalize_result]]}
239
240 ###############################################################################
241
242 fossil unversioned export unversioned2.txt unversioned2-ex.txt
243 test_eq unversioned-34 [normalize_result] {}
244 test unversioned-35 {[sha1_file unversioned2-ex.txt] eq \
245 {962f96ebd613e4fdd9aa2d20bd9fe21a64e925f2}}
246
247 ###############################################################################
248
@@ -257,11 +258,11 @@
258 [0-9a-f]{40,64}$} [normalize_result]]}
259
260 ###############################################################################
261
262 fossil unversioned remove unversioned4.txt --mtime "2016-10-02 13:47:29"
263 test_eq unversioned-38 [normalize_result] {}
264
265 ###############################################################################
266
267 fossil unversioned list --all
268 test unversioned-39 {[regexp \
@@ -274,11 +275,11 @@
275 [normalize_result]]}
276
277 ###############################################################################
278
279 fossil unversioned touch unversioned1.txt --mtime "2016-10-03 23:01:44"
280 test_eq unversioned-40 [normalize_result] {}
281
282 ###############################################################################
283
284 fossil unversioned list --all
285 test unversioned-41 {[regexp \
@@ -291,16 +292,16 @@
292 [normalize_result]]}
293
294 ###############################################################################
295
296 fossil unversioned add unversioned5.txt
297 test_eq unversioned-42 [normalize_result] {}
298
299 ###############################################################################
300
301 fossil unversioned touch unversioned5.txt
302 test_eq unversioned-43 [normalize_result] {}
303
304 ###############################################################################
305
306 fossil unversioned list
307 test unversioned-44 {[regexp \
@@ -322,11 +323,12 @@
323 \"fossil server\" cannot start a server."
324 }
325
326 foreach {pid port outTmpFile} [test_start_server $repository stopArg] {}
327 if {! $::QUIET} {
328 puts [appendArgs "Started Fossil server, pid \"" $pid \" ", port \"" \
329 $port \".]
330 }
331 set remote [appendArgs http://uvtester: $password @localhost: $port /]
332
333 ###############################################################################
334
@@ -346,11 +348,11 @@
348 fossil open -f uvrepo.fossil
349
350 ###############################################################################
351
352 fossil unversioned list
353 test_eq unversioned-45 [normalize_result] {}
354
355 ###############################################################################
356
357 fossil_maybe_answer y unversioned sync $remote
358 test unversioned-46 {[regexp \
@@ -359,19 +361,20 @@
361 [normalize_result]]}
362
363 ###############################################################################
364
365 fossil unversioned ls
366 test_eq unversioned-47 [normalize_result] \
367 {unversioned2.txt
368 unversioned5.txt}
369
370 ###############################################################################
371
372 set env(FAKE_EDITOR_SCRIPT) "append data this_is_a_test"; # deterministic
373
374 fossil unversioned edit unversioned2.txt
375 test_eq unversioned-48 [normalize_result] {}
376
377 unset env(FAKE_EDITOR_SCRIPT)
378
379 ###############################################################################
380
@@ -380,11 +383,11 @@
383 {e15d4b576fc04e3bb5e44a33d44d104dd5b19428}}
384
385 ###############################################################################
386
387 fossil unversioned remove unversioned5.txt
388 test_eq unversioned-50 [normalize_result] {}
389
390 ###############################################################################
391
392 fossil unversioned list --all
393 test unversioned-51 {[regexp \
@@ -411,11 +414,11 @@
414 unversioned5\.txt$} [normalize_result]]}
415
416 ###############################################################################
417
418 fossil unversioned add unversioned-client1.txt
419 test_eq unversioned-54 [normalize_result] {}
420
421 ###############################################################################
422
423 fossil_maybe_answer y unversioned sync $remote
424 test unversioned-55 {[regexp \
@@ -424,11 +427,11 @@
427 [normalize_result]]}
428
429 ###############################################################################
430
431 fossil close
432 test_eq unversioned-56 [normalize_result] {}
433
434 ###############################################################################
435
436 cd $savedPwd; unset savedPwd
437 file delete -force $clientDir
438
--- test/update.test
+++ test/update.test
@@ -28,15 +28,17 @@
2828
fossil revert
2929
fossil update
3030
return [format "test-%02u-%s.txt" $UPDATE_TEST $desc]
3131
}
3232
33
-# The output is in file name order, so massage $RESULT to remove initial UNCHANGED
33
+# The output is in file name order, so massage $RESULT to remove initial
34
+# UNCHANGED
3435
# files. Only do this if we have the expected branch information.
3536
proc test_update {testname message changes {fossil_args ""}} {
3637
fossil update --verbose {*}$fossil_args
37
- if { [regsub {\n-{79}\nupdated-from: [0-9a-z]{40} .*} $::RESULT {} test_result ] } {
38
+ if { [regsub {\n-{79}\nupdated-from: [0-9a-z]{40} .*} $::RESULT {} \
39
+ test_result ] } {
3840
regsub {^(?:UNCHANGED [-a-z0-9.]+\n)*} $test_result {} test_result
3941
} else {
4042
set test_result $::RESULT
4143
}
4244
test "update-message-$testname" {$message == $test_result}
@@ -65,11 +67,11 @@
6567
# Remaining tests are carried out in the order update_cmd() performs checks.
6668
#
6769
# Common approach for tests below:
6870
# 1. Set the testname
6971
# 2. Set the file name, done by calling update_setup
70
-# 3. Set message and changes, the expected message message and subsequent changes
72
+# 3. Set message and changes, the expected message and subsequent changes
7173
# 3. Optionally set up and commit a common base for the next steps
7274
# 4. Commit a change to the repository (new tip)
7375
# 5. Update to the previous version
7476
# 6. Make changes
7577
# 7. Call test_update to attempt and update to tip
@@ -87,11 +89,14 @@
8789
fossil add $fname
8890
test_update $testname $message $changes -expectError
8991
9092
set testname "add-overwrites"
9193
set fname [test_update_setup $testname]
92
-set message "ADD $fname - overwrites an unmanaged file, original copy backed up as \"./$fname-original\""
94
+set message \
95
+ [join [list \
96
+ "ADD $fname - overwrites an unmanaged file, original copy " \
97
+ "backed up as \"./$fname-original\""] ""]
9398
set changes ""
9499
write_seq_to_file $fname
95100
fossil add $fname
96101
fossil commit -m "Add $fname"
97102
fossil up previous
98103
--- test/update.test
+++ test/update.test
@@ -28,15 +28,17 @@
28 fossil revert
29 fossil update
30 return [format "test-%02u-%s.txt" $UPDATE_TEST $desc]
31 }
32
33 # The output is in file name order, so massage $RESULT to remove initial UNCHANGED
 
34 # files. Only do this if we have the expected branch information.
35 proc test_update {testname message changes {fossil_args ""}} {
36 fossil update --verbose {*}$fossil_args
37 if { [regsub {\n-{79}\nupdated-from: [0-9a-z]{40} .*} $::RESULT {} test_result ] } {
 
38 regsub {^(?:UNCHANGED [-a-z0-9.]+\n)*} $test_result {} test_result
39 } else {
40 set test_result $::RESULT
41 }
42 test "update-message-$testname" {$message == $test_result}
@@ -65,11 +67,11 @@
65 # Remaining tests are carried out in the order update_cmd() performs checks.
66 #
67 # Common approach for tests below:
68 # 1. Set the testname
69 # 2. Set the file name, done by calling update_setup
70 # 3. Set message and changes, the expected message message and subsequent changes
71 # 3. Optionally set up and commit a common base for the next steps
72 # 4. Commit a change to the repository (new tip)
73 # 5. Update to the previous version
74 # 6. Make changes
75 # 7. Call test_update to attempt and update to tip
@@ -87,11 +89,14 @@
87 fossil add $fname
88 test_update $testname $message $changes -expectError
89
90 set testname "add-overwrites"
91 set fname [test_update_setup $testname]
92 set message "ADD $fname - overwrites an unmanaged file, original copy backed up as \"./$fname-original\""
 
 
 
93 set changes ""
94 write_seq_to_file $fname
95 fossil add $fname
96 fossil commit -m "Add $fname"
97 fossil up previous
98
--- test/update.test
+++ test/update.test
@@ -28,15 +28,17 @@
28 fossil revert
29 fossil update
30 return [format "test-%02u-%s.txt" $UPDATE_TEST $desc]
31 }
32
33 # The output is in file name order, so massage $RESULT to remove initial
34 # UNCHANGED
35 # files. Only do this if we have the expected branch information.
36 proc test_update {testname message changes {fossil_args ""}} {
37 fossil update --verbose {*}$fossil_args
38 if { [regsub {\n-{79}\nupdated-from: [0-9a-z]{40} .*} $::RESULT {} \
39 test_result ] } {
40 regsub {^(?:UNCHANGED [-a-z0-9.]+\n)*} $test_result {} test_result
41 } else {
42 set test_result $::RESULT
43 }
44 test "update-message-$testname" {$message == $test_result}
@@ -65,11 +67,11 @@
67 # Remaining tests are carried out in the order update_cmd() performs checks.
68 #
69 # Common approach for tests below:
70 # 1. Set the testname
71 # 2. Set the file name, done by calling update_setup
72 # 3. Set message and changes, the expected message and subsequent changes
73 # 3. Optionally set up and commit a common base for the next steps
74 # 4. Commit a change to the repository (new tip)
75 # 5. Update to the previous version
76 # 6. Make changes
77 # 7. Call test_update to attempt and update to tip
@@ -87,11 +89,14 @@
89 fossil add $fname
90 test_update $testname $message $changes -expectError
91
92 set testname "add-overwrites"
93 set fname [test_update_setup $testname]
94 set message \
95 [join [list \
96 "ADD $fname - overwrites an unmanaged file, original copy " \
97 "backed up as \"./$fname-original\""] ""]
98 set changes ""
99 write_seq_to_file $fname
100 fossil add $fname
101 fossil commit -m "Add $fname"
102 fossil up previous
103
+5 -12
--- test/utf.test
+++ test/utf.test
@@ -555,11 +555,12 @@
555555
set flags [expr {$flags | 0x40}]
556556
}
557557
return $flags
558558
}
559559
560
-# Predict the dict of output fields for raw BYTES (path used only for size line).
560
+# Predict the dict of output fields for raw BYTES (path used only for size
561
+# line).
561562
proc utf_predict {bytes} {
562563
set n [string length $bytes]
563564
set fUtf8 [utf_starts_with_utf8_bom $bytes]
564565
lassign [utf_starts_with_utf16_bom $bytes] fUtf16 bRev
565566
lassign [utf_could_be_utf16 $bytes] fUnicode bRev2
@@ -599,11 +600,12 @@
599600
foreach line [split [string map [list \r\n \n] $text] \n] {
600601
if {[regexp {^File ".*" has (\d+) bytes\.$} $line -> n]} {
601602
dict set d bytes $n
602603
} elseif {[regexp {^Starts with UTF-8 BOM: (yes|no)$} $line -> v]} {
603604
dict set d utf8_bom $v
604
- } elseif {[regexp {^Starts with UTF-16 BOM: (yes|no|reversed)$} $line -> v]} {
605
+ } elseif {[regexp {^Starts with UTF-16 BOM: (yes|no|reversed)$} $line -> \
606
+ v]} {
605607
dict set d utf16_bom $v
606608
} elseif {[regexp {^Looks like UTF-(8|16): (yes|no)$} $line -> k v]} {
607609
dict set d looks_kind $k
608610
dict set d looks_like $v
609611
} elseif {[regexp {^Has flag (LOOK_[A-Z_]+): (yes|no)$} $line -> f v]} {
@@ -611,19 +613,10 @@
611613
}
612614
}
613615
return $d
614616
}
615617
616
-proc utf_expect {name actual expected} {
617
- set ok [expr {$actual eq $expected}]
618
- if {$ok} {
619
- incr ::utfPredMet
620
- } else {
621
- incr ::utfPredUnmet
622
- }
623
- test_eq $name $actual $expected
624
-}
625618
626619
# Compare every predicted field to fossil output (yes and no).
627620
proc utf_check_cell {label bytes path} {
628621
utf_write_bytes $path $bytes
629622
set pred [utf_predict $bytes]
@@ -632,11 +625,11 @@
632625
foreach key {bytes utf8_bom utf16_bom looks_kind looks_like \
633626
LOOK_NUL LOOK_CR LOOK_LONE_CR LOOK_LF LOOK_LONE_LF LOOK_CRLF \
634627
LOOK_LONG LOOK_INVALID LOOK_ODD LOOK_SHORT} {
635628
set e [dict get $pred $key]
636629
set a [expr {[dict exists $got $key] ? [dict get $got $key] : ""}]
637
- utf_expect utf-$label-$key $a $e
630
+ test_predict utf utf-$label-$key $a $e
638631
}
639632
}
640633
641634
# Smoke: stratified edges covering each detector branch.
642635
proc utf_smoke_cells {} {
643636
--- test/utf.test
+++ test/utf.test
@@ -555,11 +555,12 @@
555 set flags [expr {$flags | 0x40}]
556 }
557 return $flags
558 }
559
560 # Predict the dict of output fields for raw BYTES (path used only for size line).
 
561 proc utf_predict {bytes} {
562 set n [string length $bytes]
563 set fUtf8 [utf_starts_with_utf8_bom $bytes]
564 lassign [utf_starts_with_utf16_bom $bytes] fUtf16 bRev
565 lassign [utf_could_be_utf16 $bytes] fUnicode bRev2
@@ -599,11 +600,12 @@
599 foreach line [split [string map [list \r\n \n] $text] \n] {
600 if {[regexp {^File ".*" has (\d+) bytes\.$} $line -> n]} {
601 dict set d bytes $n
602 } elseif {[regexp {^Starts with UTF-8 BOM: (yes|no)$} $line -> v]} {
603 dict set d utf8_bom $v
604 } elseif {[regexp {^Starts with UTF-16 BOM: (yes|no|reversed)$} $line -> v]} {
 
605 dict set d utf16_bom $v
606 } elseif {[regexp {^Looks like UTF-(8|16): (yes|no)$} $line -> k v]} {
607 dict set d looks_kind $k
608 dict set d looks_like $v
609 } elseif {[regexp {^Has flag (LOOK_[A-Z_]+): (yes|no)$} $line -> f v]} {
@@ -611,19 +613,10 @@
611 }
612 }
613 return $d
614 }
615
616 proc utf_expect {name actual expected} {
617 set ok [expr {$actual eq $expected}]
618 if {$ok} {
619 incr ::utfPredMet
620 } else {
621 incr ::utfPredUnmet
622 }
623 test_eq $name $actual $expected
624 }
625
626 # Compare every predicted field to fossil output (yes and no).
627 proc utf_check_cell {label bytes path} {
628 utf_write_bytes $path $bytes
629 set pred [utf_predict $bytes]
@@ -632,11 +625,11 @@
632 foreach key {bytes utf8_bom utf16_bom looks_kind looks_like \
633 LOOK_NUL LOOK_CR LOOK_LONE_CR LOOK_LF LOOK_LONE_LF LOOK_CRLF \
634 LOOK_LONG LOOK_INVALID LOOK_ODD LOOK_SHORT} {
635 set e [dict get $pred $key]
636 set a [expr {[dict exists $got $key] ? [dict get $got $key] : ""}]
637 utf_expect utf-$label-$key $a $e
638 }
639 }
640
641 # Smoke: stratified edges covering each detector branch.
642 proc utf_smoke_cells {} {
643
--- test/utf.test
+++ test/utf.test
@@ -555,11 +555,12 @@
555 set flags [expr {$flags | 0x40}]
556 }
557 return $flags
558 }
559
560 # Predict the dict of output fields for raw BYTES (path used only for size
561 # line).
562 proc utf_predict {bytes} {
563 set n [string length $bytes]
564 set fUtf8 [utf_starts_with_utf8_bom $bytes]
565 lassign [utf_starts_with_utf16_bom $bytes] fUtf16 bRev
566 lassign [utf_could_be_utf16 $bytes] fUnicode bRev2
@@ -599,11 +600,12 @@
600 foreach line [split [string map [list \r\n \n] $text] \n] {
601 if {[regexp {^File ".*" has (\d+) bytes\.$} $line -> n]} {
602 dict set d bytes $n
603 } elseif {[regexp {^Starts with UTF-8 BOM: (yes|no)$} $line -> v]} {
604 dict set d utf8_bom $v
605 } elseif {[regexp {^Starts with UTF-16 BOM: (yes|no|reversed)$} $line -> \
606 v]} {
607 dict set d utf16_bom $v
608 } elseif {[regexp {^Looks like UTF-(8|16): (yes|no)$} $line -> k v]} {
609 dict set d looks_kind $k
610 dict set d looks_like $v
611 } elseif {[regexp {^Has flag (LOOK_[A-Z_]+): (yes|no)$} $line -> f v]} {
@@ -611,19 +613,10 @@
613 }
614 }
615 return $d
616 }
617
 
 
 
 
 
 
 
 
 
618
619 # Compare every predicted field to fossil output (yes and no).
620 proc utf_check_cell {label bytes path} {
621 utf_write_bytes $path $bytes
622 set pred [utf_predict $bytes]
@@ -632,11 +625,11 @@
625 foreach key {bytes utf8_bom utf16_bom looks_kind looks_like \
626 LOOK_NUL LOOK_CR LOOK_LONE_CR LOOK_LF LOOK_LONE_LF LOOK_CRLF \
627 LOOK_LONG LOOK_INVALID LOOK_ODD LOOK_SHORT} {
628 set e [dict get $pred $key]
629 set a [expr {[dict exists $got $key] ? [dict get $got $key] : ""}]
630 test_predict utf utf-$label-$key $a $e
631 }
632 }
633
634 # Smoke: stratified edges covering each detector branch.
635 proc utf_smoke_cells {} {
636
+34 -24
--- test/wiki.test
+++ test/wiki.test
@@ -76,19 +76,19 @@
7676
7777
7878
###############################################################################
7979
# Initially there should be no wiki entries
8080
fossil wiki list
81
-test wiki-0 {[normalize_result] eq {}}
81
+test_eq wiki-0 [normalize_result] {}
8282
8383
###############################################################################
8484
# Adding an entry should add it to the wiki list
8585
write_file f1 "first wiki note"
8686
fossil wiki create tcltest f1
8787
test wiki-1 {$CODE == 0}
8888
fossil wiki list
89
-test wiki-2 {[normalize_result] eq {tcltest}}
89
+test_eq wiki-2 [normalize_result] {tcltest}
9090
9191
###############################################################################
9292
# Trying to add the same entry should fail
9393
fossil wiki create tcltest f1 -expectError
9494
test wiki-3 {$CODE != 0}
@@ -97,34 +97,34 @@
9797
# exporting the wiki page should give back similar text
9898
fossil wiki export tcltest a1
9999
test wiki-4 {[similar_file f1 a1]}
100100
101101
###############################################################################
102
-# commiting a change to an existing page should replace the page on export
102
+# committing a change to an existing page should replace the page on export
103103
write_file f2 "second version of the page"
104104
fossil wiki commit tcltest f2
105105
test wiki-5 {$CODE == 0}
106106
fossil wiki export tcltest a2
107107
test wiki-6 {[similar_file f2 a2]}
108108
109109
###############################################################################
110
-# But we shouldn't be able to update non-existant pages
110
+# But we shouldn't be able to update nonexistent pages
111111
fossil wiki commit doesntexist f1 -expectError
112112
test wiki-7 {$CODE != 0}
113113
114114
###############################################################################
115115
# There shouldn't be any tech notes at this point
116116
fossil wiki list --technote
117
-test wiki-8 {[normalize_result] eq {}}
117
+test_eq wiki-8 [normalize_result] {}
118118
119119
###############################################################################
120120
# Creating a tech note with a specified timestamp should add a technote
121121
write_file f3 "A technote"
122122
fossil wiki create technote f3 --technote {2016-01-01 12:34}
123123
test wiki-9 {$CODE == 0}
124124
fossil wiki list --technote
125
-test wiki-10 {[normalize_result] eq {2016-01-01 12:34:00}}
125
+test_eq wiki-10 [normalize_result] {2016-01-01 12:34:00}
126126
fossil wiki list --technote --show-technote-ids
127127
set technotelist [split $RESULT "\n"]
128128
set veryfirsttechnoteid [lindex [split [lindex $technotelist 0]] 0]
129129
130130
###############################################################################
@@ -140,11 +140,11 @@
140140
fossil wiki list --technote
141141
set technotelist [split $RESULT "\n"]
142142
test wiki-13.1 {[llength $technotelist] == 2}
143143
144144
###############################################################################
145
-# commiting a change to an existing technote should replace the page on export
145
+# committing a change to an existing technote should replace the page on export
146146
# (this should update the tech note from wiki-13 as that the most recently
147147
# updated one, that should also be the one exported by the export command)
148148
write_file f4 "technote 2nd variant"
149149
fossil wiki commit technote f4 --technote {2016-01-01 12:34}
150150
test wiki-14 {$CODE == 0}
@@ -154,42 +154,48 @@
154154
# recently still has its original text
155155
fossil wiki export a4.1 --technote $veryfirsttechnoteid
156156
test wiki-15.1 {[similar_file f3 a4.1]}
157157
158158
###############################################################################
159
-# But we shouldn't be able to update non-existant pages
159
+# But we shouldn't be able to update nonexistent pages
160160
fossil wiki commit doesntexist f1 -expectError
161161
test wiki-16 {$CODE != 0}
162162
163163
###############################################################################
164164
# Check specifying tags for a technote is OK
165165
write_file f5 "technote with tags"
166
-fossil wiki create {tagged technote} f5 --technote {2016-01-02 12:34} --technote-tags {A B}
166
+fossil wiki create {tagged technote} f5 --technote {2016-01-02 12:34} \
167
+ --technote-tags {A B}
167168
test wiki-17 {$CODE == 0}
168169
write_file f5.1 "editted and tagged technote"
169
-fossil wiki commit {tagged technote} f5 --technote {2016-01-02 12:34} --technote-tags {C D}
170
+fossil wiki commit {tagged technote} f5 --technote {2016-01-02 12:34} \
171
+ --technote-tags {C D}
170172
test wiki-18 {$CODE == 0}
171173
172174
###############################################################################
173175
# Check specifying a bgcolor for a technote is OK
174176
write_file f6 "bgcolored technote"
175
-fossil wiki create bgcolor f6 --technote {2016-01-03 12:34} --technote-bgcolor red
177
+fossil wiki create bgcolor f6 --technote {2016-01-03 12:34} \
178
+ --technote-bgcolor red
176179
test wiki-19 {$CODE == 0}
177180
write_file f6.1 "editted technote with a background color"
178
-fossil wiki commit bgcolor f6.1 --technote {2016-01-03 12:34} --technote-bgcolor yellow
181
+fossil wiki commit bgcolor f6.1 --technote {2016-01-03 12:34} \
182
+ --technote-bgcolor yellow
179183
test wiki-20 {$CODE == 0}
180184
181185
###############################################################################
182
-# Test adding an attachment to both a non-existant (should fail) and existing wiki page
186
+# Test adding an attachment to both a nonexistent (should fail) and existing
187
+# wiki page
183188
write_file fa "This is a file to be attached"
184189
fossil attachment add doesntexist fa -expectError
185190
test wiki-21 {$CODE != 0}
186191
fossil attachment add tcltest fa
187192
test wiki-22 {$CODE == 0}
188193
189194
###############################################################################
190
-# Test adding an attachment to both a non-existant (should fail) and existing tech note
195
+# Test adding an attachment to both a nonexistent (should fail) and existing
196
+# tech note
191197
fossil attachment add fa --technote {2016-07-22 12:00} -expectError
192198
test wiki-23 {$CODE != 0}
193199
fossil attachment add fa --technote {2016-01-03 12:34}
194200
test wiki-24 {$CODE == 0}
195201
@@ -200,13 +206,15 @@
200206
201207
###############################################################################
202208
# Check that a technote with an attachment can be updated
203209
fossil wiki commit technote f6 --technote {2016-01-03 12:34}
204210
test wiki-26 {$CODE == 0}
205
-fossil wiki commit technote f6 --technote {2016-01-03 12:34} --technote-tags {E F}
211
+fossil wiki commit technote f6 --technote {2016-01-03 12:34} \
212
+ --technote-tags {E F}
206213
test wiki-27 {$CODE == 0}
207
-fossil wiki commit technote f6 --technote {2016-01-03 12:34} --technote-bgcolor blue
214
+fossil wiki commit technote f6 --technote {2016-01-03 12:34} \
215
+ --technote-bgcolor blue
208216
test wiki-28 {$CODE == 0}
209217
210218
###############################################################################
211219
# Check longest form of timestamp for the technote
212220
write_file f7 "Different timestamps"
@@ -288,17 +296,20 @@
288296
append match [lindex $technotelist $i]
289297
test "wiki-39-$i" {[string match $match [lindex $technoteidlist $i]]}
290298
}
291299
292300
###############################################################################
293
-# Create new tech note with a old timestamp so that it is oldest and then check that
294
-# the contents of the oldest tech note (by tech note id, both full and short) match up
301
+# Create new tech note with a old timestamp so that it is oldest and then check
302
+# that
303
+# the contents of the oldest tech note (by tech note id, both full and short)
304
+# match up
295305
write_file f12 "A really old tech note"
296306
fossil wiki create {Old tech note} f12 --technote {2001-07-07 09:08:07}
297307
fossil wiki list --technote --show-technote-ids
298308
set technotelist [split $RESULT "\n"]
299
-set anoldtechnoteid [lindex [split [lindex $technotelist [llength $technotelist]-1]] 0]
309
+set anoldtechnoteid [lindex \
310
+ [split [lindex $technotelist [llength $technotelist]-1]] 0]
300311
fossil wiki export a12 --technote $anoldtechnoteid
301312
test wiki-40 {[similar_file f12 a12]}
302313
303314
###############################################################################
304315
# Also check that we can specify a prefix of the tech note id (note: with
@@ -331,11 +342,12 @@
331342
set idA [lindex $techIds 0]
332343
set idB [lindex $techIds 1]
333344
set duplicateid [string range $idA 0 3]
334345
if {[string range $idB 0 3] ne $duplicateid} {
335346
set planted "$duplicateid[string range $idB 4 end]"
336
- fossil sql "UPDATE tag SET tagname='event-$planted' WHERE tagname='event-$idB';"
347
+ fossil sql \
348
+ "UPDATE tag SET tagname='event-$planted' WHERE tagname='event-$idB';"
337349
if {$CODE != 0} {
338350
error "wiki-collision: failed to plant prefix collision:\n$RESULT"
339351
}
340352
}
341353
fossil wiki export a13 --technote $duplicateid -expectError
@@ -347,23 +359,22 @@
347359
fossil wiki commit {Old tech note} f14 --technote $anoldtechnoteid
348360
fossil wiki export a14 --technote $anoldtechnoteid
349361
test wiki-43 {[similar_file f14 a14]}
350362
351363
###############################################################################
352
-# Check we can add attachments to a technote by its id
353364
fossil attachment add fa --technote $anoldtechnoteid
354365
test wiki-44 {$CODE == 0}
355366
356367
###############################################################################
357368
# Also check that we can specify a prefix of the tech note id
358369
write_file f15 "Updated text for the really old tech note specified by its id"
359
-fossil wiki commit {Old tech note} f15 --technote [string range $anoldtechnoteid 0 20]
370
+fossil wiki commit {Old tech note} f15 \
371
+ --technote [string range $anoldtechnoteid 0 20]
360372
fossil wiki export a15 --technote $anoldtechnoteid
361373
test wiki-45 {[similar_file f15 a15]}
362374
363375
###############################################################################
364
-# Check we can add attachments to a technote by a prefix of its id
365376
fossil attachment add fa --technote [string range $anoldtechnoteid 0 20]
366377
test wiki-46 {$CODE == 0}
367378
368379
###############################################################################
369380
# And we get an error for the ambiguous tech note id
@@ -371,11 +382,10 @@
371382
test wiki-47 {$CODE != 0}
372383
fossil attachment add fa --technote $duplicateid -expectError
373384
test wiki-48 {$CODE != 0}
374385
375386
###############################################################################
376
-# Check the default mimetype is text/x-fossil-wiki
377387
test wiki-49 {[get_mime_type tcltest] == "text/x-fossil-wiki"}
378388
379389
###############################################################################
380390
# Check long form of the mimetypes are recorded correctly
381391
fossil wiki create tcltest-x-fossil f1 -mimetype text/x-fossil-wiki
382392
--- test/wiki.test
+++ test/wiki.test
@@ -76,19 +76,19 @@
76
77
78 ###############################################################################
79 # Initially there should be no wiki entries
80 fossil wiki list
81 test wiki-0 {[normalize_result] eq {}}
82
83 ###############################################################################
84 # Adding an entry should add it to the wiki list
85 write_file f1 "first wiki note"
86 fossil wiki create tcltest f1
87 test wiki-1 {$CODE == 0}
88 fossil wiki list
89 test wiki-2 {[normalize_result] eq {tcltest}}
90
91 ###############################################################################
92 # Trying to add the same entry should fail
93 fossil wiki create tcltest f1 -expectError
94 test wiki-3 {$CODE != 0}
@@ -97,34 +97,34 @@
97 # exporting the wiki page should give back similar text
98 fossil wiki export tcltest a1
99 test wiki-4 {[similar_file f1 a1]}
100
101 ###############################################################################
102 # commiting a change to an existing page should replace the page on export
103 write_file f2 "second version of the page"
104 fossil wiki commit tcltest f2
105 test wiki-5 {$CODE == 0}
106 fossil wiki export tcltest a2
107 test wiki-6 {[similar_file f2 a2]}
108
109 ###############################################################################
110 # But we shouldn't be able to update non-existant pages
111 fossil wiki commit doesntexist f1 -expectError
112 test wiki-7 {$CODE != 0}
113
114 ###############################################################################
115 # There shouldn't be any tech notes at this point
116 fossil wiki list --technote
117 test wiki-8 {[normalize_result] eq {}}
118
119 ###############################################################################
120 # Creating a tech note with a specified timestamp should add a technote
121 write_file f3 "A technote"
122 fossil wiki create technote f3 --technote {2016-01-01 12:34}
123 test wiki-9 {$CODE == 0}
124 fossil wiki list --technote
125 test wiki-10 {[normalize_result] eq {2016-01-01 12:34:00}}
126 fossil wiki list --technote --show-technote-ids
127 set technotelist [split $RESULT "\n"]
128 set veryfirsttechnoteid [lindex [split [lindex $technotelist 0]] 0]
129
130 ###############################################################################
@@ -140,11 +140,11 @@
140 fossil wiki list --technote
141 set technotelist [split $RESULT "\n"]
142 test wiki-13.1 {[llength $technotelist] == 2}
143
144 ###############################################################################
145 # commiting a change to an existing technote should replace the page on export
146 # (this should update the tech note from wiki-13 as that the most recently
147 # updated one, that should also be the one exported by the export command)
148 write_file f4 "technote 2nd variant"
149 fossil wiki commit technote f4 --technote {2016-01-01 12:34}
150 test wiki-14 {$CODE == 0}
@@ -154,42 +154,48 @@
154 # recently still has its original text
155 fossil wiki export a4.1 --technote $veryfirsttechnoteid
156 test wiki-15.1 {[similar_file f3 a4.1]}
157
158 ###############################################################################
159 # But we shouldn't be able to update non-existant pages
160 fossil wiki commit doesntexist f1 -expectError
161 test wiki-16 {$CODE != 0}
162
163 ###############################################################################
164 # Check specifying tags for a technote is OK
165 write_file f5 "technote with tags"
166 fossil wiki create {tagged technote} f5 --technote {2016-01-02 12:34} --technote-tags {A B}
 
167 test wiki-17 {$CODE == 0}
168 write_file f5.1 "editted and tagged technote"
169 fossil wiki commit {tagged technote} f5 --technote {2016-01-02 12:34} --technote-tags {C D}
 
170 test wiki-18 {$CODE == 0}
171
172 ###############################################################################
173 # Check specifying a bgcolor for a technote is OK
174 write_file f6 "bgcolored technote"
175 fossil wiki create bgcolor f6 --technote {2016-01-03 12:34} --technote-bgcolor red
 
176 test wiki-19 {$CODE == 0}
177 write_file f6.1 "editted technote with a background color"
178 fossil wiki commit bgcolor f6.1 --technote {2016-01-03 12:34} --technote-bgcolor yellow
 
179 test wiki-20 {$CODE == 0}
180
181 ###############################################################################
182 # Test adding an attachment to both a non-existant (should fail) and existing wiki page
 
183 write_file fa "This is a file to be attached"
184 fossil attachment add doesntexist fa -expectError
185 test wiki-21 {$CODE != 0}
186 fossil attachment add tcltest fa
187 test wiki-22 {$CODE == 0}
188
189 ###############################################################################
190 # Test adding an attachment to both a non-existant (should fail) and existing tech note
 
191 fossil attachment add fa --technote {2016-07-22 12:00} -expectError
192 test wiki-23 {$CODE != 0}
193 fossil attachment add fa --technote {2016-01-03 12:34}
194 test wiki-24 {$CODE == 0}
195
@@ -200,13 +206,15 @@
200
201 ###############################################################################
202 # Check that a technote with an attachment can be updated
203 fossil wiki commit technote f6 --technote {2016-01-03 12:34}
204 test wiki-26 {$CODE == 0}
205 fossil wiki commit technote f6 --technote {2016-01-03 12:34} --technote-tags {E F}
 
206 test wiki-27 {$CODE == 0}
207 fossil wiki commit technote f6 --technote {2016-01-03 12:34} --technote-bgcolor blue
 
208 test wiki-28 {$CODE == 0}
209
210 ###############################################################################
211 # Check longest form of timestamp for the technote
212 write_file f7 "Different timestamps"
@@ -288,17 +296,20 @@
288 append match [lindex $technotelist $i]
289 test "wiki-39-$i" {[string match $match [lindex $technoteidlist $i]]}
290 }
291
292 ###############################################################################
293 # Create new tech note with a old timestamp so that it is oldest and then check that
294 # the contents of the oldest tech note (by tech note id, both full and short) match up
 
 
295 write_file f12 "A really old tech note"
296 fossil wiki create {Old tech note} f12 --technote {2001-07-07 09:08:07}
297 fossil wiki list --technote --show-technote-ids
298 set technotelist [split $RESULT "\n"]
299 set anoldtechnoteid [lindex [split [lindex $technotelist [llength $technotelist]-1]] 0]
 
300 fossil wiki export a12 --technote $anoldtechnoteid
301 test wiki-40 {[similar_file f12 a12]}
302
303 ###############################################################################
304 # Also check that we can specify a prefix of the tech note id (note: with
@@ -331,11 +342,12 @@
331 set idA [lindex $techIds 0]
332 set idB [lindex $techIds 1]
333 set duplicateid [string range $idA 0 3]
334 if {[string range $idB 0 3] ne $duplicateid} {
335 set planted "$duplicateid[string range $idB 4 end]"
336 fossil sql "UPDATE tag SET tagname='event-$planted' WHERE tagname='event-$idB';"
 
337 if {$CODE != 0} {
338 error "wiki-collision: failed to plant prefix collision:\n$RESULT"
339 }
340 }
341 fossil wiki export a13 --technote $duplicateid -expectError
@@ -347,23 +359,22 @@
347 fossil wiki commit {Old tech note} f14 --technote $anoldtechnoteid
348 fossil wiki export a14 --technote $anoldtechnoteid
349 test wiki-43 {[similar_file f14 a14]}
350
351 ###############################################################################
352 # Check we can add attachments to a technote by its id
353 fossil attachment add fa --technote $anoldtechnoteid
354 test wiki-44 {$CODE == 0}
355
356 ###############################################################################
357 # Also check that we can specify a prefix of the tech note id
358 write_file f15 "Updated text for the really old tech note specified by its id"
359 fossil wiki commit {Old tech note} f15 --technote [string range $anoldtechnoteid 0 20]
 
360 fossil wiki export a15 --technote $anoldtechnoteid
361 test wiki-45 {[similar_file f15 a15]}
362
363 ###############################################################################
364 # Check we can add attachments to a technote by a prefix of its id
365 fossil attachment add fa --technote [string range $anoldtechnoteid 0 20]
366 test wiki-46 {$CODE == 0}
367
368 ###############################################################################
369 # And we get an error for the ambiguous tech note id
@@ -371,11 +382,10 @@
371 test wiki-47 {$CODE != 0}
372 fossil attachment add fa --technote $duplicateid -expectError
373 test wiki-48 {$CODE != 0}
374
375 ###############################################################################
376 # Check the default mimetype is text/x-fossil-wiki
377 test wiki-49 {[get_mime_type tcltest] == "text/x-fossil-wiki"}
378
379 ###############################################################################
380 # Check long form of the mimetypes are recorded correctly
381 fossil wiki create tcltest-x-fossil f1 -mimetype text/x-fossil-wiki
382
--- test/wiki.test
+++ test/wiki.test
@@ -76,19 +76,19 @@
76
77
78 ###############################################################################
79 # Initially there should be no wiki entries
80 fossil wiki list
81 test_eq wiki-0 [normalize_result] {}
82
83 ###############################################################################
84 # Adding an entry should add it to the wiki list
85 write_file f1 "first wiki note"
86 fossil wiki create tcltest f1
87 test wiki-1 {$CODE == 0}
88 fossil wiki list
89 test_eq wiki-2 [normalize_result] {tcltest}
90
91 ###############################################################################
92 # Trying to add the same entry should fail
93 fossil wiki create tcltest f1 -expectError
94 test wiki-3 {$CODE != 0}
@@ -97,34 +97,34 @@
97 # exporting the wiki page should give back similar text
98 fossil wiki export tcltest a1
99 test wiki-4 {[similar_file f1 a1]}
100
101 ###############################################################################
102 # committing a change to an existing page should replace the page on export
103 write_file f2 "second version of the page"
104 fossil wiki commit tcltest f2
105 test wiki-5 {$CODE == 0}
106 fossil wiki export tcltest a2
107 test wiki-6 {[similar_file f2 a2]}
108
109 ###############################################################################
110 # But we shouldn't be able to update nonexistent pages
111 fossil wiki commit doesntexist f1 -expectError
112 test wiki-7 {$CODE != 0}
113
114 ###############################################################################
115 # There shouldn't be any tech notes at this point
116 fossil wiki list --technote
117 test_eq wiki-8 [normalize_result] {}
118
119 ###############################################################################
120 # Creating a tech note with a specified timestamp should add a technote
121 write_file f3 "A technote"
122 fossil wiki create technote f3 --technote {2016-01-01 12:34}
123 test wiki-9 {$CODE == 0}
124 fossil wiki list --technote
125 test_eq wiki-10 [normalize_result] {2016-01-01 12:34:00}
126 fossil wiki list --technote --show-technote-ids
127 set technotelist [split $RESULT "\n"]
128 set veryfirsttechnoteid [lindex [split [lindex $technotelist 0]] 0]
129
130 ###############################################################################
@@ -140,11 +140,11 @@
140 fossil wiki list --technote
141 set technotelist [split $RESULT "\n"]
142 test wiki-13.1 {[llength $technotelist] == 2}
143
144 ###############################################################################
145 # committing a change to an existing technote should replace the page on export
146 # (this should update the tech note from wiki-13 as that the most recently
147 # updated one, that should also be the one exported by the export command)
148 write_file f4 "technote 2nd variant"
149 fossil wiki commit technote f4 --technote {2016-01-01 12:34}
150 test wiki-14 {$CODE == 0}
@@ -154,42 +154,48 @@
154 # recently still has its original text
155 fossil wiki export a4.1 --technote $veryfirsttechnoteid
156 test wiki-15.1 {[similar_file f3 a4.1]}
157
158 ###############################################################################
159 # But we shouldn't be able to update nonexistent pages
160 fossil wiki commit doesntexist f1 -expectError
161 test wiki-16 {$CODE != 0}
162
163 ###############################################################################
164 # Check specifying tags for a technote is OK
165 write_file f5 "technote with tags"
166 fossil wiki create {tagged technote} f5 --technote {2016-01-02 12:34} \
167 --technote-tags {A B}
168 test wiki-17 {$CODE == 0}
169 write_file f5.1 "editted and tagged technote"
170 fossil wiki commit {tagged technote} f5 --technote {2016-01-02 12:34} \
171 --technote-tags {C D}
172 test wiki-18 {$CODE == 0}
173
174 ###############################################################################
175 # Check specifying a bgcolor for a technote is OK
176 write_file f6 "bgcolored technote"
177 fossil wiki create bgcolor f6 --technote {2016-01-03 12:34} \
178 --technote-bgcolor red
179 test wiki-19 {$CODE == 0}
180 write_file f6.1 "editted technote with a background color"
181 fossil wiki commit bgcolor f6.1 --technote {2016-01-03 12:34} \
182 --technote-bgcolor yellow
183 test wiki-20 {$CODE == 0}
184
185 ###############################################################################
186 # Test adding an attachment to both a nonexistent (should fail) and existing
187 # wiki page
188 write_file fa "This is a file to be attached"
189 fossil attachment add doesntexist fa -expectError
190 test wiki-21 {$CODE != 0}
191 fossil attachment add tcltest fa
192 test wiki-22 {$CODE == 0}
193
194 ###############################################################################
195 # Test adding an attachment to both a nonexistent (should fail) and existing
196 # tech note
197 fossil attachment add fa --technote {2016-07-22 12:00} -expectError
198 test wiki-23 {$CODE != 0}
199 fossil attachment add fa --technote {2016-01-03 12:34}
200 test wiki-24 {$CODE == 0}
201
@@ -200,13 +206,15 @@
206
207 ###############################################################################
208 # Check that a technote with an attachment can be updated
209 fossil wiki commit technote f6 --technote {2016-01-03 12:34}
210 test wiki-26 {$CODE == 0}
211 fossil wiki commit technote f6 --technote {2016-01-03 12:34} \
212 --technote-tags {E F}
213 test wiki-27 {$CODE == 0}
214 fossil wiki commit technote f6 --technote {2016-01-03 12:34} \
215 --technote-bgcolor blue
216 test wiki-28 {$CODE == 0}
217
218 ###############################################################################
219 # Check longest form of timestamp for the technote
220 write_file f7 "Different timestamps"
@@ -288,17 +296,20 @@
296 append match [lindex $technotelist $i]
297 test "wiki-39-$i" {[string match $match [lindex $technoteidlist $i]]}
298 }
299
300 ###############################################################################
301 # Create new tech note with a old timestamp so that it is oldest and then check
302 # that
303 # the contents of the oldest tech note (by tech note id, both full and short)
304 # match up
305 write_file f12 "A really old tech note"
306 fossil wiki create {Old tech note} f12 --technote {2001-07-07 09:08:07}
307 fossil wiki list --technote --show-technote-ids
308 set technotelist [split $RESULT "\n"]
309 set anoldtechnoteid [lindex \
310 [split [lindex $technotelist [llength $technotelist]-1]] 0]
311 fossil wiki export a12 --technote $anoldtechnoteid
312 test wiki-40 {[similar_file f12 a12]}
313
314 ###############################################################################
315 # Also check that we can specify a prefix of the tech note id (note: with
@@ -331,11 +342,12 @@
342 set idA [lindex $techIds 0]
343 set idB [lindex $techIds 1]
344 set duplicateid [string range $idA 0 3]
345 if {[string range $idB 0 3] ne $duplicateid} {
346 set planted "$duplicateid[string range $idB 4 end]"
347 fossil sql \
348 "UPDATE tag SET tagname='event-$planted' WHERE tagname='event-$idB';"
349 if {$CODE != 0} {
350 error "wiki-collision: failed to plant prefix collision:\n$RESULT"
351 }
352 }
353 fossil wiki export a13 --technote $duplicateid -expectError
@@ -347,23 +359,22 @@
359 fossil wiki commit {Old tech note} f14 --technote $anoldtechnoteid
360 fossil wiki export a14 --technote $anoldtechnoteid
361 test wiki-43 {[similar_file f14 a14]}
362
363 ###############################################################################
 
364 fossil attachment add fa --technote $anoldtechnoteid
365 test wiki-44 {$CODE == 0}
366
367 ###############################################################################
368 # Also check that we can specify a prefix of the tech note id
369 write_file f15 "Updated text for the really old tech note specified by its id"
370 fossil wiki commit {Old tech note} f15 \
371 --technote [string range $anoldtechnoteid 0 20]
372 fossil wiki export a15 --technote $anoldtechnoteid
373 test wiki-45 {[similar_file f15 a15]}
374
375 ###############################################################################
 
376 fossil attachment add fa --technote [string range $anoldtechnoteid 0 20]
377 test wiki-46 {$CODE == 0}
378
379 ###############################################################################
380 # And we get an error for the ambiguous tech note id
@@ -371,11 +382,10 @@
382 test wiki-47 {$CODE != 0}
383 fossil attachment add fa --technote $duplicateid -expectError
384 test wiki-48 {$CODE != 0}
385
386 ###############################################################################
 
387 test wiki-49 {[get_mime_type tcltest] == "text/x-fossil-wiki"}
388
389 ###############################################################################
390 # Check long form of the mimetypes are recorded correctly
391 fossil wiki create tcltest-x-fossil f1 -mimetype text/x-fossil-wiki
392

Keyboard Shortcuts

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