@@ -9,6 +9,18 @@ on issues, or file new issues specifically to get help.
9
9
All contributors are expected to follow our [ Code of
10
10
Conduct] ( CODE_OF_CONDUCT.md ) .
11
11
12
+ # Building and Testing
13
+
14
+ Rustfmt requires a nightly compiler. Replace all invocations of ` cargo ` by
15
+ ` cargo +nightly ` if necessary.
16
+
17
+ At all times the environment variables ` CFG_RELEASE_CHANNEL ` and ` CFG_RELEASE ` must
18
+ be set to either ` nightly ` or ` beta ` . Both should be set to the same value. For example:
19
+
20
+ ```
21
+ CFG_RELEASE_CHANNEL=nightly CFG_RELEASE=nightly cargo +nightly test-all
22
+ ```
23
+
12
24
## Test and file issues
13
25
14
26
It would be really useful to have people use rustfmt on their projects and file
@@ -20,18 +32,19 @@ issues where it does something you don't expect.
20
32
Having a strong test suite for a tool like this is essential. It is very easy
21
33
to create regressions. Any tests you can add are very much appreciated.
22
34
23
- The tests can be run with ` cargo test ` . This does a number of things:
35
+ The tests can be run with ` cargo test-all ` . This does a number of things:
24
36
* runs the unit tests for a number of internal functions;
25
- * makes sure that rustfmt run on every file in ` ./ tests/source/` is equal to its
26
- associated file in ` . /tests/target/` ;
27
- * runs idempotence tests on the files in ` ./ tests/target/` . These files should
28
- not be changed by rustfmt;
37
+ * makes sure that rustfmt run on every file in ` rustfmt-core/rustfmt-lib/ tests/source/`
38
+ is equal to its associated file in ` rustfmt-core/rustfmt-lib /tests/target/` ;
39
+ * runs idempotence tests on the files in ` rustfmt-core/rustfmt-lib/ tests/target/` .
40
+ These files should not be changed by rustfmt;
29
41
* checks that rustfmt's code is not changed by running on itself. This ensures
30
42
that the project bootstraps.
31
43
32
- Creating a test is as easy as creating a new file in ` ./tests/source/ ` and an
33
- equally named one in ` ./tests/target/ ` . If it is only required that rustfmt
34
- leaves a piece of code unformatted, it may suffice to only create a target file.
44
+ Creating a test is as easy as creating a new file in
45
+ ` rustfmt-core/rustfmt-lib/tests/source/ ` and an equally named one in
46
+ ` rustfmt-core/rustfmt-lib/tests/target/ ` . If it is only required that rustfmt leaves a
47
+ piece of code unformatted, it may suffice to only create a target file.
35
48
36
49
Whenever there's a discrepancy between the expected output when running tests, a
37
50
colourised diff will be printed so that the offending line(s) can quickly be
0 commit comments