Skip to content

Commit ae95f32

Browse files
committed
---
yaml --- r: 272753 b: refs/heads/beta c: c761257 h: refs/heads/master i: 272751: 90baa0e
1 parent d6adc79 commit ae95f32

File tree

2 files changed

+65
-63
lines changed

2 files changed

+65
-63
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: 24f0851e670530b48ba0c098044a7fb235847501
26+
refs/heads/beta: c76125742a3d7ab9f6ad9fbaba8174f959adc18b
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/src/compiletest/header.rs

Lines changed: 64 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -54,80 +54,101 @@ pub struct TestProps {
5454

5555
// Load any test directives embedded in the file
5656
pub fn load_props(testfile: &Path) -> TestProps {
57-
let mut error_patterns = Vec::new();
58-
let mut aux_builds = Vec::new();
59-
let mut exec_env = Vec::new();
60-
let mut compile_flags = None;
61-
let mut run_flags = None;
62-
let mut pp_exact = None;
63-
let mut check_lines = Vec::new();
64-
let mut build_aux_docs = false;
65-
let mut force_host = false;
66-
let mut check_stdout = false;
67-
let mut no_prefer_dynamic = false;
68-
let mut pretty_expanded = false;
69-
let mut pretty_mode = None;
70-
let mut pretty_compare_only = false;
71-
let mut forbid_output = Vec::new();
57+
let error_patterns = Vec::new();
58+
let aux_builds = Vec::new();
59+
let exec_env = Vec::new();
60+
let compile_flags = None;
61+
let run_flags = None;
62+
let pp_exact = None;
63+
let check_lines = Vec::new();
64+
let build_aux_docs = false;
65+
let force_host = false;
66+
let check_stdout = false;
67+
let no_prefer_dynamic = false;
68+
let pretty_expanded = false;
69+
let pretty_compare_only = false;
70+
let forbid_output = Vec::new();
71+
let mut props = TestProps {
72+
error_patterns: error_patterns,
73+
compile_flags: compile_flags,
74+
run_flags: run_flags,
75+
pp_exact: pp_exact,
76+
aux_builds: aux_builds,
77+
exec_env: exec_env,
78+
check_lines: check_lines,
79+
build_aux_docs: build_aux_docs,
80+
force_host: force_host,
81+
check_stdout: check_stdout,
82+
no_prefer_dynamic: no_prefer_dynamic,
83+
pretty_expanded: pretty_expanded,
84+
pretty_mode: format!("normal"),
85+
pretty_compare_only: pretty_compare_only,
86+
forbid_output: forbid_output,
87+
};
88+
load_props_into(&mut props, testfile);
89+
props
90+
}
91+
92+
pub fn load_props_into(props: &mut TestProps, testfile: &Path) {
7293
iter_header(testfile, &mut |ln| {
7394
if let Some(ep) = parse_error_pattern(ln) {
74-
error_patterns.push(ep);
95+
props.error_patterns.push(ep);
7596
}
7697

77-
if compile_flags.is_none() {
78-
compile_flags = parse_compile_flags(ln);
98+
if props.compile_flags.is_none() {
99+
props.compile_flags = parse_compile_flags(ln);
79100
}
80101

81-
if run_flags.is_none() {
82-
run_flags = parse_run_flags(ln);
102+
if props.run_flags.is_none() {
103+
props.run_flags = parse_run_flags(ln);
83104
}
84105

85-
if pp_exact.is_none() {
86-
pp_exact = parse_pp_exact(ln, testfile);
106+
if props.pp_exact.is_none() {
107+
props.pp_exact = parse_pp_exact(ln, testfile);
87108
}
88109

89-
if !build_aux_docs {
90-
build_aux_docs = parse_build_aux_docs(ln);
110+
if !props.build_aux_docs {
111+
props.build_aux_docs = parse_build_aux_docs(ln);
91112
}
92113

93-
if !force_host {
94-
force_host = parse_force_host(ln);
114+
if !props.force_host {
115+
props.force_host = parse_force_host(ln);
95116
}
96117

97-
if !check_stdout {
98-
check_stdout = parse_check_stdout(ln);
118+
if !props.check_stdout {
119+
props.check_stdout = parse_check_stdout(ln);
99120
}
100121

101-
if !no_prefer_dynamic {
102-
no_prefer_dynamic = parse_no_prefer_dynamic(ln);
122+
if !props.no_prefer_dynamic {
123+
props.no_prefer_dynamic = parse_no_prefer_dynamic(ln);
103124
}
104125

105-
if !pretty_expanded {
106-
pretty_expanded = parse_pretty_expanded(ln);
126+
if !props.pretty_expanded {
127+
props.pretty_expanded = parse_pretty_expanded(ln);
107128
}
108129

109-
if pretty_mode.is_none() {
110-
pretty_mode = parse_pretty_mode(ln);
130+
if let Some(m) = parse_pretty_mode(ln) {
131+
props.pretty_mode = m;
111132
}
112133

113-
if !pretty_compare_only {
114-
pretty_compare_only = parse_pretty_compare_only(ln);
134+
if !props.pretty_compare_only {
135+
props.pretty_compare_only = parse_pretty_compare_only(ln);
115136
}
116137

117138
if let Some(ab) = parse_aux_build(ln) {
118-
aux_builds.push(ab);
139+
props.aux_builds.push(ab);
119140
}
120141

121142
if let Some(ee) = parse_exec_env(ln) {
122-
exec_env.push(ee);
143+
props.exec_env.push(ee);
123144
}
124145

125146
if let Some(cl) = parse_check_line(ln) {
126-
check_lines.push(cl);
147+
props.check_lines.push(cl);
127148
}
128149

129150
if let Some(of) = parse_forbid_output(ln) {
130-
forbid_output.push(of);
151+
props.forbid_output.push(of);
131152
}
132153

133154
true
@@ -136,30 +157,12 @@ pub fn load_props(testfile: &Path) -> TestProps {
136157
for key in vec!["RUST_TEST_NOCAPTURE", "RUST_TEST_THREADS"] {
137158
match env::var(key) {
138159
Ok(val) =>
139-
if exec_env.iter().find(|&&(ref x, _)| *x == key).is_none() {
140-
exec_env.push((key.to_owned(), val))
160+
if props.exec_env.iter().find(|&&(ref x, _)| *x == key).is_none() {
161+
props.exec_env.push((key.to_owned(), val))
141162
},
142163
Err(..) => {}
143164
}
144165
}
145-
146-
TestProps {
147-
error_patterns: error_patterns,
148-
compile_flags: compile_flags,
149-
run_flags: run_flags,
150-
pp_exact: pp_exact,
151-
aux_builds: aux_builds,
152-
exec_env: exec_env,
153-
check_lines: check_lines,
154-
build_aux_docs: build_aux_docs,
155-
force_host: force_host,
156-
check_stdout: check_stdout,
157-
no_prefer_dynamic: no_prefer_dynamic,
158-
pretty_expanded: pretty_expanded,
159-
pretty_mode: pretty_mode.unwrap_or("normal".to_owned()),
160-
pretty_compare_only: pretty_compare_only,
161-
forbid_output: forbid_output,
162-
}
163166
}
164167

165168
pub fn is_test_ignored(config: &Config, testfile: &Path) -> bool {
@@ -253,8 +256,7 @@ fn iter_header(testfile: &Path, it: &mut FnMut(&str) -> bool) -> bool {
253256
// with a warm page cache. Maybe with a cold one.
254257
let ln = ln.unwrap();
255258
let ln = ln.trim();
256-
if ln.starts_with("fn") ||
257-
ln.starts_with("mod") {
259+
if ln.starts_with("fn") || ln.starts_with("mod") {
258260
return true;
259261
} else if ln.starts_with("//") {
260262
if !it(&ln[2..]) {

0 commit comments

Comments
 (0)