@@ -9,6 +9,22 @@ on issues, or file new issues specifically to get help.
99All contributors are expected to follow our [ Code of
1010Conduct] ( CODE_OF_CONDUCT.md ) .
1111
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+
1228## Test and file issues
1329
1430It 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.
2036Having a strong test suite for a tool like this is essential. It is very easy
2137to create regressions. Any tests you can add are very much appreciated.
2238
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:
2440* 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;
2945* checks that rustfmt's code is not changed by running on itself. This ensures
3046 that the project bootstraps.
3147
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.
3552
3653Whenever there's a discrepancy between the expected output when running tests, a
3754colourised diff will be printed so that the offending line(s) can quickly be
0 commit comments