Skip to content

Commit e6e0db1

Browse files
committed
---
yaml --- r: 126963 b: refs/heads/snap-stage3 c: 3ab170f h: refs/heads/master i: 126961: 423a902 126959: 594c483 v: v3
1 parent 4dd9a8d commit e6e0db1

File tree

36 files changed

+1066
-229
lines changed

36 files changed

+1066
-229
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 7be8f0af0393dcdb077c2f6b1653836fd3fba235
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: e841a88b9298b0d1fef93192d8e163b44645fc73
4+
refs/heads/snap-stage3: 3ab170ffc5e45d31eef85db8fd7a3b68764f77c2
55
refs/heads/try: 502e4c045236682e9728539dc0d2b3d0b237f55c
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/compiletest/header.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ pub struct TestProps {
3636
pub no_prefer_dynamic: bool,
3737
// Don't run --pretty expanded when running pretty printing tests
3838
pub no_pretty_expanded: bool,
39+
// Which pretty mode are we testing with, default to 'normal'
40+
pub pretty_mode: String,
41+
// Only compare pretty output and don't try compiling
42+
pub pretty_compare_only: bool,
3943
}
4044

4145
// Load any test directives embedded in the file
@@ -51,6 +55,8 @@ pub fn load_props(testfile: &Path) -> TestProps {
5155
let mut check_stdout = false;
5256
let mut no_prefer_dynamic = false;
5357
let mut no_pretty_expanded = false;
58+
let mut pretty_mode = None;
59+
let mut pretty_compare_only = false;
5460
iter_header(testfile, |ln| {
5561
match parse_error_pattern(ln) {
5662
Some(ep) => error_patterns.push(ep),
@@ -85,6 +91,14 @@ pub fn load_props(testfile: &Path) -> TestProps {
8591
no_pretty_expanded = parse_no_pretty_expanded(ln);
8692
}
8793

94+
if pretty_mode.is_none() {
95+
pretty_mode = parse_pretty_mode(ln);
96+
}
97+
98+
if !pretty_compare_only {
99+
pretty_compare_only = parse_pretty_compare_only(ln);
100+
}
101+
88102
match parse_aux_build(ln) {
89103
Some(ab) => { aux_builds.push(ab); }
90104
None => {}
@@ -115,6 +129,8 @@ pub fn load_props(testfile: &Path) -> TestProps {
115129
check_stdout: check_stdout,
116130
no_prefer_dynamic: no_prefer_dynamic,
117131
no_pretty_expanded: no_pretty_expanded,
132+
pretty_mode: pretty_mode.unwrap_or("normal".to_string()),
133+
pretty_compare_only: pretty_compare_only
118134
}
119135
}
120136

@@ -205,6 +221,14 @@ fn parse_no_pretty_expanded(line: &str) -> bool {
205221
parse_name_directive(line, "no-pretty-expanded")
206222
}
207223

224+
fn parse_pretty_mode(line: &str) -> Option<String> {
225+
parse_name_value_directive(line, "pretty-mode")
226+
}
227+
228+
fn parse_pretty_compare_only(line: &str) -> bool {
229+
parse_name_directive(line, "pretty-compare-only")
230+
}
231+
208232
fn parse_exec_env(line: &str) -> Option<(String, String)> {
209233
parse_name_value_directive(line, "exec-env").map(|nv| {
210234
// nv is either FOO or FOO=BAR

branches/snap-stage3/src/compiletest/runtest.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) {
168168
props,
169169
testfile,
170170
srcs[round].to_string(),
171-
"normal");
171+
props.pretty_mode.as_slice());
172172

173173
if !proc_res.status.success() {
174174
fatal_proc_rec(format!("pretty-printing failed in round {}",
@@ -200,6 +200,9 @@ fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) {
200200

201201
compare_source(expected.as_slice(), actual.as_slice());
202202

203+
// If we're only making sure that the output matches then just stop here
204+
if props.pretty_compare_only { return; }
205+
203206
// Finally, let's make sure it actually appears to remain valid code
204207
let proc_res = typecheck_source(config, props, testfile, actual);
205208

0 commit comments

Comments
 (0)