Skip to content

Commit 5b2151e

Browse files
committed
better explanatory comment for the pprust-expr-roundtrip test
1 parent b79dada commit 5b2151e

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/test/run-pass-fulldeps/pprust-expr-roundtrip.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,24 @@
1010

1111
// ignore-cross-compile
1212

13+
14+
// The general idea of this test is to enumerate all "interesting" expressions and check that
15+
// `parse(print(e)) == e` for all `e`. Here's what's interesting, for the purposes of this test:
16+
//
17+
// 1. The test focuses on expression nesting, because interactions between different expression
18+
// types are harder to test manually than single expression types in isolation.
19+
//
20+
// 2. The test only considers expressions of at most two nontrivial nodes. So it will check `x +
21+
// x` and `x + (x - x)` but not `(x * x) + (x - x)`. The assumption here is that the correct
22+
// handling of an expression might depend on the expression's parent, but doesn't depend on its
23+
// siblings or any more distant ancestors.
24+
//
25+
// 3. The test only checks certain expression kinds. The assumption is that similar expression
26+
// types, such as `if` and `while` or `+` and `-`, will be handled identically in the printer
27+
// and parser. So if all combinations of exprs involving `if` work correctly, then combinations
28+
// using `while`, `if let`, and so on will likely work as well.
29+
30+
1331
#![feature(rustc_private)]
1432

1533
extern crate syntax;

0 commit comments

Comments
 (0)