about summary refs log tree commit diff
diff options
context:
space:
mode:
authorStuart Pernsteiner <spernsteiner@galois.com>2017-08-14 18:26:55 -0400
committerStuart Pernsteiner <spernsteiner@galois.com>2017-09-06 10:30:00 -0400
commit5b2151ea21c2b1fa517bda90ca881e3f27e9188a (patch)
tree0a2747b28c3c4fe1699658c4d997f1222a2bfbac
parentb79dada4530378fa4cb744b9da922389131840e7 (diff)
downloadrust-5b2151ea21c2b1fa517bda90ca881e3f27e9188a.tar.gz
rust-5b2151ea21c2b1fa517bda90ca881e3f27e9188a.zip
better explanatory comment for the pprust-expr-roundtrip test
-rw-r--r--src/test/run-pass-fulldeps/pprust-expr-roundtrip.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/run-pass-fulldeps/pprust-expr-roundtrip.rs b/src/test/run-pass-fulldeps/pprust-expr-roundtrip.rs
index d614f452b0d..456088b2c52 100644
--- a/src/test/run-pass-fulldeps/pprust-expr-roundtrip.rs
+++ b/src/test/run-pass-fulldeps/pprust-expr-roundtrip.rs
@@ -10,6 +10,24 @@
 
 // ignore-cross-compile
 
+
+// The general idea of this test is to enumerate all "interesting" expressions and check that
+// `parse(print(e)) == e` for all `e`.  Here's what's interesting, for the purposes of this test:
+//
+//  1. The test focuses on expression nesting, because interactions between different expression
+//     types are harder to test manually than single expression types in isolation.
+//
+//  2. The test only considers expressions of at most two nontrivial nodes.  So it will check `x +
+//     x` and `x + (x - x)` but not `(x * x) + (x - x)`.  The assumption here is that the correct
+//     handling of an expression might depend on the expression's parent, but doesn't depend on its
+//     siblings or any more distant ancestors.
+//
+// 3. The test only checks certain expression kinds.  The assumption is that similar expression
+//    types, such as `if` and `while` or `+` and `-`,  will be handled identically in the printer
+//    and parser.  So if all combinations of exprs involving `if` work correctly, then combinations
+//    using `while`, `if let`, and so on will likely work as well.
+
+
 #![feature(rustc_private)]
 
 extern crate syntax;