Skip to content

Commit

Permalink
test(readme): Fix parsing (termination w/ zero space)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpovel committed Nov 6, 2024
1 parent 0e100dd commit 3af3f52
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
4 changes: 0 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,6 @@ tested](./tests/readme.rs). The testing of the `bash` snippets is pure Rust (no
binary needed), making it platform-independent. The downside is that custom parsing is
used. This has known warts. Those warts have workarounds:

- sometimes, in the [README](./README.md), `bash` lines are terminated by a single space
([example](https://github.com/alexpovel/srgn/blob/8ff54ee53ac0a53cdc4791b069648ee4511c7b94/README.md?plain=1#L1201)).
This exists to **terminate the parser** properly before the newline, allowing it to
finish.
- the README contains the full output of `srgn --help`, which is also tested against.
**This is whitespace-sensitive**, so there is trailing whitespace. Removing it fails
tests.
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1198,14 +1198,13 @@ Typing out tree-sitter queries at the CLI can be unwieldy. To mitigate this you
Below we use the same Python file from the previous section with an invocation of

```bash
cat cond.py | srgn --python-query 'docs/python_cond_query.scm'
cat cond.py | srgn --python-query 'docs/python_cond_query.scm'
1:if x:
2: return left
3:else:
4: return right
```


###### Ignoring parts of matches

Occassionally, parts of a match need to be ignored, for example when no suitable
Expand Down
2 changes: 1 addition & 1 deletion tests/readme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ mod tests {
// Quoting always is technically overkill, but much
// simpler and safer
parse_quoted,
space1,
space0,
),
),
)),
Expand Down

0 comments on commit 3af3f52

Please sign in to comment.