Skip to content

Commit 9a9bd29

Browse files
committed
Improve test instructions to be more foolproof
Also put them in a place where they won't be overwritten.
1 parent 0ed0164 commit 9a9bd29

File tree

4 files changed

+31
-16
lines changed

4 files changed

+31
-16
lines changed

gix-diff/tests/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
## How to run diff-slider tests
2+
3+
The idea is to use https://github.com/mhagger/diff-slider-tools to create slider information for use to generate a test which invokes our own implementation and compares it to Git itself.
4+
Follow these instructions to set it up.
5+
6+
1. DIFF_SLIDER_TOOLS=/your/anticipated/path/to/diff-slider-tools
7+
2. `git clone https://github.com/mhagger/diff-slider-tools $DIFF_SLIDER_TOOLS`
8+
3. `pushd $DIFF_SLIDER_TOOLS`
9+
4. Follow [these instructions](https://github.com/mhagger/diff-slider-tools/blob/b59ed13d7a2a6cfe14a8f79d434b6221cc8b04dd/README.md?plain=1#L122-L146) to generate a file containing the slider information. Be sure to set the `repo` variable as it's used in later script invocations.
10+
- Note that `get-corpus` must be run with `./get-corpus`.
11+
- You can use an existing repository, for instance via `repo=git-human`, so there is no need to find your own repository to test.
12+
- The script suite is very slow, and it's recommended to only set a range of commits, or use a small repository for testing.
13+
14+
Finally, run the `internal-tools` program to turn that file into a fixture called `make_diff_for_sliders_repo.sh`.
15+
16+
```shell
17+
# run inside `gitoxide`
18+
popd
19+
cargo run --package internal-tools -- \
20+
create-diff-cases \
21+
--sliders-file $DIFF_SLIDER_TOOLS/corpus/$repo.sliders \
22+
--worktree-dir $DIFF_SLIDER_TOOLS/corpus/$repo.git/ \
23+
--destination-dir gix-diff/tests/fixtures/
24+
```
25+
26+
Finally, run `cargo test -p gix-diff-tests sliders -- --nocapture` to execute the actual tests to compare.

gix-diff/tests/fixtures/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# The slider assets that are needed for that slider fixture script to work and build the fixture.
2+
/assets/
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# The auto-generated sliders fixtures. For now it's experimental, but we may store it later once it's all working.
2+
/make_diff_for_sliders_repo.tar

gix-diff/tests/fixtures/make_diff_for_sliders_repo.sh

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,4 @@ set -eu -o pipefail
55
# `create-diff-cases` subcommand of `internal-tools`. The placeholder does
66
# nothing except making the associated test trivially pass.
77
#
8-
# ## Usage
9-
#
10-
# Follow these instructions to generate a file containing sliders:
11-
# https://github.com/mhagger/diff-slider-tools/blob/b59ed13d7a2a6cfe14a8f79d434b6221cc8b04dd/README.md?plain=1#L122-L146
12-
#
13-
# Run `create-diff-cases` to create the script in `gix-diff/tests/fixtures/`.
14-
# The script will be called `make_diff_for_sliders_repo.sh` and it will
15-
# overwrite the placeholder.
16-
#
17-
# ```
18-
# # run inside `gitoxide`
19-
# cargo run --package internal-tools -- create-diff-cases --sliders-file $PATH_TO_DIFF_SLIDER_TOOLS/corpus/git.sliders --worktree-dir $PATH_TO_DIFF_SLIDER_TOOLS/corpus/git.git/ --destination-dir gix-diff/tests/fixtures/
20-
# ```
21-
#
22-
# Run `cargo test sliders -- --nocapture` inside `gix-diff/tests` to run the
23-
# actual tests.
8+
# See the `gix-diff/tests/README.md` file for more information.

0 commit comments

Comments
 (0)