Skip to content

Commit

Permalink
Prefer _1 and _2 naming for test files
Browse files Browse the repository at this point in the history
This is less to type, and it's now alphabetical, so e.g.
sample_files/*.kt just works as a test argument.
  • Loading branch information
Wilfred committed Apr 29, 2024
1 parent cce7b2e commit 5c40cd0
Show file tree
Hide file tree
Showing 229 changed files with 256 additions and 260 deletions.
6 changes: 3 additions & 3 deletions manual/src/adding_a_parser.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ Finally, add a regression test for your language. This ensures that
the output for your test file doesn't change unexpectedly.

Regression test files live in `sample_files/` and have the form
`foo_before.abc` and `foo_after.abc`.
`foo_1.abc` and `foo_2.abc`.

```
$ nano simple_before.json
$ nano simple_after.json
$ nano simple_1.json
$ nano simple_2.json
```

Run the regression test script and update the `.expected` file.
Expand Down
10 changes: 5 additions & 5 deletions manual/src/line_diffing.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Variations, Myers
```
# Modern diff supports colour, but see also
# https://www.colordiff.org/
$ diff --color=always -u sample_files/css_before.css sample_files/css_after.css
$ diff --color=always -u sample_files/css_1.css sample_files/css_2.css
```

Note that GNU diff [originally used the Hunt-McIlroy
Expand Down Expand Up @@ -64,11 +64,11 @@ work](https://stackoverflow.com/questions/40133534/is-gits-implementation-of-the

```
# Original behaviour
$ git diff --no-indent-heuristic --no-index sample_files/css_before.css sample_files/css_after.css
$ git diff --no-indent-heuristic --no-index sample_files/css_1.css sample_files/css_2.css
# As of git 2.11, this heuristic is enabled by default.
$ git diff --indent-heuristic --no-index sample_files/css_before.css sample_files/css_after.css
$ git diff --indent-heuristic --no-index sample_files/css_1.css sample_files/css_2.css
# Patience algorithm does a better a job in this example.
$ git diff --patience --no-index sample_files/css_before.css sample_files/css_after.css
$ git diff --patience --no-index sample_files/css_1.css sample_files/css_2.css
```

[Diff Match Patch](https://github.com/google/diff-match-patch) also
Expand All @@ -84,7 +84,7 @@ of the patience algorithm](https://github.com/git/git/commit/85551232b56e763ecfc

```
# Inferior to patience on this example file.
$ git diff --histogram --no-index sample_files/css_before.css sample_files/css_after.css
$ git diff --histogram --no-index sample_files/css_1.css sample_files/css_2.css
```

### prettydiff
Expand Down
2 changes: 1 addition & 1 deletion manual/src/parsing.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ the parse tree that tree-sitter produces using the `--dump-ts`
flag.

```
$ difft --dump-ts sample_files/javascript_simple_before.js | head
$ difft --dump-ts sample_files/javascript_simple_1.js | head
program (0, 0) - (7, 0)
comment (0, 0) - (0, 8) "// hello"
expression_statement (1, 0) - (1, 6)
Expand Down
8 changes: 4 additions & 4 deletions manual/src/profiling.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ If you have a file that's particularly slow, you can use
which functions are slow.

```
$ CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph --bin difft sample_files/slow_before.rs sample_files/slow_after.rs
$ CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph --bin difft sample_files/slow_1.rs sample_files/slow_2.rs
```

It's also worth looking at memory usage, as graph traversal bugs can
lead to huge memory consumption.

```
$ /usr/bin/time -v ./target/release/difft sample_files/slow_before.rs sample_files/slow_after.rs
$ /usr/bin/time -v ./target/release/difft sample_files/slow_1.rs sample_files/slow_2.rs
```

If timing measurement are noisy, Linux's `perf` tool will report
instructions executed, which is more stable.

```
$ perf stat ./target/release/difft sample_files/slow_before.rs sample_files/slow_after.rs
$ perf stat ./target/release/difft sample_files/typing_old.ml sample_files/typing_new.ml
$ perf stat ./target/release/difft sample_files/slow_1.rs sample_files/slow_2.rs
$ perf stat ./target/release/difft sample_files/typing_1.ml sample_files/typing_2.ml
```

Many more profiling techniques are discussed in [The Rust Performance
Expand Down
2 changes: 1 addition & 1 deletion manual/src/tricky_cases.md
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ parse errors occur, to avoid diffing incomplete syntax trees. When
this occurs, the file header reports the error count.

```
$ difft sample_files/syntax_error_before.js sample_files/syntax_error_after.js
$ difft sample_files/syntax_error_1.js sample_files/syntax_error_2.js
sample_files/syntax_error_after.js --- Text (2 errors, exceeded DFT_PARSE_ERROR_LIMIT)
...
```
Expand Down
2 changes: 1 addition & 1 deletion manual/src/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ $ difft sample_files/before.js sample_files/after.js
### Diffing Directories

```
$ difft sample_files/dir_before/ sample_files/dir_after/
$ difft sample_files/dir_1/ sample_files/dir_2/
```

Difftastic will recursively walk the two directories, diffing files
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 5c40cd0

Please sign in to comment.