@@ -9,6 +9,22 @@ 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. The
19
+ project supports [ cargo-make] ( https://github.com/sagiegurari/cargo-make ) which
20
+ automatically sets these variables for you:
21
+
22
+ ```
23
+ cargo +nightly make test
24
+ ```
25
+
26
+ The available tasks are listed in ` Makefile.toml ` .
27
+
12
28
## Test and file issues
13
29
14
30
It would be really useful to have people use rustfmt on their projects and file
@@ -20,18 +36,19 @@ issues where it does something you don't expect.
20
36
Having a strong test suite for a tool like this is essential. It is very easy
21
37
to create regressions. Any tests you can add are very much appreciated.
22
38
23
- The tests can be run with ` cargo test ` . This does a number of things:
39
+ The tests can be run with ` cargo make test ` . This does a number of things:
24
40
* 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;
41
+ * makes sure that rustfmt run on every file in ` rustfmt-core/rustfmt-lib/ tests/source/`
42
+ is equal to its associated file in ` rustfmt-core/rustfmt-lib /tests/target/` ;
43
+ * runs idempotence tests on the files in ` rustfmt-core/rustfmt-lib/ tests/target/` .
44
+ These files should not be changed by rustfmt;
29
45
* checks that rustfmt's code is not changed by running on itself. This ensures
30
46
that the project bootstraps.
31
47
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.
48
+ Creating a test is as easy as creating a new file in
49
+ ` rustfmt-core/rustfmt-lib/tests/source/ ` and an equally named one in
50
+ ` rustfmt-core/rustfmt-lib/tests/target/ ` . If it is only required that rustfmt leaves a
51
+ piece of code unformatted, it may suffice to only create a target file.
35
52
36
53
Whenever there's a discrepancy between the expected output when running tests, a
37
54
colourised diff will be printed so that the offending line(s) can quickly be
0 commit comments