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.
Commit
5c86b2ed386f5ffb0ce2eb6a2114bcd3e425b6642a313b489e64de5bf1e93059
Parent
5388e51fdbb2e2f…
29 files changed
+50
-24
+36
-32
+17
-8
+33
-20
+18
-9
+19
-78
+71
-89
+100
-195
+4
-3
+11
-8
+4
-3
+68
-91
+10
-18
+2
-6
+3
-3
+14
-17
+8
-25
+14
-14
+64
-5
+2
-1
+4
-4
+5
-5
+9
-8
+23
-15
+15
-25
+36
-33
+9
-4
+5
-12
+34
-24
~
test/README.md
~
test/clean.test
~
test/commit-warning.test
~
test/diff.test
~
test/file1.test
~
test/http.test
~
test/json.test
~
test/merge1.test
~
test/merge5.test
~
test/merge6.test
~
test/merge_renames.test
~
test/mv-rm.test
~
test/reserved-names.test
~
test/revert.test
~
test/rewrite-test-output.tcl
~
test/set-manifest.test
~
test/stash.test
~
test/symlinks.test
~
test/tester.tcl
~
test/th1-docs.test
~
test/th1-hooks.test
~
test/th1-repo.test
~
test/th1-tcl.test
~
test/th1.test
~
test/unicode-pathnames.test
~
test/unversioned.test
~
test/update.test
~
test/utf.test
~
test/wiki.test
+50
-24
| --- test/README.md | ||
| +++ test/README.md | ||
| @@ -85,16 +85,18 @@ | ||
| 85 | 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 | 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 | 87 | which writes a session log to wherever it was started from. |
| 88 | 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 | 89 | |
| 90 | -The following tests are skipped when their requirements are missing: | |
| 90 | +Tests are skipped when their requirements are missing: | |
| 91 | 91 | |
| 92 | 92 | | Needs | Test files | |
| 93 | 93 | | --- | --- | |
| 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` | | |
| 95 | 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` | | |
| 96 | 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` | |
| 97 | 99 | | `configure --json` | `json` | |
| 98 | 100 | | `configure --with-th1-docs` | `th1-docs` | |
| 99 | 101 | | `configure --with-th1-hooks` | `th1-hooks` | |
| 100 | 102 | | `configure --with-tcl` | `th1-tcl` | |
| @@ -104,37 +106,65 @@ | ||
| 104 | 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 |
| 105 | 107 | the test suite detects this. |
| 106 | 108 | |
| 107 | 109 | ## Coverage |
| 108 | 110 | |
| 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` | | |
| 115 | 127 | | 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 | 128 | |
| 123 | 129 | ## Writing new tests |
| 124 | 130 | |
| 125 | 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 |
| 126 | 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` |
| 127 | 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` |
| 128 | 134 | 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. | |
| 130 | 163 | |
| 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: | |
| 136 | 166 | |
| 137 | 167 | * the output byte for byte, such as CRLF line endings or binary content |
| 138 | 168 | * the exit status, or to tell a crash from a failure |
| 139 | 169 | * text on standard error from a command that succeeds |
| 140 | 170 | * standard input, with `-input TEXT` |
| @@ -159,17 +189,13 @@ | ||
| 159 | 189 | |
| 160 | 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. |
| 161 | 191 | |
| 162 | 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. |
| 163 | 193 | |
| 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 | 194 | `make test` runs only the `.test` files. The other scripts in `test/` are run by hand: |
| 169 | 195 | |
| 170 | 196 | * `release-checklist.wiki` lists the checks to make before a release, with the `.wiki` and `.md` pages they use. |
| 171 | 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. |
| 172 | 198 | * `update-test-1.sh` and `update-test-2.sh` run `fossil update` scenarios in an empty directory. |
| 173 | 199 | * `link-tester.html` steps through a list of links in `fossil ui`, for checking each page by eye. |
| 174 | 200 | |
| 175 | 201 | The remaining files are helper scripts and test data. |
| 176 | 202 |
| --- 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 @@ | ||
| 21 | 21 | test_setup |
| 22 | 22 | |
| 23 | 23 | ############################################################################### |
| 24 | 24 | |
| 25 | 25 | fossil extra |
| 26 | -test clean-0 {[normalize_result] eq {}} | |
| 26 | +test_eq clean-0 [normalize_result] {} | |
| 27 | 27 | |
| 28 | 28 | ############################################################################### |
| 29 | 29 | |
| 30 | 30 | commit_file f1 "f1 line" "base file" |
| 31 | 31 | fossil ls |
| 32 | -test clean-1 {[normalize_result] eq {f1}} | |
| 32 | +test_eq clean-1 [normalize_result] {f1} | |
| 33 | 33 | |
| 34 | 34 | ############################################################################### |
| 35 | 35 | |
| 36 | 36 | fossil extra |
| 37 | -test clean-2 {[normalize_result] eq {}} | |
| 37 | +test_eq clean-2 [normalize_result] {} | |
| 38 | 38 | |
| 39 | 39 | ############################################################################### |
| 40 | 40 | |
| 41 | 41 | write_file f2 "f2 line" |
| 42 | 42 | fossil extra |
| 43 | -test clean-3 {[normalize_result] eq {f2}} | |
| 43 | +test_eq clean-3 [normalize_result] {f2} | |
| 44 | 44 | |
| 45 | 45 | ############################################################################### |
| 46 | 46 | |
| 47 | 47 | # clean w/undo enabled, should not prompt, 1 file < 10MiB |
| 48 | 48 | fossil clean |
| @@ -50,29 +50,30 @@ | ||
| 50 | 50 | {"fossil undo" is available to undo changes to the working checkout.}} |
| 51 | 51 | |
| 52 | 52 | ############################################################################### |
| 53 | 53 | |
| 54 | 54 | fossil extra |
| 55 | -test clean-5 {[normalize_result] eq {}} | |
| 55 | +test_eq clean-5 [normalize_result] {} | |
| 56 | 56 | |
| 57 | 57 | ############################################################################### |
| 58 | 58 | |
| 59 | 59 | 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" | |
| 62 | 62 | |
| 63 | 63 | ############################################################################### |
| 64 | 64 | |
| 65 | 65 | fossil extra |
| 66 | -test clean-8 {[normalize_result] eq {f2}} | |
| 66 | +test_eq clean-8 [normalize_result] {f2} | |
| 67 | 67 | |
| 68 | 68 | ############################################################################### |
| 69 | 69 | |
| 70 | 70 | write_file f3 [string repeat ABCDEFGHIJK 1048576] |
| 71 | 71 | fossil extra |
| 72 | -test clean-9 {[normalize_result] eq {f2 | |
| 73 | -f3}} | |
| 72 | +test_eq clean-9 [normalize_result] \ | |
| 73 | + {f2 | |
| 74 | +f3} | |
| 74 | 75 | |
| 75 | 76 | ############################################################################### |
| 76 | 77 | |
| 77 | 78 | # clean w/undo enabled, no prompt, 1 file < 10MiB, 1 file > 10MiB |
| 78 | 79 | fossil clean --no-prompt |
| @@ -80,24 +81,25 @@ | ||
| 80 | 81 | {"fossil undo" is available to undo changes to the working checkout.}} |
| 81 | 82 | |
| 82 | 83 | ############################################################################### |
| 83 | 84 | |
| 84 | 85 | fossil extra |
| 85 | -test clean-11 {[normalize_result] eq {f3}} | |
| 86 | +test_eq clean-11 [normalize_result] {f3} | |
| 86 | 87 | |
| 87 | 88 | ############################################################################### |
| 88 | 89 | |
| 89 | 90 | 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] | |
| 93 | 94 | |
| 94 | 95 | ############################################################################### |
| 95 | 96 | |
| 96 | 97 | fossil extra |
| 97 | -test clean-15 {[normalize_result] eq {f2 | |
| 98 | -f3}} | |
| 98 | +test_eq clean-15 [normalize_result] \ | |
| 99 | + {f2 | |
| 100 | +f3} | |
| 99 | 101 | |
| 100 | 102 | ############################################################################### |
| 101 | 103 | |
| 102 | 104 | # clean w/undo enabled, force, 1 file < 10MiB, 1 file > 10MiB |
| 103 | 105 | fossil clean --force |
| @@ -105,63 +107,65 @@ | ||
| 105 | 107 | {"fossil undo" is available to undo changes to the working checkout.}} |
| 106 | 108 | |
| 107 | 109 | ############################################################################### |
| 108 | 110 | |
| 109 | 111 | fossil extra |
| 110 | -test clean-17 {[normalize_result] eq {}} | |
| 112 | +test_eq clean-17 [normalize_result] {} | |
| 111 | 113 | |
| 112 | 114 | ############################################################################### |
| 113 | 115 | |
| 114 | 116 | 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" | |
| 117 | 119 | |
| 118 | 120 | ############################################################################### |
| 119 | 121 | |
| 120 | 122 | write_file f4 [string repeat KJIHGFEDCBA 1048576] |
| 121 | 123 | fossil extra |
| 122 | -test clean-20 {[normalize_result] eq {f2 | |
| 123 | -f4}} | |
| 124 | +test_eq clean-20 [normalize_result] \ | |
| 125 | + {f2 | |
| 126 | +f4} | |
| 124 | 127 | |
| 125 | 128 | ############################################################################### |
| 126 | 129 | |
| 127 | 130 | # clean w/undo disabled, no prompt, 1 file < 10MiB, 1 file > 10MiB |
| 128 | 131 | fossil clean --disable-undo --no-prompt |
| 129 | -test clean-21 {[normalize_result] eq {}} | |
| 132 | +test_eq clean-21 [normalize_result] {} | |
| 130 | 133 | |
| 131 | 134 | ############################################################################### |
| 132 | 135 | |
| 133 | 136 | fossil extra |
| 134 | -test clean-22 {[normalize_result] eq {f2 | |
| 135 | -f4}} | |
| 137 | +test_eq clean-22 [normalize_result] \ | |
| 138 | + {f2 | |
| 139 | +f4} | |
| 136 | 140 | |
| 137 | 141 | ############################################################################### |
| 138 | 142 | |
| 139 | 143 | fossil undo -expectError |
| 140 | -test clean-23 {[normalize_result] eq {nothing to undo}} | |
| 144 | +test_eq clean-23 [normalize_result] {nothing to undo} | |
| 141 | 145 | |
| 142 | 146 | ############################################################################### |
| 143 | 147 | |
| 144 | 148 | # clean w/undo disabled, force, 1 file < 10MiB, 1 file > 10MiB |
| 145 | 149 | fossil clean --disable-undo --force |
| 146 | -test clean-24 {[normalize_result] eq {}} | |
| 150 | +test_eq clean-24 [normalize_result] {} | |
| 147 | 151 | |
| 148 | 152 | ############################################################################### |
| 149 | 153 | |
| 150 | 154 | fossil extra |
| 151 | -test clean-25 {[normalize_result] eq {}} | |
| 155 | +test_eq clean-25 [normalize_result] {} | |
| 152 | 156 | |
| 153 | 157 | ############################################################################### |
| 154 | 158 | |
| 155 | 159 | fossil undo -expectError |
| 156 | -test clean-26 {[normalize_result] eq {nothing to undo}} | |
| 160 | +test_eq clean-26 [normalize_result] {nothing to undo} | |
| 157 | 161 | |
| 158 | 162 | ############################################################################### |
| 159 | 163 | |
| 160 | 164 | write_file f5 "f5 line" |
| 161 | 165 | fossil extra |
| 162 | -test clean-27 {[normalize_result] eq {f5}} | |
| 166 | +test_eq clean-27 [normalize_result] {f5} | |
| 163 | 167 | |
| 164 | 168 | ############################################################################### |
| 165 | 169 | |
| 166 | 170 | # clean w/undo disabled, should prompt, 1 file < 10MiB |
| 167 | 171 | fossil_maybe_answer Y clean --disable-undo |
| @@ -172,20 +176,20 @@ | ||
| 172 | 176 | Remove unmanaged file "f5" (a=all/y/N)?}} |
| 173 | 177 | |
| 174 | 178 | ############################################################################### |
| 175 | 179 | |
| 176 | 180 | fossil extra |
| 177 | -test clean-29 {[normalize_result] eq {}} | |
| 181 | +test_eq clean-29 [normalize_result] {} | |
| 178 | 182 | |
| 179 | 183 | ############################################################################### |
| 180 | 184 | |
| 181 | 185 | fossil undo -expectError |
| 182 | -test clean-30 {[normalize_result] eq {nothing to undo}} | |
| 186 | +test_eq clean-30 [normalize_result] {nothing to undo} | |
| 183 | 187 | |
| 184 | 188 | ############################################################################### |
| 185 | 189 | |
| 186 | 190 | fossil extra |
| 187 | -test clean-31 {[normalize_result] eq {}} | |
| 191 | +test_eq clean-31 [normalize_result] {} | |
| 188 | 192 | |
| 189 | 193 | ############################################################################### |
| 190 | 194 | |
| 191 | 195 | test_cleanup |
| 192 | 196 |
| --- 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 |
+17
-8
| --- test/commit-warning.test | ||
| +++ test/commit-warning.test | ||
| @@ -19,11 +19,12 @@ | ||
| 19 | 19 | # |
| 20 | 20 | |
| 21 | 21 | test_setup |
| 22 | 22 | |
| 23 | 23 | # 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" | |
| 25 | 26 | |
| 26 | 27 | # text with CRLF lines |
| 27 | 28 | write_file crlf.txt [subst -nocommands -novariables \ |
| 28 | 29 | {ordinary text\r |
| 29 | 30 | cariage returns and line feeds\r |
| @@ -71,29 +72,37 @@ | ||
| 71 | 72 | # valid Unicode code point. But it's complicated. |
| 72 | 73 | write_file utf-mod-c0-80 "11 bit NUL:\xC0\x80 is sometimes ok\n" |
| 73 | 74 | write_file utf-bad-e0-80-80 "16 bit NUL:\xE0\x80\x80 is bad\n" |
| 74 | 75 | write_file utf-bad-f0-80-80-80 "21 bit NUL:\xF0\x80\x80\x80 is bad\n" |
| 75 | 76 | 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" | |
| 78 | 81 | write_file utf-bad-c0-81 "overlong SOH:\xC0\x81 is bad\n" |
| 79 | 82 | write_file utf-bad-c0-bf "overlong '?':\xC0\xBF is bad\n" |
| 80 | 83 | 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" | |
| 83 | 88 | write_file utf-bad-ff "no byte FF:\xFF\n" |
| 84 | 89 | write_file utf-ill16-lead "lead surrogate U+D800:\xED\xA0\x80 is ill formed\n" |
| 85 | 90 | 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"] ""] | |
| 88 | 97 | protOut $emoji |
| 89 | 98 | write_file utf-8-emoji $emoji |
| 90 | 99 | write_file utf-8-bom-emoji "\xef\xbb\xbf$emoji" |
| 91 | 100 | |
| 92 | 101 | # UTF-16 uses 16-bit values to cover all valid unicode code points |
| 93 | 102 | # 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. | |
| 95 | 104 | set hello16LE "h\x00e\x00l\x00l\x00o\x00\n\x00" |
| 96 | 105 | set hello16BE "\x00h\x00e\x00l\x00l\x00o\x00\n" |
| 97 | 106 | write_file utf-16le-hello $hello16LE |
| 98 | 107 | write_file utf-16be-hello $hello16BE |
| 99 | 108 | set bomLE "\xff\xfe" |
| 100 | 109 |
| --- 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 @@ | ||
| 48 | 48 | ############################################################################### |
| 49 | 49 | |
| 50 | 50 | write_file file0.dat "\0" |
| 51 | 51 | fossil diff file0.dat |
| 52 | 52 | |
| 53 | -test diff-file0-1 {[normalize_result] eq "Index: file0.dat | |
| 53 | +test_eq diff-file0-1 [normalize_result] \ | |
| 54 | + "Index: file0.dat | |
| 54 | 55 | ================================================================== |
| 55 | 56 | --- file0.dat\t |
| 56 | 57 | +++ file0.dat\t |
| 57 | -cannot compute difference between binary files"} | |
| 58 | +cannot compute difference between binary files" | |
| 58 | 59 | |
| 59 | 60 | ############################################################################### |
| 60 | 61 | |
| 61 | 62 | write_file file1.dat [string repeat z 32768] |
| 62 | 63 | fossil diff file1.dat |
| 63 | 64 | |
| 64 | -test diff-file1-1 {[normalize_result] eq "Index: file1.dat | |
| 65 | +test_eq diff-file1-1 [normalize_result] \ | |
| 66 | + "Index: file1.dat | |
| 65 | 67 | ================================================================== |
| 66 | 68 | --- file1.dat\t |
| 67 | 69 | +++ file1.dat\t |
| 68 | -cannot compute difference between binary files"} | |
| 70 | +cannot compute difference between binary files" | |
| 69 | 71 | |
| 70 | 72 | ############################################################################### |
| 71 | 73 | |
| 72 | 74 | write_file file2.dat "test file 2 (no NUL character)." |
| 73 | 75 | fossil diff file2.dat |
| 74 | 76 | |
| 75 | -test diff-file2-1 {[normalize_result] eq "Index: file2.dat | |
| 77 | +test_eq diff-file2-1 [normalize_result] \ | |
| 78 | + "Index: file2.dat | |
| 76 | 79 | ================================================================== |
| 77 | 80 | --- file2.dat\t |
| 78 | 81 | +++ file2.dat\t |
| 79 | -cannot compute difference between binary files"} | |
| 82 | +cannot compute difference between binary files" | |
| 80 | 83 | |
| 81 | 84 | ############################################################################### |
| 82 | 85 | |
| 83 | 86 | write_file file3.dat "test file 3 (not a long line)." |
| 84 | 87 | fossil diff file3.dat |
| 85 | 88 | |
| 86 | -test diff-file3-1 {[normalize_result] eq "Index: file3.dat | |
| 89 | +test_eq diff-file3-1 [normalize_result] \ | |
| 90 | + "Index: file3.dat | |
| 87 | 91 | ================================================================== |
| 88 | 92 | --- file3.dat\t |
| 89 | 93 | +++ file3.dat\t |
| 90 | -cannot compute difference between binary files"} | |
| 94 | +cannot compute difference between binary files" | |
| 91 | 95 | |
| 92 | 96 | ############################################################################### |
| 93 | 97 | |
| 94 | 98 | write_file file4.dat "test file 4 (not a long line).\ntwo" |
| 95 | 99 | fossil diff file4.dat |
| 96 | 100 | |
| 97 | -test diff-file4-1 {[normalize_result] eq "Index: file4.dat | |
| 101 | +test_eq diff-file4-1 [normalize_result] \ | |
| 102 | + "Index: file4.dat | |
| 98 | 103 | ================================================================== |
| 99 | 104 | --- file4.dat\t |
| 100 | 105 | +++ file4.dat\t |
| 101 | -cannot compute difference between binary files"} | |
| 106 | +cannot compute difference between binary files" | |
| 102 | 107 | |
| 103 | 108 | ############################################################################### |
| 104 | 109 | |
| 105 | 110 | write_file file5.dat "[string repeat 0 16]\ntest file 5 (not a long line)." |
| 106 | 111 | fossil diff file5.dat |
| 107 | 112 | |
| 108 | -test diff-file5-1 {[normalize_result] eq "Index: file5.dat | |
| 113 | +test_eq diff-file5-1 [normalize_result] \ | |
| 114 | + "Index: file5.dat | |
| 109 | 115 | ================================================================== |
| 110 | 116 | --- file5.dat\t |
| 111 | 117 | +++ file5.dat\t |
| 112 | -cannot compute difference between binary files"} | |
| 118 | +cannot compute difference between binary files" | |
| 113 | 119 | |
| 114 | 120 | ############################################################################### |
| 115 | 121 | |
| 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"] ""] | |
| 118 | 128 | 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 ===== | |
| 120 | 131 | 1 { 1 { |
| 121 | 132 | 2 "abc": { 2 "abc": { |
| 122 | 133 | 3 "def": false, 3 "def": false, |
| 123 | 134 | 4 "ghi": false 4 "ghi": false |
| 124 | 135 | > 5 }, |
| @@ -125,38 +136,40 @@ | ||
| 125 | 136 | > 6 "jkl": { |
| 126 | 137 | > 7 "mno": { |
| 127 | 138 | > 8 "pqr": false |
| 128 | 139 | > 9 } |
| 129 | 140 | 5 } 10 } |
| 130 | - 6 } 11 }}} | |
| 141 | + 6 } 11 }} | |
| 131 | 142 | |
| 132 | 143 | ############################################################################### |
| 133 | 144 | |
| 134 | 145 | fossil rm file1.dat |
| 135 | 146 | fossil diff -v file1.dat |
| 136 | 147 | |
| 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 | |
| 138 | 150 | Index: file1.dat |
| 139 | 151 | ================================================================== |
| 140 | 152 | --- file1.dat\t |
| 141 | 153 | +++ /dev/null\t |
| 142 | 154 | @@ -1,1 +0,0 @@ |
| 143 | --test file 1 (one line no term)."} | |
| 155 | +-test file 1 (one line no term)." | |
| 144 | 156 | |
| 145 | 157 | ############################################################################### |
| 146 | 158 | |
| 147 | 159 | write_file file6.dat "test file 6 (one line no term)." |
| 148 | 160 | fossil add file6.dat |
| 149 | 161 | |
| 150 | 162 | fossil diff -v file6.dat |
| 151 | 163 | |
| 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 | |
| 153 | 166 | Index: file6.dat |
| 154 | 167 | ================================================================== |
| 155 | 168 | --- /dev/null\t |
| 156 | 169 | +++ file6.dat\t |
| 157 | 170 | @@ -0,0 +1,1 @@ |
| 158 | -+test file 6 (one line no term)."} | |
| 171 | ++test file 6 (one line no term)." | |
| 159 | 172 | |
| 160 | 173 | ############################################################################### |
| 161 | 174 | |
| 162 | 175 | test_cleanup |
| 163 | 176 |
| --- 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 @@ | ||
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | # This is needed because we are now running outside of the Fossil checkout. |
| 74 | 74 | file mkdir file1; set savedPwd [pwd]; cd file1 |
| 75 | 75 | |
| 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. | |
| 77 | 78 | file mkdir test1 |
| 78 | 79 | file mkdir test1/test2 |
| 79 | 80 | |
| 80 | 81 | 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 | |
| 83 | 86 | relative-name 103 . [pwd] . |
| 84 | 87 | |
| 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 | |
| 88 | 94 | relative-tree-name 103 . [pwd] file1 |
| 89 | 95 | |
| 90 | 96 | set dirname [file normalize [file dirname [pwd]]] |
| 91 | 97 | |
| 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 | |
| 95 | 104 | absolute-tree-name 103 . [pwd] $dirname/file1 |
| 96 | 105 | |
| 97 | 106 | catch {file delete test1/test2} |
| 98 | 107 | catch {file delete test1} |
| 99 | 108 | |
| 100 | 109 |
| --- 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 @@ | ||
| 1 | 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. | |
| 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. | |
| 8 | 7 | # |
| 9 | 8 | # The HTTPS tests need openssl and a fossil built with TLS support. The |
| 10 | 9 | # tests that reset a connection, and the HTTPS tests that check what |
| 11 | 10 | # fossil does with a reply, need python3 to run http-relay.py. |
| 12 | 11 | # |
| @@ -34,58 +33,24 @@ | ||
| 34 | 33 | test_setup "" |
| 35 | 34 | fossil test-th-eval {hasfeature ssl} |
| 36 | 35 | set haveTls [expr {[normalize_result] eq "1" && [auto_execok openssl] ne ""}] |
| 37 | 36 | set havePython [expr {[auto_execok python3] ne ""}] |
| 38 | 37 | set haveIpv6 [expr {![catch {close [socket -server list -myaddr ::1 0]}]}] |
| 39 | -set httpServers [list] | |
| 40 | 38 | set httpPids [list] |
| 41 | 39 | set httpFossilServers [list] |
| 42 | 40 | set httpAnswer "" |
| 43 | 41 | |
| 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 | 42 | # Clones URL into c.fossil with the options in ARGS, answering fossil's |
| 79 | 43 | # prompts with the lines in httpAnswer. Returns "cloned" when the clone |
| 80 | 44 | # is a complete copy of r.fossil. When fossil exits with status 1 and |
| 81 | 45 | # does not leave c.fossil, returns its output, and otherwise says what |
| 82 | 46 | # went wrong. |
| 83 | 47 | # |
| 84 | 48 | proc http_clone {url args} { |
| 85 | 49 | 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] | |
| 87 | 52 | if {$::CODE == 0} { |
| 88 | 53 | fossil sql -R c.fossil "SELECT count(*) FROM blob" |
| 89 | 54 | if {$::RESULT == $::httpBlobs} {return cloned} |
| 90 | 55 | return "cloned $::RESULT of $::httpBlobs blobs" |
| 91 | 56 | } |
| @@ -97,47 +62,23 @@ | ||
| 97 | 62 | # Listens on a port on 127.0.0.1 that the system chooses, and returns |
| 98 | 63 | # the port. Calls HANDLER with each connection and the request on it, |
| 99 | 64 | # once the whole request has arrived, and then closes the connection. |
| 100 | 65 | # |
| 101 | 66 | 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 | + | |
| 135 | 76 | proc http_listen_close {} { |
| 136 | 77 | set server [socket -server {apply {{chan address port} {close $chan}}} \ |
| 137 | 78 | -myaddr 127.0.0.1 0] |
| 138 | - lappend ::httpServers $server | |
| 79 | + lappend ::testListeners $server | |
| 139 | 80 | return [lindex [fconfigure $server -sockname] 2] |
| 140 | 81 | } |
| 141 | 82 | |
| 142 | 83 | # Starts http-relay.py with ARGS and returns the port it listens on. Its |
| 143 | 84 | # output goes to relay-PORT.log. |
| @@ -358,11 +299,11 @@ | ||
| 358 | 299 | puts -nonewline $chan "HTTP/1.1 200 OK\r\nContent-Length: 3\r\n" |
| 359 | 300 | puts -nonewline $chan "Connection: close\r\n\r\nnew" |
| 360 | 301 | } |
| 361 | 302 | } |
| 362 | 303 | 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 | |
| 364 | 305 | test_eq http-rfc-relative-redirect \ |
| 365 | 306 | [expr {[file exists new.txt] ? [read_file new.txt] : ""}] new knownBug |
| 366 | 307 | |
| 367 | 308 | # xfer lines with more tokens than any card has. The clone must fail |
| 368 | 309 | # with "unknown command" and not crash. |
| @@ -629,12 +570,12 @@ | ||
| 629 | 570 | test_eq http-rfc-https-trailing-dot \ |
| 630 | 571 | [http_clone https://localhost.:$tlsPort/] cloned |
| 631 | 572 | unset env(SSL_CERT_FILE) |
| 632 | 573 | } |
| 633 | 574 | |
| 634 | -foreach server $httpServers {close $server} | |
| 575 | +test_listen_stop | |
| 635 | 576 | foreach pid $httpPids {catch {exec kill $pid}} |
| 636 | 577 | foreach server $httpFossilServers { |
| 637 | 578 | test_stop_server [lindex $server 0] [lindex $server 0] [lindex $server 2] |
| 638 | 579 | } |
| 639 | 580 | array set env [array get httpSavedEnv] |
| 640 | 581 | test_cleanup |
| 641 | 582 |
| --- 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 @@ | ||
| 75 | 75 | # the response body. |
| 76 | 76 | # |
| 77 | 77 | # Returns the status code from the HTTP header. |
| 78 | 78 | proc fossil_http_json {url {cookie "Muppet=Monster"} args} { |
| 79 | 79 | 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"] ""] | |
| 81 | 84 | set RESULT [fossil_maybe_answer $request http {*}$args --ipaddr 127.0.0.1] |
| 82 | 85 | set head ""; set body ""; set status "--NO_MATCH--" |
| 83 | 86 | regexp {(?w)(.*)^\s*$(.*)} $RESULT dummy head body |
| 84 | 87 | regexp {^HTTP\S+\s+(\d\d\d)\s+(.*)$} $head dummy status msg |
| 85 | 88 | if {$status eq "200"} { |
| @@ -117,11 +120,10 @@ | ||
| 117 | 120 | }] |
| 118 | 121 | } |
| 119 | 122 | |
| 120 | 123 | # handle the actual request |
| 121 | 124 | flush stdout |
| 122 | - #exec $fossilexe | |
| 123 | 125 | set RESULT [fossil_maybe_answer $request http {*}$args --ipaddr 127.0.0.1] |
| 124 | 126 | |
| 125 | 127 | # separate HTTP headers from body |
| 126 | 128 | set head ""; set body ""; set status "--NO_MATCH--" |
| 127 | 129 | regexp {(?w)(.*)^\s*$(.*)} $RESULT dummy head body |
| @@ -190,11 +192,11 @@ | ||
| 190 | 192 | |
| 191 | 193 | # Check for basic envelope fields in the result with an error |
| 192 | 194 | fossil_json -expectError |
| 193 | 195 | test_json_envelope json-enverr [concat resultCode fossil timestamp \ |
| 194 | 196 | 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" | |
| 196 | 198 | |
| 197 | 199 | |
| 198 | 200 | # Check for basic envelope fields in the result with a successful |
| 199 | 201 | # command |
| 200 | 202 | set HAIfields [concat manifestUuid manifestVersion manifestDate \ |
| @@ -221,36 +223,37 @@ | ||
| 221 | 223 | #### ARTIFACT |
| 222 | 224 | |
| 223 | 225 | # sha1 of 0 bytes and a file to match in a commit |
| 224 | 226 | set UUID_empty da39a3ee5e6b4b0d3255bfef95601890afd80709 |
| 225 | 227 | # 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 | |
| 227 | 230 | write_file empty "" |
| 228 | 231 | fossil add empty |
| 229 | 232 | fossil ci -m "empty file" |
| 230 | 233 | |
| 231 | 234 | # json artifact (checkin) |
| 232 | 235 | fossil_json [concat artifact tip] |
| 233 | 236 | 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" | |
| 235 | 238 | test_json_payload json-artifact \ |
| 236 | 239 | [concat type uuid isLeaf timestamp user comment parents tags files] {} |
| 237 | 240 | |
| 238 | 241 | # json artifact (file) |
| 239 | 242 | fossil_json [concat artifact $UUID_empty_64] |
| 240 | 243 | 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" | |
| 242 | 245 | test_json_payload json-artifact [concat type uuid size checkins] {} |
| 243 | 246 | |
| 244 | 247 | # json artifact (wiki) |
| 245 | 248 | fossil wiki create Empty <<"-=BLANK=-" |
| 246 | 249 | 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" | |
| 248 | 251 | set uuid [dict get $JR payload uuid] |
| 249 | 252 | fossil_json artifact $uuid |
| 250 | 253 | 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" | |
| 252 | 255 | test_json_payload json-artifact-wiki [list type uuid artifact] {} |
| 253 | 256 | set artifact [dict get $JR payload artifact] |
| 254 | 257 | test_dict_keys json-artifact-wiki-artifact $artifact \ |
| 255 | 258 | [list name uuid user timestamp size] {} |
| 256 | 259 | # name, uuid, parent?, user, timestamp, size?, content? |
| @@ -300,12 +303,14 @@ | ||
| 300 | 303 | test_json_envelope_ok json-login-u1-env |
| 301 | 304 | test_json_payload json-login-u1 {authToken name capabilities loginCookieName} {} |
| 302 | 305 | set AuthU1 [dict get $JR payload] |
| 303 | 306 | test_hascaps json-login-c "s" [dict get $AuthU1 capabilities] |
| 304 | 307 | |
| 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} ] | |
| 307 | 312 | |
| 308 | 313 | # json cap |
| 309 | 314 | # The CLI user has all rights, and no auth token affects that. This |
| 310 | 315 | # is consistent with the rest of the fossil CLI, and with the |
| 311 | 316 | # pragmatic argument that using the CLI implies physical access to |
| @@ -340,11 +345,12 @@ | ||
| 340 | 345 | if {[catch {test json-cap-GETcookie-name-0 \ |
| 341 | 346 | {[dict get $JR payload name] eq "anonymous"}} jerr]} then { |
| 342 | 347 | test json-cap-GETcookie-name-0-threw 0 |
| 343 | 348 | protOut "CAUGHT: $jerr" |
| 344 | 349 | } |
| 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]} | |
| 346 | 352 | |
| 347 | 353 | |
| 348 | 354 | # json cap via GET with authToken in a parameter |
| 349 | 355 | fossil_post_json "/json/cap?authToken=[dict get $AuthAnon authToken]" {} |
| 350 | 356 | test json-cap-GETcookie-env-1 {[string length $JR] > 0} |
| @@ -352,31 +358,29 @@ | ||
| 352 | 358 | if {[catch {test json-cap-GETcookie-name-1 \ |
| 353 | 359 | {[dict get $JR payload name] eq "anonymous"}} jerr]} then { |
| 354 | 360 | test json-cap-GETcookie-name-1-threw 0 |
| 355 | 361 | protOut "CAUGHT: $jerr" |
| 356 | 362 | } |
| 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]} | |
| 358 | 365 | |
| 359 | 366 | |
| 360 | -# whoami | |
| 361 | 367 | # via CLI with no auth token supplied |
| 362 | 368 | fossil_json whoami |
| 363 | 369 | test_json_envelope_ok json-whoami-cli-env |
| 364 | 370 | 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" | |
| 366 | 372 | test_hascaps json-whoami-cli-cap "gjorz" [dict get $JR payload capabilities] |
| 367 | 373 | |
| 368 | 374 | #### BRANCHES |
| 369 | -# json branch list | |
| 370 | 375 | fossil_json branch list |
| 371 | 376 | test_json_envelope_ok json-branch-list-env |
| 372 | 377 | 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" | |
| 374 | 379 | 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" | |
| 376 | 381 | |
| 377 | -# json branch create | |
| 378 | 382 | fossil_json branch create alpha --basis trunk |
| 379 | 383 | test_json_envelope_ok json-branch-create-env |
| 380 | 384 | test_json_payload json-branch-create {name basis rid uuid isPrivate} {} |
| 381 | 385 | |
| 382 | 386 | |
| @@ -412,40 +416,37 @@ | ||
| 412 | 416 | |
| 413 | 417 | test fossil-diff-setup {$fishV1 ne $fishV2} |
| 414 | 418 | fossil_json diff $fishV1 $fishV2 |
| 415 | 419 | test_json_envelope_ok json-diff-env |
| 416 | 420 | 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 | |
| 419 | 423 | set diff [dict get $JR payload diff] |
| 420 | 424 | test json-diff-diff {[string first "+LMNO goldfish" $diff] >= 0} |
| 421 | 425 | protOut [dict get $JR payload diff] |
| 422 | 426 | |
| 423 | 427 | |
| 424 | 428 | #### DIRECTORY LISTING |
| 425 | -# json dir DIRNAME | |
| 426 | 429 | fossil_json dir |
| 427 | 430 | test_json_envelope_ok json-dir-env |
| 428 | 431 | test_json_payload json-dir {name entries} {} |
| 429 | 432 | |
| 430 | 433 | #### FILE INFO |
| 431 | -# json finfo FILENAME | |
| 432 | 434 | fossil_json finfo empty |
| 433 | 435 | test_json_envelope_ok json-finfo-env |
| 434 | 436 | test_json_payload json-finfo {name checkins} {} |
| 435 | 437 | |
| 436 | 438 | #### QUERY |
| 437 | -# json query SQLCODE | |
| 438 | 439 | fossil_json query {"SELECT * FROM reportfmt"} |
| 439 | 440 | test_json_envelope_ok json-query-env |
| 440 | 441 | test_json_payload json-query {columns rows} {} |
| 441 | 442 | |
| 442 | 443 | #### STATS |
| 443 | -# json stat | |
| 444 | 444 | fossil_json stat |
| 445 | 445 | 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} \ | |
| 447 | 448 | {blobCount deltaCount uncompressedArtifactSize averageArtifactSize maxArtifactSize \ |
| 448 | 449 | compressionRatio checkinCount fileCount wikiPageCount ticketCount} |
| 449 | 450 | |
| 450 | 451 | fossil_json stat -f |
| 451 | 452 | test_json_envelope_ok json-stat-full-env |
| @@ -455,18 +456,17 @@ | ||
| 455 | 456 | ageDays ageYears projectCode compiler sqlite} {} |
| 456 | 457 | |
| 457 | 458 | |
| 458 | 459 | #### STATUS |
| 459 | 460 | # NOTE: Local checkout required |
| 460 | -# json status | |
| 461 | 461 | fossil_json status |
| 462 | 462 | 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 | + {} | |
| 464 | 465 | |
| 465 | 466 | #### TAGS |
| 466 | 467 | |
| 467 | -# json tag add NAME CHECKIN VALUE | |
| 468 | 468 | fossil_json tag add blue trunk green |
| 469 | 469 | test_json_envelope_ok json-tag-add-env |
| 470 | 470 | test_json_payload json-tag-add {name value propagate raw appliedTo} {} |
| 471 | 471 | |
| 472 | 472 | |
| @@ -474,17 +474,15 @@ | ||
| 474 | 474 | fossil_json tag add cancel alpha |
| 475 | 475 | test_json_envelope_ok json-tag-cancel-env |
| 476 | 476 | # DOCBUG? Doc says no payload. |
| 477 | 477 | test_json_payload json-tag-cancel {name value propagate raw appliedTo} {} |
| 478 | 478 | |
| 479 | -# json tag find NAME | |
| 480 | 479 | fossil_json tag find alpha |
| 481 | 480 | test_json_envelope_ok json-tag-find-env |
| 482 | 481 | test_json_payload json-tag-find {name raw type limit artifacts} {} |
| 483 | 482 | test json-tag-find-count {[llength [dict get $JR payload artifacts]] >= 1} |
| 484 | 483 | |
| 485 | -# json tag list CHECKIN | |
| 486 | 484 | fossil_json tag list |
| 487 | 485 | test_json_envelope_ok json-tag-list-env |
| 488 | 486 | test_json_payload json-tag-list {raw includeTickets tags} {} |
| 489 | 487 | test json-tag-list-count {[llength [dict get $JR payload tags]] >= 2} |
| 490 | 488 | |
| @@ -493,56 +491,45 @@ | ||
| 493 | 491 | # API Docs say not yet defined, so it isn't quite fair to mark this |
| 494 | 492 | # category as TODO for the test cases... |
| 495 | 493 | |
| 496 | 494 | #### TICKET REPORTS |
| 497 | 495 | |
| 498 | -# json report get NUMBER | |
| 499 | 496 | fossil_json report get 1 |
| 500 | 497 | 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} {} | |
| 502 | 500 | |
| 503 | -# json report list | |
| 504 | 501 | fossil_json report list |
| 505 | 502 | test_json_envelope_ok json-report-list-env |
| 506 | -#test_json_payload json-report-list {raw includeTickets tags} {} | |
| 507 | 503 | test json-report-list-count {[llength [dict get $JR payload]] >= 1} |
| 508 | 504 | |
| 509 | 505 | |
| 510 | -# json report run NUMBER | |
| 511 | 506 | fossil_json report run 1 |
| 512 | 507 | test_json_envelope_ok json-report-run-1-env |
| 513 | 508 | test_json_payload json-report-run {report title sqlcode columnNames tickets} {} |
| 514 | 509 | test json-report-run-cols {[llength [dict get $JR payload columnNames]] >= 7} |
| 515 | 510 | test json-report-run-tkts {[llength [dict get $JR payload tickets]] >= 0} |
| 516 | 511 | |
| 517 | 512 | |
| 518 | 513 | #### TIMELINE |
| 519 | 514 | |
| 520 | -# json timeline checkin | |
| 521 | 515 | fossil_json timeline checkin |
| 522 | 516 | test_json_envelope_ok json-timeline-checkin-env |
| 523 | 517 | test_json_payload json-timeline-checkin {limit timeline} {} |
| 524 | 518 | set i 0 |
| 525 | 519 | foreach t [dict get $JR payload timeline] { |
| 526 | 520 | # parents appears only for entries that have a parent |
| 527 | 521 | # 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} {} | |
| 529 | 524 | incr i |
| 530 | 525 | } |
| 531 | 526 | |
| 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 | 527 | fossil_json timeline ticket |
| 540 | 528 | test_json_envelope_ok json-timeline-ticket-env |
| 541 | 529 | test_json_payload json-timeline-ticket {limit timeline} {} |
| 542 | 530 | |
| 543 | -# json timeline wiki | |
| 544 | 531 | fossil_json timeline wiki |
| 545 | 532 | test_json_envelope_ok json-timeline-wiki-env |
| 546 | 533 | test_json_payload json-timeline-wiki {limit timeline} {} |
| 547 | 534 | |
| 548 | 535 | |
| @@ -553,54 +540,46 @@ | ||
| 553 | 540 | fossil_json user get $u |
| 554 | 541 | test_json_envelope_ok json-user-get-$u-env |
| 555 | 542 | test_json_payload json-user-get-$u {uid name capabilities info timestamp} {} |
| 556 | 543 | } |
| 557 | 544 | |
| 558 | -# json user list | |
| 559 | 545 | fossil_json user list |
| 560 | 546 | test_json_envelope_ok json-user-list-env |
| 561 | 547 | set i 0 |
| 562 | 548 | foreach u [dict get $JR payload] { |
| 563 | 549 | test_dict_keys json-user-list-$i $u {uid name capabilities info timestamp} {} |
| 564 | 550 | incr i |
| 565 | 551 | } |
| 566 | 552 | |
| 567 | -# json user save | |
| 568 | 553 | fossil_json user save --uid -1 --name U2 --password Utwo |
| 569 | 554 | test_json_envelope_ok json-user-save-env |
| 570 | 555 | test_json_payload json-user-save {uid name capabilities info timestamp} {} |
| 571 | 556 | |
| 572 | 557 | |
| 573 | 558 | # DOCBUG? Doc says payload is "same as /json/user/get" but actual |
| 574 | 559 | # 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 | 560 | |
| 582 | 561 | |
| 583 | 562 | |
| 584 | 563 | #### WIKI |
| 585 | 564 | |
| 586 | -# wiki list | |
| 587 | 565 | fossil_json wiki list |
| 588 | 566 | test_json_envelope_ok json-wiki-list-env |
| 589 | 567 | set pages [dict get $JR payload] |
| 590 | 568 | 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" | |
| 592 | 570 | fossil_json wiki list --verbose |
| 593 | 571 | set pages [dict get $JR payload] |
| 594 | 572 | 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] {} | |
| 596 | 575 | |
| 597 | -# wiki get | |
| 598 | 576 | fossil_json wiki get Empty |
| 599 | 577 | test_json_envelope_ok json-wiki-get-env |
| 600 | 578 | # 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] | |
| 602 | 581 | |
| 603 | 582 | |
| 604 | 583 | # wiki create |
| 605 | 584 | # requires an authToken? Not from CLI. |
| 606 | 585 | |
| @@ -615,11 +594,12 @@ | ||
| 615 | 594 | } |
| 616 | 595 | fossil_json --json-input req.json |
| 617 | 596 | test_json_envelope_ok json-wiki-create-env |
| 618 | 597 | fossil_json wiki get Page2 |
| 619 | 598 | 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} | |
| 621 | 601 | set uuid1 [dict get $JR payload uuid] |
| 622 | 602 | |
| 623 | 603 | # wiki save |
| 624 | 604 | |
| 625 | 605 | write_file req2.json { |
| @@ -633,24 +613,25 @@ | ||
| 633 | 613 | } |
| 634 | 614 | fossil_json --json-input req2.json |
| 635 | 615 | test_json_envelope_ok json-wiki-save-env |
| 636 | 616 | fossil_json wiki get Page2 |
| 637 | 617 | 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] {} | |
| 639 | 620 | 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 | |
| 641 | 622 | |
| 642 | 623 | # wiki diff |
| 643 | 624 | |
| 644 | 625 | fossil_json wiki diff $uuid1 $uuid2 |
| 645 | 626 | test_json_envelope_ok json-wiki-diff-env |
| 646 | 627 | 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 | |
| 649 | 630 | 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} | |
| 652 | 633 | |
| 653 | 634 | # wiki preview |
| 654 | 635 | # |
| 655 | 636 | # takes a string in fossil wiki markup and return an HTML fragment. |
| 656 | 637 | # This command does not make use of the actual wiki content (much?) |
| @@ -667,31 +648,29 @@ | ||
| 667 | 648 | test json-wiki-preview-out-1 {[string first "<p>Lorem ipsum" $pv] == 0} |
| 668 | 649 | test json-wiki-preview-out-2 {[string last "<p>" $pv] == 0} |
| 669 | 650 | |
| 670 | 651 | #### UNAVOIDABLE MISC |
| 671 | 652 | |
| 672 | -# json g | |
| 673 | 653 | fossil_json g |
| 674 | 654 | test_json_envelope_ok json-g-env |
| 675 | -#puts [llength [dict keys [dict get $JR payload]]] | |
| 676 | 655 | test json-g-g {[llength [dict keys [dict get $JR payload]]] >= 60};# 64 on my PC |
| 677 | 656 | |
| 678 | -# json rebuild | |
| 679 | 657 | 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 \ | |
| 681 | 660 | procTimeMs] [concat payload resultCode resultText] |
| 682 | 661 | |
| 683 | -# json resultCodes | |
| 684 | 662 | fossil_json resultCodes |
| 685 | 663 | test_json_envelope_ok json-resultCodes-env |
| 686 | 664 | 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 | |
| 691 | 667 | 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]"] ""] | |
| 693 | 672 | } |
| 694 | 673 | |
| 695 | 674 | |
| 696 | 675 | |
| 697 | 676 | #### From the API Docs |
| @@ -702,12 +681,12 @@ | ||
| 702 | 681 | # is not writable" error comes back as HTML. i don't know if the |
| 703 | 682 | # error happens before we have made the determination that the app is |
| 704 | 683 | # in JSON mode or if the error handling is incorrectly not |
| 705 | 684 | # recognizing JSON mode. |
| 706 | 685 | # |
| 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 | |
| 709 | 688 | test json-ROrepo-1-1 {$CODE == 0} |
| 710 | 689 | test json-ROrepo-1-2 {[regexp {\}\s*$} $RESULT]} |
| 711 | 690 | test json-ROrepo-1-3 {![regexp {SQLITE_[A-Z]+:} $RESULT]} |
| 712 | 691 | test_json_envelope_ok json-http-timeline1 |
| 713 | 692 | if {$is_windows} then { |
| @@ -714,15 +693,15 @@ | ||
| 714 | 693 | catch {exec attrib +r .rep.fossil}; # Windows |
| 715 | 694 | } else { |
| 716 | 695 | catch {exec chmod 444 .rep.fossil}; # Unix |
| 717 | 696 | } |
| 718 | 697 | 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 | |
| 720 | 700 | test json-ROrepo-2-1 {$CODE != 0} |
| 721 | 701 | test json-ROrepo-2-2 {[regexp {\}\s*$} $RESULT]} |
| 722 | 702 | test json-ROrepo-2-3 {![regexp {SQLITE_[A-Z]+:} $RESULT]} |
| 723 | -#test_json_envelope_ok json-http-timeline2 | |
| 724 | 703 | if {$is_windows} then { |
| 725 | 704 | catch {exec attrib -r .rep.fossil}; # Windows |
| 726 | 705 | catch {exec attrib -r .rep.fossil-shm} |
| 727 | 706 | catch {exec attrib -r .rep.fossil-wal} |
| 728 | 707 | } else { |
| @@ -755,20 +734,21 @@ | ||
| 755 | 734 | } |
| 756 | 735 | fossil_json --json-input e1101.json -expectError |
| 757 | 736 | test json-RC-1101-array-CLI-exit {$CODE != 0} |
| 758 | 737 | test_json_envelope json-RC-1101-array-env {fossil timestamp command procTimeUs \ |
| 759 | 738 | 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" | |
| 761 | 740 | |
| 762 | 741 | write_file e1101.json { |
| 763 | 742 | "Not really a command but more of a suggestion" |
| 764 | 743 | } |
| 765 | 744 | fossil_json --json-input e1101.json -expectError |
| 766 | 745 | 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 \ | |
| 768 | 748 | 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" | |
| 770 | 750 | |
| 771 | 751 | |
| 772 | 752 | |
| 773 | 753 | |
| 774 | 754 | # FOSSIL-1102 FSL_JSON_E_UNKNOWN_COMMAND |
| @@ -775,11 +755,11 @@ | ||
| 775 | 755 | # Unknown command or subcommand |
| 776 | 756 | fossil_json NoSuchEndpoint -expectError |
| 777 | 757 | test json-RC-1102-CLI-exit {$CODE != 0} |
| 778 | 758 | test_json_envelope json-RC-1102-env {fossil timestamp command procTimeUs \ |
| 779 | 759 | 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" | |
| 781 | 761 | |
| 782 | 762 | write_file e1102.json { |
| 783 | 763 | { |
| 784 | 764 | "command":"no/such/endpoint" |
| 785 | 765 | } |
| @@ -786,11 +766,11 @@ | ||
| 786 | 766 | } |
| 787 | 767 | fossil_json --json-input e1102.json -expectError |
| 788 | 768 | test json-env-RC-1102a-CLI-exit {$CODE != 0} |
| 789 | 769 | test_json_envelope json-env-RC-1102a-env {fossil timestamp command procTimeUs \ |
| 790 | 770 | 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" | |
| 792 | 772 | |
| 793 | 773 | |
| 794 | 774 | # FOSSIL-1103 FSL_JSON_E_UNKNOWN |
| 795 | 775 | # Unknown error |
| 796 | 776 | |
| @@ -800,11 +780,12 @@ | ||
| 800 | 780 | test json-env-RC-1103-CLI-exit {$CODE != 0} |
| 801 | 781 | if { $JR ne "" } { |
| 802 | 782 | test_json_envelope json-env-RC-1103-env {fossil timestamp command procTimeUs \ |
| 803 | 783 | procTimeMs resultCode resultText} {payload} |
| 804 | 784 | 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 | |
| 806 | 787 | } else { |
| 807 | 788 | protOut "Want test case for FOSSIL-1103" |
| 808 | 789 | test json-RC-1103 0 knownBug |
| 809 | 790 | } |
| 810 | 791 | |
| @@ -855,13 +836,14 @@ | ||
| 855 | 836 | "number":42 |
| 856 | 837 | } |
| 857 | 838 | } |
| 858 | 839 | fossil_json --json-input e3002.json -expectError |
| 859 | 840 | 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 \ | |
| 861 | 843 | 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" | |
| 863 | 845 | |
| 864 | 846 | |
| 865 | 847 | # FOSSIL-3003 FSL_JSON_E_AMBIGUOUS_UUID |
| 866 | 848 | # Resource identifier is ambiguous |
| 867 | 849 | # FOSSIL-3004 FSL_JSON_E_UNRESOLVED_UUID |
| @@ -889,11 +871,11 @@ | ||
| 889 | 871 | fossil close |
| 890 | 872 | fossil_json HAI -expectError |
| 891 | 873 | test json-RC-4102-CLI-exit {$CODE != 0} |
| 892 | 874 | test_json_envelope json-RC-4102-CLI-exit {fossil timestamp command procTimeUs \ |
| 893 | 875 | 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" | |
| 895 | 877 | |
| 896 | 878 | # FOSSIL-4103 FSL_JSON_E_DB_NOT_VALID |
| 897 | 879 | # Fossil repository db file is not valid. |
| 898 | 880 | write_file nope.fossil { |
| 899 | 881 | This is not a fossil repo. It ought to be a SQLite db with a well-known schema, |
| @@ -902,11 +884,11 @@ | ||
| 902 | 884 | fossil_json HAI -R nope.fossil -expectError |
| 903 | 885 | test json-RC-4103-CLI-exit {$CODE != 0} |
| 904 | 886 | if { $JR ne "" } { |
| 905 | 887 | test_json_envelope json-RC-4103-CLI {fossil timestamp command procTimeUs \ |
| 906 | 888 | 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" | |
| 908 | 890 | } else { |
| 909 | 891 | test json-RC-4103 0 knownBug |
| 910 | 892 | } |
| 911 | 893 | |
| 912 | 894 | ############################################################################### |
| 913 | 895 |
| --- 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 @@ | ||
| 18 | 18 | # Tests of the 3-way merge |
| 19 | 19 | # |
| 20 | 20 | |
| 21 | 21 | test_setup "" |
| 22 | 22 | |
| 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 { | |
| 24 | 36 | 111 - This is line one of the demo program - 1111 |
| 25 | 37 | 222 - The second line program line in code - 2222 |
| 26 | 38 | 333 - This is a test of the merging algohm - 3333 |
| 27 | 39 | 444 - If all goes well, we will be pleased - 4444 |
| 28 | 40 | 555 - we think it well and other stuff too - 5555 |
| 29 | 41 | } |
| 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 { | |
| 38 | 43 | 111 - This is line one of the demo program - 1111 |
| 39 | 44 | 222 - The second line program line in code - 2222 |
| 40 | 45 | 333 - This is a test OF THE merging algohm - 3333 |
| 41 | 46 | 444 - If all goes well, we will be pleased - 4444 |
| 42 | 47 | 555 - we think it well and other stuff too - 5555 |
| 43 | 48 | } |
| 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 { | |
| 45 | 57 | 111 - This is line ONE of the demo program - 1111 |
| 46 | 58 | 222 - The second line program line in code - 2222 |
| 47 | 59 | 333 - This is a test OF THE merging algohm - 3333 |
| 48 | 60 | 444 - If all goes well, we will be pleased - 4444 |
| 49 | 61 | 555 - we think it well and other stuff too - 5555 |
| 50 | 62 | } |
| 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 | |
| 55 | 65 | |
| 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 | |
| 58 | 68 | 222 - The second line program line in code - 2222 |
| 59 | 69 | 333 - This is a test of the merging algohm - 3333 |
| 60 | 70 | 444 - If all goes well, we will be pleased - 4444 |
| 61 | 71 | 555 - we think it well and other stuff too - 5555 |
| 62 | 72 | } |
| 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) | |
| 64 | 81 | 111 - This is line ONE of the demo program - 1111 |
| 82 | + >>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> | |
| 65 | 83 | 222 - The second line program line in code - 2222 |
| 66 | 84 | 333 - This is a test of the merging algohm - 3333 |
| 67 | 85 | 444 - If all goes well, we will be pleased - 4444 |
| 68 | 86 | 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 { | |
| 78 | 89 | <<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<< (line 1) |
| 79 | 90 | 111 - This is line ONE of the demo program - 1111 |
| 80 | 91 | ####### SUGGESTED CONFLICT RESOLUTION follows ################### |
| 81 | 92 | 111 - This is line ONE OF the demo program - 1111 |
| 82 | 93 | ||||||| COMMON ANCESTOR content follows ||||||||||||||||||||||||| (line 1) |
| @@ -86,86 +97,30 @@ | ||
| 86 | 97 | >>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
| 87 | 98 | 222 - The second line program line in code - 2222 |
| 88 | 99 | 333 - This is a test of the merging algohm - 3333 |
| 89 | 100 | 444 - If all goes well, we will be pleased - 4444 |
| 90 | 101 | 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 { | |
| 153 | 114 | 000 - Zero lines added to the beginning of - 0000 |
| 154 | 115 | 111 - This is line one of the demo program - 1111 |
| 155 | 116 | 222 - The second line program line in code - 2222 |
| 156 | 117 | 333 - This is a test of the merging algohm - 3333 |
| 157 | 118 | 444 - If all goes well, we will be pleased - 4444 |
| 158 | 119 | 555 - we think it well and other stuff too - 5555 |
| 159 | 120 | } |
| 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 { | |
| 167 | 122 | <<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<< (line 1) |
| 168 | 123 | ####### SUGGESTED CONFLICT RESOLUTION follows ################### |
| 169 | 124 | 000 - Zero lines added to the beginning of - 0000 |
| 170 | 125 | 111 - This is line one of the demo program - 1111 |
| 171 | 126 | ||||||| COMMON ANCESTOR content follows ||||||||||||||||||||||||| (line 1) |
| @@ -176,12 +131,12 @@ | ||
| 176 | 131 | >>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
| 177 | 132 | 222 - The second line program line in code - 2222 |
| 178 | 133 | 333 - This is a test of the merging algohm - 3333 |
| 179 | 134 | 444 - If all goes well, we will be pleased - 4444 |
| 180 | 135 | 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 { | |
| 183 | 138 | <<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<< (line 1) |
| 184 | 139 | 000 - Zero lines added to the beginning of - 0000 |
| 185 | 140 | 111 - This is line one of the demo program - 1111 |
| 186 | 141 | ||||||| COMMON ANCESTOR content follows ||||||||||||||||||||||||| (line 1) |
| 187 | 142 | 111 - This is line one of the demo program - 1111 |
| @@ -189,79 +144,51 @@ | ||
| 189 | 144 | >>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
| 190 | 145 | 222 - The second line program line in code - 2222 |
| 191 | 146 | 333 - This is a test of the merging algohm - 3333 |
| 192 | 147 | 444 - If all goes well, we will be pleased - 4444 |
| 193 | 148 | 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 | |
| 199 | 150 | |
| 200 | -write_file_indented t1 { | |
| 151 | +set merge1G5T2 { | |
| 201 | 152 | 111 - This is line one of the demo program - 1111 |
| 202 | 153 | 222 - The second line program line in code - 2222 |
| 203 | 154 | 333 - This is a test of the merging algohm - 3333 |
| 204 | 155 | 444 - If all goes well, we will be pleased - 4444 |
| 205 | 156 | 555 - we think it well and other stuff too - 5555 |
| 157 | + 666 - Extra line at the end of the file wi - 6666 | |
| 206 | 158 | } |
| 207 | -write_file_indented t2 { | |
| 208 | - 111 - This is line one of the demo program - 1111 | |
| 159 | +set merge1G5T32 { | |
| 209 | 160 | 222 - The second line program line in code - 2222 |
| 210 | 161 | 333 - This is a test of the merging algohm - 3333 |
| 211 | 162 | 444 - If all goes well, we will be pleased - 4444 |
| 212 | 163 | 555 - we think it well and other stuff too - 5555 |
| 213 | 164 | 666 - Extra line at the end of the file wi - 6666 |
| 214 | 165 | } |
| 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 { | |
| 263 | 190 | abcd |
| 264 | 191 | efgh |
| 265 | 192 | ijkl |
| 266 | 193 | mnop |
| 267 | 194 | qrst |
| @@ -272,26 +199,11 @@ | ||
| 272 | 199 | KLMN |
| 273 | 200 | OPQR |
| 274 | 201 | STUV |
| 275 | 202 | XYZ. |
| 276 | 203 | } |
| 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 { | |
| 293 | 205 | abcd |
| 294 | 206 | efgh |
| 295 | 207 | ijkl |
| 296 | 208 | mnop 3 |
| 297 | 209 | qrst 3 |
| @@ -302,11 +214,25 @@ | ||
| 302 | 214 | KLMN |
| 303 | 215 | OPQR |
| 304 | 216 | STUV |
| 305 | 217 | XYZ. |
| 306 | 218 | } |
| 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 { | |
| 308 | 234 | abcd |
| 309 | 235 | <<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<< (line 2) |
| 310 | 236 | efgh 2 |
| 311 | 237 | ijkl 2 |
| 312 | 238 | mnop 2 |
| @@ -345,15 +271,12 @@ | ||
| 345 | 271 | >>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
| 346 | 272 | KLMN |
| 347 | 273 | OPQR |
| 348 | 274 | STUV |
| 349 | 275 | 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 { | |
| 355 | 278 | abcd |
| 356 | 279 | efgh 2 |
| 357 | 280 | ijkl 2 |
| 358 | 281 | mnop |
| 359 | 282 | qrst |
| @@ -363,27 +286,11 @@ | ||
| 363 | 286 | GHIJ 2 |
| 364 | 287 | KLMN |
| 365 | 288 | OPQR |
| 366 | 289 | STUV |
| 367 | 290 | 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 { | |
| 385 | 292 | abcd |
| 386 | 293 | <<<<<<< BEGIN MERGE CONFLICT: local copy shown first <<<<<<<<<<<< (line 2) |
| 387 | 294 | efgh 2 |
| 388 | 295 | ijkl 2 |
| 389 | 296 | mnop |
| @@ -422,12 +329,10 @@ | ||
| 422 | 329 | >>>>>>> END MERGE CONFLICT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
| 423 | 330 | KLMN |
| 424 | 331 | OPQR |
| 425 | 332 | STUV |
| 426 | 333 | XYZ. |
| 427 | -} | |
| 428 | -fossil 3-way-merge t1 t2 t3 a23 -expectError | |
| 429 | -test merge1-7.2 {[same_file t23 a23]} | |
| 334 | +} -expectError | |
| 430 | 335 | |
| 431 | 336 | ############################################################################### |
| 432 | 337 | |
| 433 | 338 | test_cleanup |
| 434 | 339 |
| --- 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 |
+4
-3
| --- test/merge5.test | ||
| +++ test/merge5.test | ||
| @@ -44,11 +44,12 @@ | ||
| 44 | 44 | |
| 45 | 45 | require_no_open_checkout; test_setup "" |
| 46 | 46 | |
| 47 | 47 | # Construct a test repository |
| 48 | 48 | # |
| 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 | |
| 50 | 51 | fossil rebuild m5.fossil |
| 51 | 52 | fossil open m5.fossil |
| 52 | 53 | fossil user default drh --user drh |
| 53 | 54 | fossil update baseline |
| 54 | 55 | checkout-test 10 { |
| @@ -136,11 +137,11 @@ | ||
| 136 | 137 | 64a8a5c7320fccfa4b2e5dfc5fd20a5381a86c5b three.txt |
| 137 | 138 | b262fee89ed8a27a23a5e09d3917e0bebe22cd24 two.txt |
| 138 | 139 | } |
| 139 | 140 | |
| 140 | 141 | # 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. | |
| 142 | 143 | # |
| 143 | 144 | fossil update m1 |
| 144 | 145 | fossil merge br2 |
| 145 | 146 | checkout-test 80 { |
| 146 | 147 | 8f09bc55a60eb8ca06f10a3b577aafa869b31695 five.txt |
| @@ -285,11 +286,11 @@ | ||
| 285 | 286 | 98e47f99bb9fed4fdcd407f553615ca7f15a38a2 three.txt |
| 286 | 287 | e58c5da3e6007d0e30600ea31611813093ad180f two-rename.txt |
| 287 | 288 | } |
| 288 | 289 | |
| 289 | 290 | # 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. | |
| 291 | 292 | # |
| 292 | 293 | fossil update br5 |
| 293 | 294 | checkout-test 140 { |
| 294 | 295 | e866bb885d5184cba497cfb6a4eb281688519521 one.txt |
| 295 | 296 | e09593950837f76e70ca2f8ff2272ae3df0ba017 three.txt |
| 296 | 297 |
| --- 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 @@ | ||
| 23 | 23 | #################################################################### |
| 24 | 24 | |
| 25 | 25 | test_setup |
| 26 | 26 | fossil ls |
| 27 | 27 | |
| 28 | -test merge_multi-0 {[normalize_result] eq {}} | |
| 28 | +test_eq merge_multi-0 [normalize_result] {} | |
| 29 | 29 | |
| 30 | 30 | commit_file f1 "f1 line" "base file" |
| 31 | 31 | fossil ls |
| 32 | 32 | |
| 33 | -test merge_multi-1 {[normalize_result] eq {f1}} | |
| 33 | +test_eq merge_multi-1 [normalize_result] {f1} | |
| 34 | 34 | |
| 35 | 35 | fossil update trunk |
| 36 | 36 | commit_file f2 "f2 line" "branch for file f2" -b branch_for_f2 |
| 37 | 37 | fossil ls |
| 38 | 38 | |
| 39 | -test merge_multi-2 {[normalize_result] eq {f1 | |
| 40 | -f2}} | |
| 39 | +test_eq merge_multi-2 [normalize_result] \ | |
| 40 | + {f1 | |
| 41 | +f2} | |
| 41 | 42 | |
| 42 | 43 | fossil update trunk |
| 43 | 44 | write_file f3 "f3 line" |
| 44 | 45 | write_file f4 "f4 line" |
| 45 | 46 | fossil add f3 |
| 46 | 47 | fossil add f4 |
| 47 | 48 | fossil commit -m "branch for files f3 and f4" -b branch_for_f3_f4 |
| 48 | 49 | fossil ls |
| 49 | 50 | |
| 50 | -test merge_multi-3 {[normalize_result] eq {f1 | |
| 51 | +test_eq merge_multi-3 [normalize_result] \ | |
| 52 | + {f1 | |
| 51 | 53 | f3 |
| 52 | -f4}} | |
| 54 | +f4} | |
| 53 | 55 | |
| 54 | 56 | fossil update trunk |
| 55 | 57 | fossil merge branch_for_f2 |
| 56 | 58 | fossil merge branch_for_f3_f4 |
| 57 | 59 | fossil commit -m "new trunk files f2, f3, and f4 via merge" |
| 58 | 60 | fossil ls |
| 59 | 61 | |
| 60 | -test merge_multi-4 {[normalize_result] eq {f1 | |
| 62 | +test_eq merge_multi-4 [normalize_result] \ | |
| 63 | + {f1 | |
| 61 | 64 | f2 |
| 62 | 65 | f3 |
| 63 | -f4}} | |
| 66 | +f4} | |
| 64 | 67 | |
| 65 | 68 | ############################################################################### |
| 66 | 69 | |
| 67 | 70 | test_cleanup |
| 68 | 71 |
| --- 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 |
+4
-3
| --- test/merge_renames.test | ||
| +++ test/merge_renames.test | ||
| @@ -148,13 +148,14 @@ | ||
| 148 | 148 | |
| 149 | 149 | fossil commit -m "trunk merged, should have 3 files" |
| 150 | 150 | |
| 151 | 151 | fossil ls |
| 152 | 152 | |
| 153 | -test merge_renames-5-2 {[normalize_result] eq {f1 | |
| 153 | +test_eq merge_renames-5-2 [normalize_result] \ | |
| 154 | + {f1 | |
| 154 | 155 | f2 |
| 155 | -f3}} | |
| 156 | +f3} | |
| 156 | 157 | |
| 157 | 158 | ##################################### |
| 158 | 159 | # Test 6 # |
| 159 | 160 | # Merging a branch multiple times # |
| 160 | 161 | ##################################### |
| @@ -303,11 +304,11 @@ | ||
| 303 | 304 | fossil merge -n b -expectError |
| 304 | 305 | test_status_list merge_renames-9-6 $RESULT " |
| 305 | 306 | $expectedMerge |
| 306 | 307 | REMINDER: this was a dry run - no files were actually changed. |
| 307 | 308 | " |
| 308 | -test merge_renames-9-7 {[fossil changes] eq ""} | |
| 309 | +test_eq merge_renames-9-7 [fossil changes] "" | |
| 309 | 310 | |
| 310 | 311 | ################################################################### |
| 311 | 312 | # Test 10 # |
| 312 | 313 | # Merge swapped filenames, backout the swap, then merge changes # |
| 313 | 314 | ################################################################### |
| 314 | 315 |
| --- 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 @@ | ||
| 68 | 68 | |
| 69 | 69 | fossil mv ../f1 . |
| 70 | 70 | test mv-soft-relative-1 {$RESULT eq "RENAME f1 subdir1/f1"} |
| 71 | 71 | |
| 72 | 72 | 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}" | |
| 76 | 75 | |
| 77 | 76 | cd $rootDir |
| 78 | 77 | |
| 79 | 78 | ################################### |
| 80 | 79 | # Test 2: Soft Move Relative File # |
| @@ -85,13 +84,12 @@ | ||
| 85 | 84 | |
| 86 | 85 | fossil mv ../f2 ./f2 |
| 87 | 86 | test mv-soft-relative-3 {$RESULT eq "RENAME f2 subdir2/f2"} |
| 88 | 87 | |
| 89 | 88 | 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}" | |
| 93 | 91 | |
| 94 | 92 | cd $rootDir |
| 95 | 93 | |
| 96 | 94 | ######################################## |
| 97 | 95 | # Test 3: Hard Move Relative Directory # |
| @@ -99,18 +97,16 @@ | ||
| 99 | 97 | |
| 100 | 98 | file mkdir [file join $rootDir subdir3] |
| 101 | 99 | cd [file join $rootDir subdir3] |
| 102 | 100 | |
| 103 | 101 | 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" | |
| 107 | 104 | |
| 108 | 105 | 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}" | |
| 112 | 108 | |
| 113 | 109 | cd $rootDir |
| 114 | 110 | |
| 115 | 111 | ################################### |
| 116 | 112 | # Test 4: Hard Move Relative File # |
| @@ -118,18 +114,16 @@ | ||
| 118 | 114 | |
| 119 | 115 | file mkdir [file join $rootDir subdir4] |
| 120 | 116 | cd [file join $rootDir subdir4] |
| 121 | 117 | |
| 122 | 118 | 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" | |
| 126 | 121 | |
| 127 | 122 | 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}" | |
| 131 | 125 | |
| 132 | 126 | cd $rootDir |
| 133 | 127 | |
| 134 | 128 | ######################################## |
| 135 | 129 | # Test 5: Soft Move Absolute Directory # |
| @@ -140,13 +134,12 @@ | ||
| 140 | 134 | |
| 141 | 135 | fossil mv [file join $rootDir f5] [file join $rootDir subdir5] |
| 142 | 136 | test mv-soft-absolute-1 {$RESULT eq "RENAME f5 subdir5/f5"} |
| 143 | 137 | |
| 144 | 138 | 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}" | |
| 148 | 141 | |
| 149 | 142 | cd $rootDir |
| 150 | 143 | |
| 151 | 144 | ################################### |
| 152 | 145 | # Test 6: Soft Move Absolute File # |
| @@ -157,13 +150,12 @@ | ||
| 157 | 150 | |
| 158 | 151 | fossil mv [file join $rootDir f6] [file join $rootDir subdir6 f6] |
| 159 | 152 | test mv-soft-absolute-3 {$RESULT eq "RENAME f6 subdir6/f6"} |
| 160 | 153 | |
| 161 | 154 | 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}" | |
| 165 | 157 | |
| 166 | 158 | cd $rootDir |
| 167 | 159 | |
| 168 | 160 | ######################################## |
| 169 | 161 | # Test 7: Hard Move Absolute Directory # |
| @@ -171,18 +163,16 @@ | ||
| 171 | 163 | |
| 172 | 164 | file mkdir [file join $rootDir subdir7] |
| 173 | 165 | cd [file join $rootDir subdir7] |
| 174 | 166 | |
| 175 | 167 | 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" | |
| 179 | 170 | |
| 180 | 171 | 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}" | |
| 184 | 174 | |
| 185 | 175 | cd $rootDir |
| 186 | 176 | |
| 187 | 177 | ################################### |
| 188 | 178 | # Test 8: Hard Move Absolute File # |
| @@ -190,18 +180,16 @@ | ||
| 190 | 180 | |
| 191 | 181 | file mkdir [file join $rootDir subdir8] |
| 192 | 182 | cd [file join $rootDir subdir8] |
| 193 | 183 | |
| 194 | 184 | 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" | |
| 198 | 187 | |
| 199 | 188 | 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}" | |
| 203 | 191 | |
| 204 | 192 | cd $rootDir |
| 205 | 193 | |
| 206 | 194 | ########################################## |
| 207 | 195 | # Test 9: Soft Remove Relative Directory # |
| @@ -215,13 +203,12 @@ | ||
| 215 | 203 | |
| 216 | 204 | fossil rm ../subdirB |
| 217 | 205 | test rm-soft-relative-2 {$RESULT eq "DELETED subdirB/f9"} |
| 218 | 206 | |
| 219 | 207 | 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" | |
| 223 | 210 | |
| 224 | 211 | fossil revert |
| 225 | 212 | test rm-soft-relative-4 { |
| 226 | 213 | [normalize_result] eq \ |
| 227 | 214 | "REVERT subdirB/f9\nREVERT subdirC/f10\nREVERT subdirC/f11${undoMsg}" |
| @@ -238,13 +225,11 @@ | ||
| 238 | 225 | |
| 239 | 226 | fossil rm ../f2 |
| 240 | 227 | test rm-soft-relative-5 {$RESULT eq "DELETED f2"} |
| 241 | 228 | |
| 242 | 229 | 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}" | |
| 246 | 231 | |
| 247 | 232 | cd $rootDir |
| 248 | 233 | |
| 249 | 234 | ########################################### |
| 250 | 235 | # Test 11: Hard Remove Relative Directory # |
| @@ -252,13 +237,11 @@ | ||
| 252 | 237 | |
| 253 | 238 | file mkdir [file join $rootDir subdir3] |
| 254 | 239 | cd [file join $rootDir subdir3] |
| 255 | 240 | |
| 256 | 241 | fossil rm --hard ../subdirA |
| 257 | -test rm-hard-relative-1 { | |
| 258 | - [normalize_result] eq "" | |
| 259 | -} | |
| 242 | +test_eq rm-hard-relative-1 [normalize_result] "" | |
| 260 | 243 | |
| 261 | 244 | fossil rm --hard ../subdirB |
| 262 | 245 | test rm-hard-relative-2 { |
| 263 | 246 | [normalize_result] eq \ |
| 264 | 247 | "DELETED subdirB/f9\nDELETED_FILE ${rootDir}/subdirB/f9" |
| @@ -285,18 +268,15 @@ | ||
| 285 | 268 | |
| 286 | 269 | file mkdir [file join $rootDir subdir4] |
| 287 | 270 | cd [file join $rootDir subdir4] |
| 288 | 271 | |
| 289 | 272 | 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" | |
| 293 | 275 | |
| 294 | 276 | 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}" | |
| 298 | 278 | |
| 299 | 279 | cd $rootDir |
| 300 | 280 | |
| 301 | 281 | ########################################### |
| 302 | 282 | # Test 13: Soft Remove Absolute Directory # |
| @@ -310,13 +290,12 @@ | ||
| 310 | 290 | |
| 311 | 291 | fossil rm [file join $rootDir subdirB] |
| 312 | 292 | test rm-soft-absolute-2 {$RESULT eq "DELETED subdirB/f9"} |
| 313 | 293 | |
| 314 | 294 | 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" | |
| 318 | 297 | |
| 319 | 298 | fossil revert |
| 320 | 299 | test rm-soft-absolute-4 { |
| 321 | 300 | [normalize_result] eq \ |
| 322 | 301 | "REVERT subdirB/f9\nREVERT subdirC/f10\nREVERT subdirC/f11${undoMsg}" |
| @@ -333,13 +312,11 @@ | ||
| 333 | 312 | |
| 334 | 313 | fossil rm [file join $rootDir f6] |
| 335 | 314 | test rm-soft-absolute-5 {$RESULT eq "DELETED f6"} |
| 336 | 315 | |
| 337 | 316 | 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}" | |
| 341 | 318 | |
| 342 | 319 | cd $rootDir |
| 343 | 320 | |
| 344 | 321 | ########################################### |
| 345 | 322 | # Test 15: Hard Remove Absolute Directory # |
| @@ -378,93 +355,93 @@ | ||
| 378 | 355 | |
| 379 | 356 | file mkdir [file join $rootDir subdir8] |
| 380 | 357 | cd [file join $rootDir subdir8] |
| 381 | 358 | |
| 382 | 359 | 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" | |
| 386 | 362 | |
| 387 | 363 | 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}" | |
| 391 | 365 | |
| 392 | 366 | cd $rootDir |
| 393 | 367 | |
| 394 | 368 | ####################################### |
| 395 | 369 | # Test 17: Move File to New Directory # |
| 396 | 370 | ####################################### |
| 397 | 371 | |
| 398 | 372 | 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" | |
| 402 | 375 | |
| 403 | 376 | 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" | |
| 405 | 378 | |
| 406 | 379 | 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}" | |
| 410 | 382 | |
| 411 | 383 | 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" | |
| 413 | 385 | |
| 414 | 386 | cd $rootDir |
| 415 | 387 | |
| 416 | 388 | ############################################ |
| 417 | 389 | # Test 18: Move Directory to New Directory # |
| 418 | 390 | ############################################ |
| 419 | 391 | |
| 420 | 392 | 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"] ""] | |
| 424 | 399 | |
| 425 | 400 | 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" | |
| 427 | 402 | 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" | |
| 429 | 404 | |
| 430 | 405 | 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}"] ""] | |
| 434 | 410 | |
| 435 | 411 | 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" | |
| 437 | 413 | 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" | |
| 439 | 415 | |
| 440 | 416 | cd $rootDir |
| 441 | 417 | |
| 442 | 418 | ############################################################################### |
| 443 | 419 | # Test 19: Follow-up Soft Rename of a Directory Already Renamed on Filesystem # |
| 444 | 420 | ############################################################################### |
| 445 | 421 | |
| 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] | |
| 447 | 424 | |
| 448 | 425 | 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" | |
| 452 | 428 | |
| 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" | |
| 455 | 433 | |
| 456 | 434 | 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}" | |
| 460 | 437 | |
| 461 | 438 | 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" | |
| 463 | 440 | |
| 464 | 441 | file delete -force [file join $rootDir subdirE/a_renamed] |
| 465 | 442 | |
| 466 | 443 | cd $rootDir |
| 467 | 444 | |
| 468 | 445 | ############################################################################### |
| 469 | 446 | |
| 470 | 447 | test_cleanup |
| 471 | 448 |
| --- 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 |
+10
-18
| --- test/reserved-names.test | ||
| +++ test/reserved-names.test | ||
| @@ -85,37 +85,29 @@ | ||
| 85 | 85 | set reserved_result [lindex $reserved_names_test 0] |
| 86 | 86 | set reserved_name [lindex $reserved_names_test 1] |
| 87 | 87 | |
| 88 | 88 | fossil test-is-reserved-name $reserved_name |
| 89 | 89 | |
| 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 | |
| 93 | 91 | |
| 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 | |
| 97 | 93 | |
| 98 | 94 | fossil test-is-reserved-name [string toupper $reserved_name] |
| 99 | 95 | |
| 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 | |
| 103 | 98 | |
| 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] | |
| 107 | 101 | |
| 108 | 102 | fossil test-is-reserved-name [string tolower $reserved_name] |
| 109 | 103 | |
| 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 | |
| 113 | 106 | |
| 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] | |
| 117 | 109 | } |
| 118 | 110 | |
| 119 | 111 | ############################################################################### |
| 120 | 112 | |
| 121 | 113 | test_cleanup |
| 122 | 114 |
| --- 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 |
+2
-6
| --- test/revert.test | ||
| +++ test/revert.test | ||
| @@ -67,19 +67,15 @@ | ||
| 67 | 67 | fossil add f1 f2 f3 |
| 68 | 68 | fossil commit -m "c1" |
| 69 | 69 | |
| 70 | 70 | # Make changes to be reverted |
| 71 | 71 | # |
| 72 | -# Add f0 | |
| 73 | 72 | write_file f0 "f0" |
| 74 | 73 | fossil add f0 |
| 75 | -# Remove f1 | |
| 76 | 74 | file delete f1 |
| 77 | 75 | fossil rm f1 |
| 78 | -# Edit f2 | |
| 79 | 76 | write_file f2 "f2.1" |
| 80 | -# Rename f3 to f3n | |
| 81 | 77 | file rename -force f3 f3n |
| 82 | 78 | fossil mv f3 f3n |
| 83 | 79 | |
| 84 | 80 | # Test 'fossil revert' with no arguments |
| 85 | 81 | # |
| @@ -238,11 +234,11 @@ | ||
| 238 | 234 | EDITED d/f2 |
| 239 | 235 | DELETED d/f3 |
| 240 | 236 | } -exists {d/f4} -notexists {d/f4new} |
| 241 | 237 | |
| 242 | 238 | ## Commit changes before testing reverting of directory rename, |
| 243 | -## otherwise there're could be sequencing issues | |
| 239 | +## otherwise there could be sequencing issues | |
| 244 | 240 | fossil redo |
| 245 | 241 | fossil commit -m "4-5:setup" |
| 246 | 242 | |
| 247 | 243 | fossil mv --soft d dnew |
| 248 | 244 | revert-test 4-5 {d/f1 d/f2 d/f3 d/f4} { |
| @@ -295,11 +291,11 @@ | ||
| 295 | 291 | } -addremove { |
| 296 | 292 | ADDED d/f1 |
| 297 | 293 | } -exists {f0 d/f1 d/f2 d/f3} |
| 298 | 294 | |
| 299 | 295 | ## Commit changes before testing the revert of directory rename, |
| 300 | -## otherwise there're could be sequencing issues | |
| 296 | +## otherwise there could be sequencing issues | |
| 301 | 297 | fossil commit -m "5-3:setup" |
| 302 | 298 | |
| 303 | 299 | fossil changes |
| 304 | 300 | |
| 305 | 301 | fossil mv --soft d dnew |
| 306 | 302 |
| --- 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 |
+3
-3
| --- test/rewrite-test-output.tcl | ||
| +++ test/rewrite-test-output.tcl | ||
| @@ -326,11 +326,11 @@ | ||
| 326 | 326 | {^Z [0-9a-f]{32}$} |
| 327 | 327 | {Z CHECKSUM} |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | # |
| 331 | -# Some pattersn are used in multiple groups | |
| 331 | +# Some patterns are used in multiple groups | |
| 332 | 332 | # |
| 333 | 333 | |
| 334 | 334 | set testnames {"th1" "th1-docs" "th1-hooks"} |
| 335 | 335 | set pat {^((?:ERROR \(1\): )?/[*]{5} Subprocess) \d+ (exit)} |
| 336 | 336 | set sub {\1 PID \2} |
| @@ -381,11 +381,11 @@ | ||
| 381 | 381 | set symlinks_lines [list] |
| 382 | 382 | set symlinks_failed 0 |
| 383 | 383 | set test_simplify_name_lines [list] |
| 384 | 384 | set test_simplify_name_failed 0 |
| 385 | 385 | |
| 386 | -# State information s we progress | |
| 386 | +# State information as we progress | |
| 387 | 387 | set check_json_empty_line 0 |
| 388 | 388 | set lineno 0 |
| 389 | 389 | set platform $UNKOWN_PLATFORM |
| 390 | 390 | set prev_line "" |
| 391 | 391 | set testname "" |
| @@ -511,11 +511,11 @@ | ||
| 511 | 511 | if { [regexp {^(micro-smile|pale facepalm) .*} $line match desc] } { |
| 512 | 512 | set line "$desc PLATFORM_SPECIFIC_BYTES" |
| 513 | 513 | } |
| 514 | 514 | } elseif { $testname eq "file1" } { |
| 515 | 515 | # 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 . ." | |
| 517 | 517 | if { $line eq "fossil test-relative-name --chdir . ." } { |
| 518 | 518 | if { $test_simplify_name_failed } { |
| 519 | 519 | foreach l $test_simplify_name_lines { |
| 520 | 520 | puts "$l" |
| 521 | 521 | } |
| 522 | 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 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 |
+14
-17
| --- test/set-manifest.test | ||
| +++ test/set-manifest.test | ||
| @@ -46,11 +46,12 @@ | ||
| 46 | 46 | set truths [list true on 1] |
| 47 | 47 | foreach v $truths { |
| 48 | 48 | fossil settings manifest $v |
| 49 | 49 | test "set-manifest-2-$v" {$RESULT eq ""} |
| 50 | 50 | 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]} | |
| 52 | 53 | set filelist [lsort [glob manifest*]] |
| 53 | 54 | test "set-manifest-2-$v-n" {[llength $filelist] == 2} |
| 54 | 55 | foreach f $filelist { |
| 55 | 56 | test "set-manifest-2-$v-f-$f" {[file isfile $f]} |
| 56 | 57 | } |
| @@ -61,28 +62,19 @@ | ||
| 61 | 62 | regexp {(?m)^checkout:\s+([0-9a-f]{40,64})\s.*$} $RESULT ckoutline ckid |
| 62 | 63 | set uuid [string trim [read_file "manifest.uuid"]] |
| 63 | 64 | test "set-manifest-2-uuid" {[same_uuid $ckid $uuid]} |
| 64 | 65 | |
| 65 | 66 | |
| 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 | 67 | |
| 77 | 68 | # Classic behavior: FALSE value removes manifest and manifest.uuid |
| 78 | 69 | set falses [list false off 0] |
| 79 | 70 | foreach v $falses { |
| 80 | 71 | fossil settings manifest $v |
| 81 | 72 | test "set-manifest-3-$v" {$RESULT eq ""} |
| 82 | 73 | 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]} | |
| 84 | 76 | set filelist [lsort [glob -nocomplain manifest*]] |
| 85 | 77 | test "set-manifest-3-$v-n" {[llength $filelist] == 0} |
| 86 | 78 | } |
| 87 | 79 | |
| 88 | 80 | |
| @@ -102,11 +94,12 @@ | ||
| 102 | 94 | set truths [list r u t ru ut rt rut] |
| 103 | 95 | foreach v $truths { |
| 104 | 96 | fossil settings manifest $v |
| 105 | 97 | test "set-manifest-5-$v" {$RESULT eq ""} |
| 106 | 98 | 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]} | |
| 108 | 101 | set filelist [lsort [glob manifest*]] |
| 109 | 102 | test "set-manifest-5-$v-n" {[llength $filelist] == [string length $v]} |
| 110 | 103 | foreach f $filelist { |
| 111 | 104 | test "set-manifest-5-$v-f-$f" {[file isfile $f]} |
| 112 | 105 | } |
| @@ -122,25 +115,29 @@ | ||
| 122 | 115 | fossil set manifest t |
| 123 | 116 | test "set-manifest-7-1" {[file isfile manifest.tags]} |
| 124 | 117 | |
| 125 | 118 | # Add a tag and make sure it appears in manifest.tags |
| 126 | 119 | 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$"]} | |
| 128 | 122 | |
| 129 | 123 | # Add a file and make sure tag has disappeared from manifest.tags |
| 130 | 124 | 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$"]} | |
| 132 | 127 | |
| 133 | 128 | # Add new tag and check that it is in manifest.tags |
| 134 | 129 | 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$"]} | |
| 136 | 132 | |
| 137 | 133 | |
| 138 | 134 | ##### Tags manifest branch= updates |
| 139 | 135 | |
| 140 | 136 | # Add file, create new branch on commit and check that |
| 141 | 137 | # manifest.tags has been updated appropriately |
| 142 | 138 | 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$"]} | |
| 144 | 141 | |
| 145 | 142 | |
| 146 | 143 | test_cleanup |
| 147 | 144 |
| --- 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 @@ | ||
| 61 | 61 | test $testid-CODE {!$code} [knownBug "-code" $knownbugs] |
| 62 | 62 | if {$code} { |
| 63 | 63 | return |
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | - test_status_list $testid $result $expectedOutput [knownBug "-result" $knownbugs] | |
| 66 | + test_status_list $testid $result $expectedOutput \ | |
| 67 | + [knownBug "-result" $knownbugs] | |
| 67 | 68 | |
| 68 | 69 | set statusListTests [list -changes changes -addremove {addremove -n}] |
| 69 | 70 | foreach {key fossilArgs} $statusListTests { |
| 70 | 71 | set expected [dict get $args $key] |
| 71 | 72 | set result [fossil {*}$fossilArgs] |
| @@ -81,17 +82,16 @@ | ||
| 81 | 82 | protOut " Failure: File $verb not exist: $path" |
| 82 | 83 | } |
| 83 | 84 | } |
| 84 | 85 | test $testid$key $passed [knownBug $key $knownbugs] |
| 85 | 86 | } |
| 86 | - | |
| 87 | - #fossil undo | |
| 88 | 87 | } |
| 89 | 88 | |
| 90 | 89 | proc stash-test {testid stashArgs expectedStashOutput args} { |
| 91 | 90 | 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] | |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | require_no_open_checkout |
| 96 | 96 | test_setup |
| 97 | 97 | |
| @@ -131,13 +131,10 @@ | ||
| 131 | 131 | ######## |
| 132 | 132 | # fossil stash list|ls ?-v|--verbose? ?-W|--width <num>? |
| 133 | 133 | |
| 134 | 134 | # Confirm there is a stash saved |
| 135 | 135 | fossil stash list |
| 136 | -#protOut "{[normalize_result]}" | |
| 137 | -#{1: [21bc64cff8c702] on 2016-02-10 19:48:44 | |
| 138 | -# stash 1} | |
| 139 | 136 | test stash-1-list-1 {[regexp {^1: \[[0-9a-z]+\] on } [first_data_line]]} |
| 140 | 137 | test stash-1-list-2 {[regexp {^\s+stash 1\s*$} [second_data_line]]} |
| 141 | 138 | |
| 142 | 139 | set diff_stash_1 {DELETE f1 |
| 143 | 140 | Index: f1 |
| @@ -168,15 +165,10 @@ | ||
| 168 | 165 | |
| 169 | 166 | ######## |
| 170 | 167 | # fossil stash show|cat ?STASHID? ?DIFF-OPTIONS? |
| 171 | 168 | # fossil stash [g]diff ?STASHID? ?DIFF-OPTIONS? |
| 172 | 169 | |
| 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 | 170 | ######## |
| 179 | 171 | # fossil stash pop |
| 180 | 172 | |
| 181 | 173 | stash-test 2 pop { |
| 182 | 174 | DELETE f1 |
| @@ -192,11 +184,11 @@ | ||
| 192 | 184 | DELETED f1 |
| 193 | 185 | } -exists {f0 f2 f3n} -notexists {f1 f3} |
| 194 | 186 | |
| 195 | 187 | # Confirm there is no longer a stash saved |
| 196 | 188 | 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" | |
| 198 | 190 | |
| 199 | 191 | |
| 200 | 192 | # Test stashed mv without touching the file system |
| 201 | 193 | # Issue reported by email to fossil-users |
| 202 | 194 | # from Warren Young, dated Tue, 9 Feb 2016 01:22:54 -0700 |
| @@ -206,16 +198,10 @@ | ||
| 206 | 198 | # fossil: ./src/delta.c:231: checksum: Assertion '...' failed. |
| 207 | 199 | # Should be triggered by this stash-WY-1 test. |
| 208 | 200 | fossil checkout --force c1 |
| 209 | 201 | fossil clean |
| 210 | 202 | 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 | 203 | # TODO: add tests that verify the saved stash is sensible. Possibly |
| 218 | 204 | # by applying it and checking results. But until the SQLITE_CONSTRAINT |
| 219 | 205 | # error is fixed, there is nothing stashed to test. |
| 220 | 206 | |
| 221 | 207 | |
| @@ -257,19 +243,19 @@ | ||
| 257 | 243 | stash-test 3-1 {save -m f3} { |
| 258 | 244 | UNMANAGE f3 |
| 259 | 245 | } -addremove { |
| 260 | 246 | ADDED f3 |
| 261 | 247 | } -exists {f1 f2 f3} -notexists {} |
| 262 | -#fossil status | |
| 263 | 248 | 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 | |
| 265 | 251 | Index: f3 |
| 266 | 252 | ================================================================== |
| 267 | 253 | --- /dev/null\t |
| 268 | 254 | +++ f3\t |
| 269 | 255 | @@ -0,0 +1,1 @@ |
| 270 | -+f3"} | |
| 256 | ++f3" | |
| 271 | 257 | stash-test 3-1-pop {pop} { |
| 272 | 258 | ADDED f3 |
| 273 | 259 | } -changes { |
| 274 | 260 | ADDED f3 |
| 275 | 261 | } -addremove { |
| @@ -381,11 +367,8 @@ | ||
| 381 | 367 | |
| 382 | 368 | # fossil stash apply ?STASHID? |
| 383 | 369 | # fossil stash goto ?STASHID? |
| 384 | 370 | # fossil stash rm|drop ?STASHID? ?-a|--all? |
| 385 | 371 | |
| 386 | -#fossil checkout --force c1 | |
| 387 | -#fossil clean | |
| 388 | - | |
| 389 | 372 | ############################################################################### |
| 390 | 373 | |
| 391 | 374 | test_cleanup |
| 392 | 375 |
| --- 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 @@ | ||
| 51 | 51 | ############################################################################### |
| 52 | 52 | |
| 53 | 53 | write_file [file join $rootDir subdirA f1.txt] "f1" |
| 54 | 54 | write_file [file join $rootDir subdirA f2.txt] "f2" |
| 55 | 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} | |
| 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 | 60 | |
| 61 | 61 | fossil add [file join $rootDir symdirA f1.txt] |
| 62 | 62 | test symlinks-skip-dir-traversal {[normalize_result] eq \ |
| 63 | 63 | "SKIP symdirA/f1.txt"} |
| 64 | 64 | |
| @@ -68,11 +68,11 @@ | ||
| 68 | 68 | "nothing has changed; use --allow-empty to override"} |
| 69 | 69 | |
| 70 | 70 | ############################################################################### |
| 71 | 71 | |
| 72 | 72 | fossil ls |
| 73 | -test symlinks-dir-5 {[normalize_result] eq ""} | |
| 73 | +test_eq symlinks-dir-5 [normalize_result] "" | |
| 74 | 74 | |
| 75 | 75 | ############################################################################### |
| 76 | 76 | |
| 77 | 77 | fossil extras |
| 78 | 78 | test symlinks-dir-6 {[normalize_result] eq \ |
| @@ -81,30 +81,30 @@ | ||
| 81 | 81 | ############################################################################### |
| 82 | 82 | |
| 83 | 83 | fossil close |
| 84 | 84 | file delete [file join $rootDir subdirA f1.txt] |
| 85 | 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} | |
| 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 | 90 | |
| 91 | 91 | ############################################################################### |
| 92 | 92 | |
| 93 | 93 | fossil open --force $repository |
| 94 | 94 | set code [catch {file readlink [file join $rootDir symdirA]} result] |
| 95 | 95 | |
| 96 | 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} | |
| 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 | 102 | |
| 103 | 103 | ############################################################################### |
| 104 | 104 | # |
| 105 | 105 | # TODO: Add tests for symbolic links as files here, including tests with the |
| 106 | 106 | # "allow-symlinks" setting on and off. |
| 107 | 107 | # |
| 108 | 108 | ############################################################################### |
| 109 | 109 | |
| 110 | 110 | test_cleanup |
| 111 | 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 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 @@ | ||
| 157 | 157 | |
| 158 | 158 | # write a dict with enough formatting |
| 159 | 159 | # to make it human readable |
| 160 | 160 | # |
| 161 | 161 | 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}]] | |
| 163 | 164 | dict for {key value} $dict { |
| 164 | 165 | protOut [format "%-${longest}s = %s" $key $value] |
| 165 | 166 | } |
| 166 | 167 | } |
| 167 | 168 | |
| @@ -344,10 +345,55 @@ | ||
| 344 | 345 | return 0 |
| 345 | 346 | } |
| 346 | 347 | } |
| 347 | 348 | return 1 |
| 348 | 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 | +} | |
| 349 | 395 | |
| 350 | 396 | proc test_standin {name destination} { |
| 351 | 397 | file copy -force [file join $::testfiledir standin $name] $destination |
| 352 | 398 | file attributes $destination -permissions 0755 |
| 353 | 399 | return $destination |
| @@ -627,11 +673,12 @@ | ||
| 627 | 673 | # Deletes the temporary repositories that test_setup made for the test |
| 628 | 674 | # file SCRIPTNAME, by default the file being sourced. |
| 629 | 675 | proc test_cleanup {{scriptName ""}} { |
| 630 | 676 | if {$::KEEP} { |
| 631 | 677 | # 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} | |
| 633 | 680 | return |
| 634 | 681 | } |
| 635 | 682 | if {![info exists ::tempRepoPath]} {return} |
| 636 | 683 | if {![file exists $::tempRepoPath]} {return} |
| 637 | 684 | if {![file isdirectory $::tempRepoPath]} {return} |
| @@ -1025,10 +1072,22 @@ | ||
| 1025 | 1072 | } |
| 1026 | 1073 | |
| 1027 | 1074 | # Test NAME passes if ACTUAL matches the regular expression PATTERN. A |
| 1028 | 1075 | # failure is reported with the pattern and the actual value. |
| 1029 | 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 | + | |
| 1030 | 1089 | proc test_match {name actual pattern {constraints ""}} { |
| 1031 | 1090 | set detail [concat [list "pattern: $pattern"] \ |
| 1032 | 1091 | [test_value_lines "actual: " $actual]] |
| 1033 | 1092 | test_report $name [regexp -- $pattern $actual] $constraints $detail |
| 1034 | 1093 | } |
| @@ -1180,12 +1239,12 @@ | ||
| 1180 | 1239 | # requests on TCP port localhost:8081, IPv4 and IPv6". The port is |
| 1181 | 1240 | # followed by a comma or the end of the line. |
| 1182 | 1241 | set listening {Listening for [^\n]+ requests on } |
| 1183 | 1242 | append listening {(?:TCP port )?(?:\S*:)?(\d+)[,\r\n]} |
| 1184 | 1243 | 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 | |
| 1187 | 1246 | set output [read_file $outFileName] |
| 1188 | 1247 | regexp $listening $output -> port |
| 1189 | 1248 | } |
| 1190 | 1249 | if {$port eq ""} { |
| 1191 | 1250 | test_stop_server $stopArg $pid $outFileName |
| @@ -1224,11 +1283,11 @@ | ||
| 1224 | 1283 | if {[catch { |
| 1225 | 1284 | exec ps -p $pid |
| 1226 | 1285 | } result] != 0 || ![regexp -- "(?:^$pid| $pid) " $result]} { |
| 1227 | 1286 | break |
| 1228 | 1287 | } |
| 1229 | - after 1000; # wait a bit... | |
| 1288 | + after 10; # wait a bit... | |
| 1230 | 1289 | } |
| 1231 | 1290 | if {[string length $fileName] > 0} { |
| 1232 | 1291 | file delete $fileName |
| 1233 | 1292 | } |
| 1234 | 1293 | return true |
| 1235 | 1294 |
| --- 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 |
+2
-1
| --- test/th1-docs.test | ||
| +++ test/th1-docs.test | ||
| @@ -61,11 +61,12 @@ | ||
| 61 | 61 | ############################################################################### |
| 62 | 62 | |
| 63 | 63 | set RESULT [test_fossil_http \ |
| 64 | 64 | $repository $dataFileName /doc/trunk/fileStat.th1] |
| 65 | 65 | |
| 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]} | |
| 67 | 68 | test th1-docs-1b {[regexp {>\[[0-9a-f]{40,64}\]<} $RESULT]} |
| 68 | 69 | test th1-docs-1c {[regexp { contains \d+ files\.} $RESULT]} |
| 69 | 70 | |
| 70 | 71 | ############################################################################### |
| 71 | 72 | |
| 72 | 73 |
| --- 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 |
+4
-4
| --- test/th1-hooks.test | ||
| +++ test/th1-hooks.test | ||
| @@ -156,11 +156,11 @@ | ||
| 156 | 156 | |
| 157 | 157 | fossil timeline |
| 158 | 158 | test th1-cmd-hooks-2a {[first_data_line] eq \ |
| 159 | 159 | {<h1><b>command_hook timeline</b></h1>}} |
| 160 | 160 | |
| 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} | |
| 162 | 162 | |
| 163 | 163 | ############################################################################### |
| 164 | 164 | |
| 165 | 165 | fossil timeline -n -1 now |
| 166 | 166 | test th1-cmd-hooks-3a {[first_data_line] eq \ |
| @@ -176,19 +176,19 @@ | ||
| 176 | 176 | {<h1><b>command_hook timeline command_notify timeline</b></h1>}} |
| 177 | 177 | |
| 178 | 178 | ############################################################################### |
| 179 | 179 | |
| 180 | 180 | 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 | |
| 182 | 182 | |
| 183 | 183 | test th1-custom-cmd-1b {[last_data_line] eq \ |
| 184 | 184 | {<h1><b>command_hook test1 command_notify test1</b></h1>}} |
| 185 | 185 | |
| 186 | 186 | ############################################################################### |
| 187 | 187 | |
| 188 | 188 | 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} | |
| 190 | 190 | |
| 191 | 191 | ############################################################################### |
| 192 | 192 | |
| 193 | 193 | fossil test3 |
| 194 | 194 | test th1-custom-cmd-3a {[string trim $RESULT] eq \ |
| @@ -219,11 +219,11 @@ | ||
| 219 | 219 | {webpage_notify timeline</b></h1>}] $RESULT]} |
| 220 | 220 | |
| 221 | 221 | ############################################################################### |
| 222 | 222 | |
| 223 | 223 | 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 | |
| 225 | 225 | |
| 226 | 226 | test th1-custom-web-1b {[last_data_line] eq \ |
| 227 | 227 | {<h1><b>command_hook http webpage_hook test1 webpage_notify test1</b></h1>}} |
| 228 | 228 | |
| 229 | 229 | ############################################################################### |
| 230 | 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 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 |
+5
-5
| --- test/th1-repo.test | ||
| +++ test/th1-repo.test | ||
| @@ -56,11 +56,11 @@ | ||
| 56 | 56 | fossil commit -m "c1" |
| 57 | 57 | |
| 58 | 58 | ############################################################################### |
| 59 | 59 | |
| 60 | 60 | 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] | |
| 62 | 62 | |
| 63 | 63 | set n 1 |
| 64 | 64 | foreach i $RESULT j $files_md { |
| 65 | 65 | test th1-dir-2.$n {$i eq $j} |
| 66 | 66 | set n [expr {$n + 1}] |
| @@ -68,21 +68,21 @@ | ||
| 68 | 68 | |
| 69 | 69 | ############################################################################### |
| 70 | 70 | |
| 71 | 71 | set dateTime {\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}} |
| 72 | 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"} | |
| 73 | +test_eq th1-dir-3.1 [lindex [lindex $RESULT 0] 0] "subdirB/f5.md" | |
| 74 | 74 | test th1-dir-3.2 {[lindex [lindex $RESULT 0] 1] == 2} |
| 75 | 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"} | |
| 76 | +test_eq th1-dir-3.4 [lindex [lindex $RESULT 1] 0] "subdirB/f6.md" | |
| 77 | 77 | test th1-dir-3.5 {[lindex [lindex $RESULT 1] 1] == 2} |
| 78 | 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"} | |
| 79 | +test_eq th1-dir-3.7 [lindex [lindex $RESULT 2] 0] "subdirB/f8.md" | |
| 80 | 80 | test th1-dir-3.8 {[lindex [lindex $RESULT 2] 1] == 2} |
| 81 | 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"} | |
| 82 | +test_eq th1-dir-3.10 [lindex [lindex $RESULT 3] 0] "subdirC/f10.md" | |
| 83 | 83 | test th1-dir-3.11 {[lindex [lindex $RESULT 3] 1] == 3} |
| 84 | 84 | test th1-dir-3.12 {[regexp -- $dateTime [lindex [lindex $RESULT 3] 2]]} |
| 85 | 85 | |
| 86 | 86 | ############################################################################### |
| 87 | 87 | |
| 88 | 88 | test_cleanup |
| 89 | 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 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 |
+9
-8
| --- test/th1-tcl.test | ||
| +++ test/th1-tcl.test | ||
| @@ -135,13 +135,14 @@ | ||
| 135 | 135 | set fossilexeref [string range $fossilexe 0 end-4] |
| 136 | 136 | } else { |
| 137 | 137 | set fossilexeref $fossilexe |
| 138 | 138 | } |
| 139 | 139 | |
| 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 \ | |
| 141 | 142 | [list test-th-render --open-config [file nativename [file join $path \ |
| 142 | -th1-tcl9.txt]]]]} | |
| 143 | +th1-tcl9.txt]]]] | |
| 143 | 144 | |
| 144 | 145 | ############################################################################### |
| 145 | 146 | |
| 146 | 147 | fossil test-th-eval "tclMakeSafe a" |
| 147 | 148 | test th1-tcl-10 {[normalize_result] eq \ |
| @@ -148,11 +149,11 @@ | ||
| 148 | 149 | {TH_ERROR: wrong # args: should be "tclMakeSafe"}} |
| 149 | 150 | |
| 150 | 151 | ############################################################################### |
| 151 | 152 | |
| 152 | 153 | 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} | |
| 154 | 155 | |
| 155 | 156 | ############################################################################### |
| 156 | 157 | |
| 157 | 158 | fossil test-th-eval "tclMakeSafe; tclMakeSafe" |
| 158 | 159 | test th1-tcl-12 {[normalize_result] eq \ |
| @@ -159,30 +160,30 @@ | ||
| 159 | 160 | {TH_ERROR: Tcl interpreter is already 'safe'}} |
| 160 | 161 | |
| 161 | 162 | ############################################################################### |
| 162 | 163 | |
| 163 | 164 | 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"} | |
| 165 | 166 | |
| 166 | 167 | ############################################################################### |
| 167 | 168 | |
| 168 | 169 | 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"} | |
| 170 | 171 | |
| 171 | 172 | ############################################################################### |
| 172 | 173 | |
| 173 | 174 | 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} | |
| 175 | 176 | |
| 176 | 177 | ############################################################################### |
| 177 | 178 | |
| 178 | 179 | 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} | |
| 180 | 181 | |
| 181 | 182 | ############################################################################### |
| 182 | 183 | |
| 183 | 184 | 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} | |
| 185 | 186 | |
| 186 | 187 | ############################################################################### |
| 187 | 188 | |
| 188 | 189 | test_cleanup |
| 189 | 190 |
| --- 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 @@ | ||
| 564 | 564 | fossil test-th-eval "setParameter test3 value3; getParameter test3 defValue3" |
| 565 | 565 | test th1-set-parameter-5 {$RESULT eq {value3}} |
| 566 | 566 | |
| 567 | 567 | ############################################################################### |
| 568 | 568 | |
| 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" | |
| 570 | 571 | test th1-set-parameter-6 {$RESULT eq {value5}} |
| 571 | 572 | |
| 572 | 573 | ############################################################################### |
| 573 | 574 | |
| 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"] ""] | |
| 575 | 579 | test th1-set-parameter-7 {$RESULT eq {value5}} |
| 576 | 580 | |
| 577 | 581 | ############################################################################### |
| 578 | 582 | |
| 579 | 583 | fossil test-th-eval "artifact" |
| @@ -636,11 +640,11 @@ | ||
| 636 | 640 | ############################################################################### |
| 637 | 641 | |
| 638 | 642 | test_block_in_checkout th1-globalState-2 { |
| 639 | 643 | if {$th1Hooks} { |
| 640 | 644 | 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] | |
| 642 | 646 | } else { |
| 643 | 647 | # NOTE: No TH1 hooks, force checkout to be populated. |
| 644 | 648 | fossil test-th-eval --open-config "globalState checkout" |
| 645 | 649 | |
| 646 | 650 | test th1-globalState-2 {$RESULT eq \ |
| @@ -659,11 +663,11 @@ | ||
| 659 | 663 | test th1-globalState-4 {[string length $RESULT] > 0} |
| 660 | 664 | |
| 661 | 665 | ############################################################################### |
| 662 | 666 | |
| 663 | 667 | 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" | |
| 665 | 669 | |
| 666 | 670 | ############################################################################### |
| 667 | 671 | |
| 668 | 672 | fossil test-th-eval "globalState log" |
| 669 | 673 | test th1-globalState-6 {[string length $RESULT] == 0} |
| @@ -687,11 +691,11 @@ | ||
| 687 | 691 | ############################################################################### |
| 688 | 692 | |
| 689 | 693 | test_block_in_checkout th1-globalState-9 { |
| 690 | 694 | if {$th1Hooks} { |
| 691 | 695 | 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] | |
| 693 | 697 | } else { |
| 694 | 698 | # NOTE: No TH1 hooks, force repository to be populated. |
| 695 | 699 | fossil test-th-eval --open-config "globalState repository" |
| 696 | 700 | |
| 697 | 701 | test th1-globalState-9 {$RESULT eq \ |
| @@ -772,11 +776,12 @@ | ||
| 772 | 776 | # repository return searchable set setParameter setting stime string \ |
| 773 | 777 | # styleFooter styleHeader styleScript submenu tclReady trace unset \ |
| 774 | 778 | # unversioned uplevel upvar utime verifyCsrf verifyLogin wiki} |
| 775 | 779 | #set tcl_commands {tclEval tclExpr tclInvoke tclIsSafe tclMakeSafe} |
| 776 | 780 | #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"]} | |
| 778 | 783 | #} else { |
| 779 | 784 | # test th1-info-commands-1 {$sorted_result eq [lsort "$base_commands"]} |
| 780 | 785 | #} |
| 781 | 786 | |
| 782 | 787 | ############################################################################### |
| @@ -796,11 +801,11 @@ | ||
| 796 | 801 | |
| 797 | 802 | if {$th1Hooks} { |
| 798 | 803 | test th1-info-vars-2 {[lsort $RESULT] eq \ |
| 799 | 804 | [lsort "x th_stack_trace cmd_flags tcl_platform cmd_name cmd_args"]} |
| 800 | 805 | } 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"] | |
| 802 | 807 | } |
| 803 | 808 | |
| 804 | 809 | ############################################################################### |
| 805 | 810 | |
| 806 | 811 | fossil test-th-eval "set x 1; unset x; info vars" |
| @@ -823,11 +828,11 @@ | ||
| 823 | 828 | |
| 824 | 829 | if {$th1Hooks} { |
| 825 | 830 | test th1-info-vars-5 {[lsort $RESULT] eq \ |
| 826 | 831 | [lsort "th_stack_trace y cmd_flags tcl_platform cmd_name cmd_args"]} |
| 827 | 832 | } 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"] | |
| 829 | 834 | } |
| 830 | 835 | |
| 831 | 836 | ############################################################################### |
| 832 | 837 | |
| 833 | 838 | fossil test-th-eval "array exists foo" |
| @@ -1002,26 +1007,28 @@ | ||
| 1002 | 1007 | {TH_ERROR: wrong # args: should be "markdown STRING"}} |
| 1003 | 1008 | |
| 1004 | 1009 | ############################################################################### |
| 1005 | 1010 | |
| 1006 | 1011 | 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"> | |
| 1008 | 1014 | |
| 1009 | 1015 | <p><em>This is a test.</em></p> |
| 1010 | 1016 | |
| 1011 | 1017 | </div> |
| 1012 | -}}} | |
| 1018 | +}} | |
| 1013 | 1019 | |
| 1014 | 1020 | ############################################################################### |
| 1015 | 1021 | |
| 1016 | 1022 | 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"> | |
| 1018 | 1025 | |
| 1019 | 1026 | <p><em>This is a test.</em></p> |
| 1020 | 1027 | |
| 1021 | 1028 | </div> |
| 1022 | -}}} | |
| 1029 | +}} | |
| 1023 | 1030 | |
| 1024 | 1031 | ############################################################################### |
| 1025 | 1032 | |
| 1026 | 1033 | set markdown [read_file [file join $path markdown-test1.md]] |
| 1027 | 1034 | fossil test-th-eval [string map \ |
| @@ -1060,17 +1067,18 @@ | ||
| 1060 | 1067 | ############################################################################### |
| 1061 | 1068 | |
| 1062 | 1069 | # Verify that quoted delimiters like * and _ don't terminate their |
| 1063 | 1070 | # span. This was fixed by checkin [dd41f85acf]. |
| 1064 | 1071 | 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"> | |
| 1066 | 1074 | |
| 1067 | 1075 | <p><em>This is*a test.</em> |
| 1068 | 1076 | <em>second_test</em></p> |
| 1069 | 1077 | |
| 1070 | 1078 | </div> |
| 1071 | -}}} | |
| 1079 | +}} | |
| 1072 | 1080 | |
| 1073 | 1081 | ############################################################################### |
| 1074 | 1082 | |
| 1075 | 1083 | th1_cases { |
| 1076 | 1084 | th1-encode64-1 {encode64 test} dGVzdA== |
| @@ -1124,11 +1132,11 @@ | ||
| 1124 | 1132 | fossil unversioned add ten.txt |
| 1125 | 1133 | fossil unversioned list |
| 1126 | 1134 | |
| 1127 | 1135 | # unversioned list |
| 1128 | 1136 | 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} | |
| 1130 | 1138 | |
| 1131 | 1139 | # unversioned content |
| 1132 | 1140 | fossil test-th-eval --open-config \ |
| 1133 | 1141 | {string length [unversioned content ten.txt]} |
| 1134 | 1142 | test th1-unversioned-2 {$RESULT eq {10}} |
| 1135 | 1143 |
| --- 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 |
+15
-25
| --- test/unicode-pathnames.test | ||
| +++ test/unicode-pathnames.test | ||
| @@ -116,21 +116,10 @@ | ||
| 116 | 116 | proc up_argv_maps {a b} { |
| 117 | 117 | fossil test-echo $b |
| 118 | 118 | return [expr {[string first "argv\[2\] = \[$a\]" $::RESULT] >= 0}] |
| 119 | 119 | } |
| 120 | 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 | 121 | |
| 133 | 122 | # Each row is a label, the pathname that is checked in, and another |
| 134 | 123 | # spelling that is a D145 caseless match (or treated as one file in |
| 135 | 124 | # the header for compatibility pairs). |
| 136 | 125 | # |
| @@ -276,14 +265,14 @@ | ||
| 276 | 265 | # |
| 277 | 266 | foreach {label a b} $upSame { |
| 278 | 267 | up_show $label $a $b |
| 279 | 268 | set converted [expr {$label in $upConverted}] |
| 280 | 269 | fossil ls $b |
| 281 | - up_expect unicode-pathnames-on-$label-ls [normalize_result] \ | |
| 270 | + test_predict up unicode-pathnames-on-$label-ls [normalize_result] \ | |
| 282 | 271 | [expr {$converted ? $a : ""}] |
| 283 | 272 | 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}] | |
| 285 | 274 | } |
| 286 | 275 | |
| 287 | 276 | # With the setting off, D145 matches must be found by the other |
| 288 | 277 | # spelling; upDifferent pairs must not. |
| 289 | 278 | # |
| @@ -290,26 +279,27 @@ | ||
| 290 | 279 | fossil settings case-sensitive 0 |
| 291 | 280 | |
| 292 | 281 | foreach {label a b} $upSame { |
| 293 | 282 | up_show $label $a $b |
| 294 | 283 | 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 | |
| 296 | 285 | 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 | |
| 299 | 288 | 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" | |
| 301 | 291 | } |
| 302 | 292 | |
| 303 | 293 | foreach {label a b} $upDifferent { |
| 304 | 294 | up_show $label $a $b |
| 305 | 295 | fossil ls $b |
| 306 | - up_expect unicode-pathnames-off-$label-ls [normalize_result] "" | |
| 296 | + test_predict up unicode-pathnames-off-$label-ls [normalize_result] "" | |
| 307 | 297 | 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 | |
| 309 | 299 | 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] "" | |
| 311 | 301 | } |
| 312 | 302 | |
| 313 | 303 | # A file on disk under the other spelling is not an extra file, and |
| 314 | 304 | # "fossil add" does not add it. Needs a volume that stores two names. |
| 315 | 305 | # |
| @@ -326,14 +316,14 @@ | ||
| 326 | 316 | continue |
| 327 | 317 | } |
| 328 | 318 | file mkdir [file dirname $b] |
| 329 | 319 | write_file $b "other spelling\n" |
| 330 | 320 | fossil extras |
| 331 | - up_expect unicode-pathnames-off-$label-extras [normalize_result] "" | |
| 321 | + test_predict up unicode-pathnames-off-$label-extras [normalize_result] "" | |
| 332 | 322 | fossil add $b |
| 333 | 323 | fossil changes |
| 334 | - up_expect unicode-pathnames-off-$label-add [normalize_result] "" | |
| 324 | + test_predict up unicode-pathnames-off-$label-add [normalize_result] "" | |
| 335 | 325 | fossil revert |
| 336 | 326 | file delete $b |
| 337 | 327 | if {[file dirname $b] ne "."} { |
| 338 | 328 | catch {file delete [file dirname $b]} |
| 339 | 329 | } |
| @@ -375,19 +365,19 @@ | ||
| 375 | 365 | set upBoth [up_new_version] |
| 376 | 366 | |
| 377 | 367 | fossil settings case-sensitive 0 |
| 378 | 368 | write_file plain.txt "edited\n" |
| 379 | 369 | 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 | |
| 381 | 371 | |
| 382 | 372 | fossil settings case-sensitive 1 |
| 383 | 373 | fossil revert |
| 384 | 374 | fossil update $upFirst |
| 385 | 375 | fossil settings case-sensitive 0 |
| 386 | 376 | 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 \ | |
| 389 | 379 | [file exists $b] 0 |
| 390 | 380 | } |
| 391 | 381 | if {[llength $upOneFile] > 0} { |
| 392 | 382 | test_skip_part "commit and update tests of [join $upOneFile {, }]:\ |
| 393 | 383 | filesystem type or argv rewriting has one name for both spellings\ |
| 394 | 384 |
| --- 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 |
+36
-33
| --- test/unversioned.test | ||
| +++ test/unversioned.test | ||
| @@ -58,31 +58,31 @@ | ||
| 58 | 58 | unversioned add|cat|edit|export|list|revert|remove|sync|touch}]} |
| 59 | 59 | |
| 60 | 60 | ############################################################################### |
| 61 | 61 | |
| 62 | 62 | fossil unversioned list |
| 63 | -test unversioned-2 {[normalize_result] eq {}} | |
| 63 | +test_eq unversioned-2 [normalize_result] {} | |
| 64 | 64 | |
| 65 | 65 | ############################################################################### |
| 66 | 66 | |
| 67 | 67 | fossil unversioned cat not-found.txt |
| 68 | -test unversioned-3 {[normalize_result] eq {}} | |
| 68 | +test_eq unversioned-3 [normalize_result] {} | |
| 69 | 69 | |
| 70 | 70 | ############################################################################### |
| 71 | 71 | |
| 72 | 72 | fossil unversioned cat unversioned1.txt |
| 73 | -test unversioned-4 {[normalize_result] eq {}} | |
| 73 | +test_eq unversioned-4 [normalize_result] {} | |
| 74 | 74 | |
| 75 | 75 | ############################################################################### |
| 76 | 76 | |
| 77 | 77 | fossil unversioned add unversioned1.txt |
| 78 | -test unversioned-5 {[normalize_result] eq {}} | |
| 78 | +test_eq unversioned-5 [normalize_result] {} | |
| 79 | 79 | |
| 80 | 80 | ############################################################################### |
| 81 | 81 | |
| 82 | 82 | 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.} | |
| 84 | 84 | |
| 85 | 85 | ############################################################################### |
| 86 | 86 | |
| 87 | 87 | fossil unversioned list |
| 88 | 88 | test unversioned-7 {[regexp \ |
| @@ -90,26 +90,26 @@ | ||
| 90 | 90 | unversioned1\.txt$} [normalize_result]]} |
| 91 | 91 | |
| 92 | 92 | ############################################################################### |
| 93 | 93 | |
| 94 | 94 | fossil unversioned ls |
| 95 | -test unversioned-8 {[normalize_result] eq {unversioned1.txt}} | |
| 95 | +test_eq unversioned-8 [normalize_result] {unversioned1.txt} | |
| 96 | 96 | |
| 97 | 97 | ############################################################################### |
| 98 | 98 | |
| 99 | 99 | fossil unversioned remove unversioned1.txt |
| 100 | -test unversioned-9 {[normalize_result] eq {}} | |
| 100 | +test_eq unversioned-9 [normalize_result] {} | |
| 101 | 101 | |
| 102 | 102 | ############################################################################### |
| 103 | 103 | |
| 104 | 104 | fossil unversioned list |
| 105 | -test unversioned-10 {[normalize_result] eq {}} | |
| 105 | +test_eq unversioned-10 [normalize_result] {} | |
| 106 | 106 | |
| 107 | 107 | ############################################################################### |
| 108 | 108 | |
| 109 | 109 | fossil unversioned ls |
| 110 | -test unversioned-11 {[normalize_result] eq {}} | |
| 110 | +test_eq unversioned-11 [normalize_result] {} | |
| 111 | 111 | |
| 112 | 112 | ############################################################################### |
| 113 | 113 | |
| 114 | 114 | fossil unversioned list --all |
| 115 | 115 | test unversioned-12 {[regexp \ |
| @@ -117,11 +117,11 @@ | ||
| 117 | 117 | unversioned1\.txt$} [normalize_result]]} |
| 118 | 118 | |
| 119 | 119 | ############################################################################### |
| 120 | 120 | |
| 121 | 121 | fossil unversioned ls --all |
| 122 | -test unversioned-13 {[normalize_result] eq {unversioned1.txt}} | |
| 122 | +test_eq unversioned-13 [normalize_result] {unversioned1.txt} | |
| 123 | 123 | |
| 124 | 124 | ############################################################################### |
| 125 | 125 | |
| 126 | 126 | fossil unversioned add "unversioned space.txt" -expectError |
| 127 | 127 | test unversioned-14 {[normalize_result] eq \ |
| @@ -128,11 +128,11 @@ | ||
| 128 | 128 | {unversioned filenames may not contain whitespace: 'unversioned space.txt'}} |
| 129 | 129 | |
| 130 | 130 | ############################################################################### |
| 131 | 131 | |
| 132 | 132 | fossil unversioned add "unversioned space.txt" --as unversioned3.txt |
| 133 | -test unversioned-15 {[normalize_result] eq {}} | |
| 133 | +test_eq unversioned-15 [normalize_result] {} | |
| 134 | 134 | |
| 135 | 135 | ############################################################################### |
| 136 | 136 | |
| 137 | 137 | fossil unversioned list |
| 138 | 138 | test unversioned-16 {[regexp \ |
| @@ -147,16 +147,16 @@ | ||
| 147 | 147 | unversioned3\.txt$} [normalize_result]]} |
| 148 | 148 | |
| 149 | 149 | ############################################################################### |
| 150 | 150 | |
| 151 | 151 | fossil unversioned ls |
| 152 | -test unversioned-18 {[normalize_result] eq {unversioned3.txt}} | |
| 152 | +test_eq unversioned-18 [normalize_result] {unversioned3.txt} | |
| 153 | 153 | |
| 154 | 154 | ############################################################################### |
| 155 | 155 | |
| 156 | 156 | fossil unversioned add unversioned2.txt --mtime 2016-10-01 |
| 157 | -test unversioned-19 {[normalize_result] eq {}} | |
| 157 | +test_eq unversioned-19 [normalize_result] {} | |
| 158 | 158 | |
| 159 | 159 | ############################################################################### |
| 160 | 160 | |
| 161 | 161 | fossil unversioned list |
| 162 | 162 | test unversioned-20 {[regexp \ |
| @@ -166,17 +166,18 @@ | ||
| 166 | 166 | unversioned3\.txt$} [normalize_result]]} |
| 167 | 167 | |
| 168 | 168 | ############################################################################### |
| 169 | 169 | |
| 170 | 170 | 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} | |
| 173 | 174 | |
| 174 | 175 | ############################################################################### |
| 175 | 176 | |
| 176 | 177 | fossil unversioned cat unversioned1.txt |
| 177 | -test unversioned-22 {[normalize_result] eq {}} | |
| 178 | +test_eq unversioned-22 [normalize_result] {} | |
| 178 | 179 | |
| 179 | 180 | ############################################################################### |
| 180 | 181 | |
| 181 | 182 | fossil unversioned cat unversioned2.txt |
| 182 | 183 | test unversioned-23 {[sha1_text $RESULT] eq \ |
| @@ -189,16 +190,16 @@ | ||
| 189 | 190 | {c6b95509120d9703cc4fbe5cdfcb435b5912b3e4}} |
| 190 | 191 | |
| 191 | 192 | ############################################################################### |
| 192 | 193 | |
| 193 | 194 | fossil unversioned rm unversioned3.txt |
| 194 | -test unversioned-25 {[normalize_result] eq {}} | |
| 195 | +test_eq unversioned-25 [normalize_result] {} | |
| 195 | 196 | |
| 196 | 197 | ############################################################################### |
| 197 | 198 | |
| 198 | 199 | fossil unversioned add unversioned4.txt |
| 199 | -test unversioned-26 {[normalize_result] eq {}} | |
| 200 | +test_eq unversioned-26 [normalize_result] {} | |
| 200 | 201 | |
| 201 | 202 | ############################################################################### |
| 202 | 203 | |
| 203 | 204 | fossil unversioned cat unversioned4.txt |
| 204 | 205 | set hash(before) [sha1_text $RESULT] |
| @@ -206,11 +207,11 @@ | ||
| 206 | 207 | {b48ba8e2d0b498321dfd13de84867effda399af5}} |
| 207 | 208 | |
| 208 | 209 | ############################################################################### |
| 209 | 210 | |
| 210 | 211 | fossil unversioned edit unversioned4.txt |
| 211 | -test unversioned-28 {[normalize_result] eq {}} | |
| 212 | +test_eq unversioned-28 [normalize_result] {} | |
| 212 | 213 | |
| 213 | 214 | ############################################################################### |
| 214 | 215 | |
| 215 | 216 | fossil unversioned cat unversioned4.txt |
| 216 | 217 | set hash(after) [sha1_text $RESULT] |
| @@ -218,11 +219,11 @@ | ||
| 218 | 219 | test unversioned-30 {[regexp { \d+ (?:-)?\d+$} $RESULT]} |
| 219 | 220 | |
| 220 | 221 | ############################################################################### |
| 221 | 222 | |
| 222 | 223 | fossil unversioned edit unversioned4.txt --mtime 2016-10-01 |
| 223 | -test unversioned-31 {[normalize_result] eq {}} | |
| 224 | +test_eq unversioned-31 [normalize_result] {} | |
| 224 | 225 | |
| 225 | 226 | ############################################################################### |
| 226 | 227 | |
| 227 | 228 | fossil unversioned cat unversioned4.txt |
| 228 | 229 | test unversioned-32 {[regexp { \d+ (?:-)?\d+ \d+ (?:-)?\d+$} $RESULT]} |
| @@ -237,11 +238,11 @@ | ||
| 237 | 238 | unversioned4\.txt$} [normalize_result]]} |
| 238 | 239 | |
| 239 | 240 | ############################################################################### |
| 240 | 241 | |
| 241 | 242 | fossil unversioned export unversioned2.txt unversioned2-ex.txt |
| 242 | -test unversioned-34 {[normalize_result] eq {}} | |
| 243 | +test_eq unversioned-34 [normalize_result] {} | |
| 243 | 244 | test unversioned-35 {[sha1_file unversioned2-ex.txt] eq \ |
| 244 | 245 | {962f96ebd613e4fdd9aa2d20bd9fe21a64e925f2}} |
| 245 | 246 | |
| 246 | 247 | ############################################################################### |
| 247 | 248 | |
| @@ -257,11 +258,11 @@ | ||
| 257 | 258 | [0-9a-f]{40,64}$} [normalize_result]]} |
| 258 | 259 | |
| 259 | 260 | ############################################################################### |
| 260 | 261 | |
| 261 | 262 | 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] {} | |
| 263 | 264 | |
| 264 | 265 | ############################################################################### |
| 265 | 266 | |
| 266 | 267 | fossil unversioned list --all |
| 267 | 268 | test unversioned-39 {[regexp \ |
| @@ -274,11 +275,11 @@ | ||
| 274 | 275 | [normalize_result]]} |
| 275 | 276 | |
| 276 | 277 | ############################################################################### |
| 277 | 278 | |
| 278 | 279 | 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] {} | |
| 280 | 281 | |
| 281 | 282 | ############################################################################### |
| 282 | 283 | |
| 283 | 284 | fossil unversioned list --all |
| 284 | 285 | test unversioned-41 {[regexp \ |
| @@ -291,16 +292,16 @@ | ||
| 291 | 292 | [normalize_result]]} |
| 292 | 293 | |
| 293 | 294 | ############################################################################### |
| 294 | 295 | |
| 295 | 296 | fossil unversioned add unversioned5.txt |
| 296 | -test unversioned-42 {[normalize_result] eq {}} | |
| 297 | +test_eq unversioned-42 [normalize_result] {} | |
| 297 | 298 | |
| 298 | 299 | ############################################################################### |
| 299 | 300 | |
| 300 | 301 | fossil unversioned touch unversioned5.txt |
| 301 | -test unversioned-43 {[normalize_result] eq {}} | |
| 302 | +test_eq unversioned-43 [normalize_result] {} | |
| 302 | 303 | |
| 303 | 304 | ############################################################################### |
| 304 | 305 | |
| 305 | 306 | fossil unversioned list |
| 306 | 307 | test unversioned-44 {[regexp \ |
| @@ -322,11 +323,12 @@ | ||
| 322 | 323 | \"fossil server\" cannot start a server." |
| 323 | 324 | } |
| 324 | 325 | |
| 325 | 326 | foreach {pid port outTmpFile} [test_start_server $repository stopArg] {} |
| 326 | 327 | if {! $::QUIET} { |
| 327 | - puts [appendArgs "Started Fossil server, pid \"" $pid \" ", port \"" $port \".] | |
| 328 | + puts [appendArgs "Started Fossil server, pid \"" $pid \" ", port \"" \ | |
| 329 | + $port \".] | |
| 328 | 330 | } |
| 329 | 331 | set remote [appendArgs http://uvtester: $password @localhost: $port /] |
| 330 | 332 | |
| 331 | 333 | ############################################################################### |
| 332 | 334 | |
| @@ -346,11 +348,11 @@ | ||
| 346 | 348 | fossil open -f uvrepo.fossil |
| 347 | 349 | |
| 348 | 350 | ############################################################################### |
| 349 | 351 | |
| 350 | 352 | fossil unversioned list |
| 351 | -test unversioned-45 {[normalize_result] eq {}} | |
| 353 | +test_eq unversioned-45 [normalize_result] {} | |
| 352 | 354 | |
| 353 | 355 | ############################################################################### |
| 354 | 356 | |
| 355 | 357 | fossil_maybe_answer y unversioned sync $remote |
| 356 | 358 | test unversioned-46 {[regexp \ |
| @@ -359,19 +361,20 @@ | ||
| 359 | 361 | [normalize_result]]} |
| 360 | 362 | |
| 361 | 363 | ############################################################################### |
| 362 | 364 | |
| 363 | 365 | 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} | |
| 366 | 369 | |
| 367 | 370 | ############################################################################### |
| 368 | 371 | |
| 369 | 372 | set env(FAKE_EDITOR_SCRIPT) "append data this_is_a_test"; # deterministic |
| 370 | 373 | |
| 371 | 374 | fossil unversioned edit unversioned2.txt |
| 372 | -test unversioned-48 {[normalize_result] eq {}} | |
| 375 | +test_eq unversioned-48 [normalize_result] {} | |
| 373 | 376 | |
| 374 | 377 | unset env(FAKE_EDITOR_SCRIPT) |
| 375 | 378 | |
| 376 | 379 | ############################################################################### |
| 377 | 380 | |
| @@ -380,11 +383,11 @@ | ||
| 380 | 383 | {e15d4b576fc04e3bb5e44a33d44d104dd5b19428}} |
| 381 | 384 | |
| 382 | 385 | ############################################################################### |
| 383 | 386 | |
| 384 | 387 | fossil unversioned remove unversioned5.txt |
| 385 | -test unversioned-50 {[normalize_result] eq {}} | |
| 388 | +test_eq unversioned-50 [normalize_result] {} | |
| 386 | 389 | |
| 387 | 390 | ############################################################################### |
| 388 | 391 | |
| 389 | 392 | fossil unversioned list --all |
| 390 | 393 | test unversioned-51 {[regexp \ |
| @@ -411,11 +414,11 @@ | ||
| 411 | 414 | unversioned5\.txt$} [normalize_result]]} |
| 412 | 415 | |
| 413 | 416 | ############################################################################### |
| 414 | 417 | |
| 415 | 418 | fossil unversioned add unversioned-client1.txt |
| 416 | -test unversioned-54 {[normalize_result] eq {}} | |
| 419 | +test_eq unversioned-54 [normalize_result] {} | |
| 417 | 420 | |
| 418 | 421 | ############################################################################### |
| 419 | 422 | |
| 420 | 423 | fossil_maybe_answer y unversioned sync $remote |
| 421 | 424 | test unversioned-55 {[regexp \ |
| @@ -424,11 +427,11 @@ | ||
| 424 | 427 | [normalize_result]]} |
| 425 | 428 | |
| 426 | 429 | ############################################################################### |
| 427 | 430 | |
| 428 | 431 | fossil close |
| 429 | -test unversioned-56 {[normalize_result] eq {}} | |
| 432 | +test_eq unversioned-56 [normalize_result] {} | |
| 430 | 433 | |
| 431 | 434 | ############################################################################### |
| 432 | 435 | |
| 433 | 436 | cd $savedPwd; unset savedPwd |
| 434 | 437 | file delete -force $clientDir |
| 435 | 438 |
| --- 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 |
+9
-4
| --- test/update.test | ||
| +++ test/update.test | ||
| @@ -28,15 +28,17 @@ | ||
| 28 | 28 | fossil revert |
| 29 | 29 | fossil update |
| 30 | 30 | return [format "test-%02u-%s.txt" $UPDATE_TEST $desc] |
| 31 | 31 | } |
| 32 | 32 | |
| 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 | |
| 34 | 35 | # files. Only do this if we have the expected branch information. |
| 35 | 36 | proc test_update {testname message changes {fossil_args ""}} { |
| 36 | 37 | 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 ] } { | |
| 38 | 40 | regsub {^(?:UNCHANGED [-a-z0-9.]+\n)*} $test_result {} test_result |
| 39 | 41 | } else { |
| 40 | 42 | set test_result $::RESULT |
| 41 | 43 | } |
| 42 | 44 | test "update-message-$testname" {$message == $test_result} |
| @@ -65,11 +67,11 @@ | ||
| 65 | 67 | # Remaining tests are carried out in the order update_cmd() performs checks. |
| 66 | 68 | # |
| 67 | 69 | # Common approach for tests below: |
| 68 | 70 | # 1. Set the testname |
| 69 | 71 | # 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 | |
| 71 | 73 | # 3. Optionally set up and commit a common base for the next steps |
| 72 | 74 | # 4. Commit a change to the repository (new tip) |
| 73 | 75 | # 5. Update to the previous version |
| 74 | 76 | # 6. Make changes |
| 75 | 77 | # 7. Call test_update to attempt and update to tip |
| @@ -87,11 +89,14 @@ | ||
| 87 | 89 | fossil add $fname |
| 88 | 90 | test_update $testname $message $changes -expectError |
| 89 | 91 | |
| 90 | 92 | set testname "add-overwrites" |
| 91 | 93 | 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\""] ""] | |
| 93 | 98 | set changes "" |
| 94 | 99 | write_seq_to_file $fname |
| 95 | 100 | fossil add $fname |
| 96 | 101 | fossil commit -m "Add $fname" |
| 97 | 102 | fossil up previous |
| 98 | 103 |
| --- 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 @@ | ||
| 555 | 555 | set flags [expr {$flags | 0x40}] |
| 556 | 556 | } |
| 557 | 557 | return $flags |
| 558 | 558 | } |
| 559 | 559 | |
| 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). | |
| 561 | 562 | proc utf_predict {bytes} { |
| 562 | 563 | set n [string length $bytes] |
| 563 | 564 | set fUtf8 [utf_starts_with_utf8_bom $bytes] |
| 564 | 565 | lassign [utf_starts_with_utf16_bom $bytes] fUtf16 bRev |
| 565 | 566 | lassign [utf_could_be_utf16 $bytes] fUnicode bRev2 |
| @@ -599,11 +600,12 @@ | ||
| 599 | 600 | foreach line [split [string map [list \r\n \n] $text] \n] { |
| 600 | 601 | if {[regexp {^File ".*" has (\d+) bytes\.$} $line -> n]} { |
| 601 | 602 | dict set d bytes $n |
| 602 | 603 | } elseif {[regexp {^Starts with UTF-8 BOM: (yes|no)$} $line -> v]} { |
| 603 | 604 | 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]} { | |
| 605 | 607 | dict set d utf16_bom $v |
| 606 | 608 | } elseif {[regexp {^Looks like UTF-(8|16): (yes|no)$} $line -> k v]} { |
| 607 | 609 | dict set d looks_kind $k |
| 608 | 610 | dict set d looks_like $v |
| 609 | 611 | } elseif {[regexp {^Has flag (LOOK_[A-Z_]+): (yes|no)$} $line -> f v]} { |
| @@ -611,19 +613,10 @@ | ||
| 611 | 613 | } |
| 612 | 614 | } |
| 613 | 615 | return $d |
| 614 | 616 | } |
| 615 | 617 | |
| 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 | 618 | |
| 626 | 619 | # Compare every predicted field to fossil output (yes and no). |
| 627 | 620 | proc utf_check_cell {label bytes path} { |
| 628 | 621 | utf_write_bytes $path $bytes |
| 629 | 622 | set pred [utf_predict $bytes] |
| @@ -632,11 +625,11 @@ | ||
| 632 | 625 | foreach key {bytes utf8_bom utf16_bom looks_kind looks_like \ |
| 633 | 626 | LOOK_NUL LOOK_CR LOOK_LONE_CR LOOK_LF LOOK_LONE_LF LOOK_CRLF \ |
| 634 | 627 | LOOK_LONG LOOK_INVALID LOOK_ODD LOOK_SHORT} { |
| 635 | 628 | set e [dict get $pred $key] |
| 636 | 629 | 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 | |
| 638 | 631 | } |
| 639 | 632 | } |
| 640 | 633 | |
| 641 | 634 | # Smoke: stratified edges covering each detector branch. |
| 642 | 635 | proc utf_smoke_cells {} { |
| 643 | 636 |
| --- 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 @@ | ||
| 76 | 76 | |
| 77 | 77 | |
| 78 | 78 | ############################################################################### |
| 79 | 79 | # Initially there should be no wiki entries |
| 80 | 80 | fossil wiki list |
| 81 | -test wiki-0 {[normalize_result] eq {}} | |
| 81 | +test_eq wiki-0 [normalize_result] {} | |
| 82 | 82 | |
| 83 | 83 | ############################################################################### |
| 84 | 84 | # Adding an entry should add it to the wiki list |
| 85 | 85 | write_file f1 "first wiki note" |
| 86 | 86 | fossil wiki create tcltest f1 |
| 87 | 87 | test wiki-1 {$CODE == 0} |
| 88 | 88 | fossil wiki list |
| 89 | -test wiki-2 {[normalize_result] eq {tcltest}} | |
| 89 | +test_eq wiki-2 [normalize_result] {tcltest} | |
| 90 | 90 | |
| 91 | 91 | ############################################################################### |
| 92 | 92 | # Trying to add the same entry should fail |
| 93 | 93 | fossil wiki create tcltest f1 -expectError |
| 94 | 94 | test wiki-3 {$CODE != 0} |
| @@ -97,34 +97,34 @@ | ||
| 97 | 97 | # exporting the wiki page should give back similar text |
| 98 | 98 | fossil wiki export tcltest a1 |
| 99 | 99 | test wiki-4 {[similar_file f1 a1]} |
| 100 | 100 | |
| 101 | 101 | ############################################################################### |
| 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 | |
| 103 | 103 | write_file f2 "second version of the page" |
| 104 | 104 | fossil wiki commit tcltest f2 |
| 105 | 105 | test wiki-5 {$CODE == 0} |
| 106 | 106 | fossil wiki export tcltest a2 |
| 107 | 107 | test wiki-6 {[similar_file f2 a2]} |
| 108 | 108 | |
| 109 | 109 | ############################################################################### |
| 110 | -# But we shouldn't be able to update non-existant pages | |
| 110 | +# But we shouldn't be able to update nonexistent pages | |
| 111 | 111 | fossil wiki commit doesntexist f1 -expectError |
| 112 | 112 | test wiki-7 {$CODE != 0} |
| 113 | 113 | |
| 114 | 114 | ############################################################################### |
| 115 | 115 | # There shouldn't be any tech notes at this point |
| 116 | 116 | fossil wiki list --technote |
| 117 | -test wiki-8 {[normalize_result] eq {}} | |
| 117 | +test_eq wiki-8 [normalize_result] {} | |
| 118 | 118 | |
| 119 | 119 | ############################################################################### |
| 120 | 120 | # Creating a tech note with a specified timestamp should add a technote |
| 121 | 121 | write_file f3 "A technote" |
| 122 | 122 | fossil wiki create technote f3 --technote {2016-01-01 12:34} |
| 123 | 123 | test wiki-9 {$CODE == 0} |
| 124 | 124 | 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} | |
| 126 | 126 | fossil wiki list --technote --show-technote-ids |
| 127 | 127 | set technotelist [split $RESULT "\n"] |
| 128 | 128 | set veryfirsttechnoteid [lindex [split [lindex $technotelist 0]] 0] |
| 129 | 129 | |
| 130 | 130 | ############################################################################### |
| @@ -140,11 +140,11 @@ | ||
| 140 | 140 | fossil wiki list --technote |
| 141 | 141 | set technotelist [split $RESULT "\n"] |
| 142 | 142 | test wiki-13.1 {[llength $technotelist] == 2} |
| 143 | 143 | |
| 144 | 144 | ############################################################################### |
| 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 | |
| 146 | 146 | # (this should update the tech note from wiki-13 as that the most recently |
| 147 | 147 | # updated one, that should also be the one exported by the export command) |
| 148 | 148 | write_file f4 "technote 2nd variant" |
| 149 | 149 | fossil wiki commit technote f4 --technote {2016-01-01 12:34} |
| 150 | 150 | test wiki-14 {$CODE == 0} |
| @@ -154,42 +154,48 @@ | ||
| 154 | 154 | # recently still has its original text |
| 155 | 155 | fossil wiki export a4.1 --technote $veryfirsttechnoteid |
| 156 | 156 | test wiki-15.1 {[similar_file f3 a4.1]} |
| 157 | 157 | |
| 158 | 158 | ############################################################################### |
| 159 | -# But we shouldn't be able to update non-existant pages | |
| 159 | +# But we shouldn't be able to update nonexistent pages | |
| 160 | 160 | fossil wiki commit doesntexist f1 -expectError |
| 161 | 161 | test wiki-16 {$CODE != 0} |
| 162 | 162 | |
| 163 | 163 | ############################################################################### |
| 164 | 164 | # Check specifying tags for a technote is OK |
| 165 | 165 | 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} | |
| 167 | 168 | test wiki-17 {$CODE == 0} |
| 168 | 169 | 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} | |
| 170 | 172 | test wiki-18 {$CODE == 0} |
| 171 | 173 | |
| 172 | 174 | ############################################################################### |
| 173 | 175 | # Check specifying a bgcolor for a technote is OK |
| 174 | 176 | 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 | |
| 176 | 179 | test wiki-19 {$CODE == 0} |
| 177 | 180 | 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 | |
| 179 | 183 | test wiki-20 {$CODE == 0} |
| 180 | 184 | |
| 181 | 185 | ############################################################################### |
| 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 | |
| 183 | 188 | write_file fa "This is a file to be attached" |
| 184 | 189 | fossil attachment add doesntexist fa -expectError |
| 185 | 190 | test wiki-21 {$CODE != 0} |
| 186 | 191 | fossil attachment add tcltest fa |
| 187 | 192 | test wiki-22 {$CODE == 0} |
| 188 | 193 | |
| 189 | 194 | ############################################################################### |
| 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 | |
| 191 | 197 | fossil attachment add fa --technote {2016-07-22 12:00} -expectError |
| 192 | 198 | test wiki-23 {$CODE != 0} |
| 193 | 199 | fossil attachment add fa --technote {2016-01-03 12:34} |
| 194 | 200 | test wiki-24 {$CODE == 0} |
| 195 | 201 | |
| @@ -200,13 +206,15 @@ | ||
| 200 | 206 | |
| 201 | 207 | ############################################################################### |
| 202 | 208 | # Check that a technote with an attachment can be updated |
| 203 | 209 | fossil wiki commit technote f6 --technote {2016-01-03 12:34} |
| 204 | 210 | 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} | |
| 206 | 213 | 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 | |
| 208 | 216 | test wiki-28 {$CODE == 0} |
| 209 | 217 | |
| 210 | 218 | ############################################################################### |
| 211 | 219 | # Check longest form of timestamp for the technote |
| 212 | 220 | write_file f7 "Different timestamps" |
| @@ -288,17 +296,20 @@ | ||
| 288 | 296 | append match [lindex $technotelist $i] |
| 289 | 297 | test "wiki-39-$i" {[string match $match [lindex $technoteidlist $i]]} |
| 290 | 298 | } |
| 291 | 299 | |
| 292 | 300 | ############################################################################### |
| 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 | |
| 295 | 305 | write_file f12 "A really old tech note" |
| 296 | 306 | fossil wiki create {Old tech note} f12 --technote {2001-07-07 09:08:07} |
| 297 | 307 | fossil wiki list --technote --show-technote-ids |
| 298 | 308 | 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] | |
| 300 | 311 | fossil wiki export a12 --technote $anoldtechnoteid |
| 301 | 312 | test wiki-40 {[similar_file f12 a12]} |
| 302 | 313 | |
| 303 | 314 | ############################################################################### |
| 304 | 315 | # Also check that we can specify a prefix of the tech note id (note: with |
| @@ -331,11 +342,12 @@ | ||
| 331 | 342 | set idA [lindex $techIds 0] |
| 332 | 343 | set idB [lindex $techIds 1] |
| 333 | 344 | set duplicateid [string range $idA 0 3] |
| 334 | 345 | if {[string range $idB 0 3] ne $duplicateid} { |
| 335 | 346 | 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';" | |
| 337 | 349 | if {$CODE != 0} { |
| 338 | 350 | error "wiki-collision: failed to plant prefix collision:\n$RESULT" |
| 339 | 351 | } |
| 340 | 352 | } |
| 341 | 353 | fossil wiki export a13 --technote $duplicateid -expectError |
| @@ -347,23 +359,22 @@ | ||
| 347 | 359 | fossil wiki commit {Old tech note} f14 --technote $anoldtechnoteid |
| 348 | 360 | fossil wiki export a14 --technote $anoldtechnoteid |
| 349 | 361 | test wiki-43 {[similar_file f14 a14]} |
| 350 | 362 | |
| 351 | 363 | ############################################################################### |
| 352 | -# Check we can add attachments to a technote by its id | |
| 353 | 364 | fossil attachment add fa --technote $anoldtechnoteid |
| 354 | 365 | test wiki-44 {$CODE == 0} |
| 355 | 366 | |
| 356 | 367 | ############################################################################### |
| 357 | 368 | # Also check that we can specify a prefix of the tech note id |
| 358 | 369 | 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] | |
| 360 | 372 | fossil wiki export a15 --technote $anoldtechnoteid |
| 361 | 373 | test wiki-45 {[similar_file f15 a15]} |
| 362 | 374 | |
| 363 | 375 | ############################################################################### |
| 364 | -# Check we can add attachments to a technote by a prefix of its id | |
| 365 | 376 | fossil attachment add fa --technote [string range $anoldtechnoteid 0 20] |
| 366 | 377 | test wiki-46 {$CODE == 0} |
| 367 | 378 | |
| 368 | 379 | ############################################################################### |
| 369 | 380 | # And we get an error for the ambiguous tech note id |
| @@ -371,11 +382,10 @@ | ||
| 371 | 382 | test wiki-47 {$CODE != 0} |
| 372 | 383 | fossil attachment add fa --technote $duplicateid -expectError |
| 373 | 384 | test wiki-48 {$CODE != 0} |
| 374 | 385 | |
| 375 | 386 | ############################################################################### |
| 376 | -# Check the default mimetype is text/x-fossil-wiki | |
| 377 | 387 | test wiki-49 {[get_mime_type tcltest] == "text/x-fossil-wiki"} |
| 378 | 388 | |
| 379 | 389 | ############################################################################### |
| 380 | 390 | # Check long form of the mimetypes are recorded correctly |
| 381 | 391 | fossil wiki create tcltest-x-fossil f1 -mimetype text/x-fossil-wiki |
| 382 | 392 |
| --- 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 |