Skip to content

Commit 6f529df

Browse files
fix: rename command name part 7
1 parent 9452b91 commit 6f529df

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

website/catalog/rust/boshen-footgun.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Depending on your use case, you may want to use `char_indices()` instead of `cha
2323
### Pattern
2424

2525
```shell
26-
sg -p '$A.chars().enumerate()' \
26+
ast-grep -p '$A.chars().enumerate()' \
2727
-r '$A.char_indices()' \
2828
-l rs
2929
```

website/guide/test-rule.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,11 @@ invalid:
109109
# .... more invalid test cases
110110
```
111111

112-
After writing the test configuration file, you can run `sg test` in the root folder to test your rule.
112+
After writing the test configuration file, you can run `ast-grep test` in the root folder to test your rule.
113113
We will discuss the `skip-snapshot-tests` option later.
114114

115115
```bash
116-
$ sg test --skip-snapshot-tests
116+
$ ast-grep test --skip-snapshot-tests
117117
118118
Running 1 tests
119119
PASS no-await-in-loop .........................
@@ -147,7 +147,7 @@ In failure details, we can see the detailed code snippet for each case.
147147
Besides testing code validity, we can further test rule's output like error's message and span. This is what snapshot test will cover.
148148

149149
## Snapshot Test
150-
Let's rerun `sg test` without `--skip-snapshot-tests` option.
150+
Let's rerun `ast-grep test` without `--skip-snapshot-tests` option.
151151
This time we will get test failure that invalid code error does not have a matching snapshot.
152152
Previously we use the `skip-snapshot-tests` option to suppress snapshot test, which is useful when you are still working on your rule. But after the rule is polished, we can create snapshot to capture the desired output of the rule.
153153

@@ -165,14 +165,14 @@ my-awesome-rules/
165165
```
166166

167167
The generated `__snapshots__` folder will store all the error output and later test run will match against them.
168-
After the snapshot is generated, we can run `sg test` again, without any option this time, and pass all the test cases!
168+
After the snapshot is generated, we can run `ast-grep test` again, without any option this time, and pass all the test cases!
169169

170170
Furthermore, when we change the rule or update the test case, we can use interactive mode to update the snapshot.
171171

172172
Running this command
173173

174174
```bash
175-
sg test --interactive
175+
ast-grep test --interactive
176176
```
177177

178178
ast-grep will spawn an interactive session to ask you select desired snapshot updates. Example interactive session will look like this. Note the snapshot diff is highlighted in red/green color.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy