Skip to content

Commit b117aa5

Browse files
committed
---
yaml --- r: 272796 b: refs/heads/beta c: d3ae29d h: refs/heads/master
1 parent 6a6b692 commit b117aa5

File tree

215 files changed

+1509
-2489
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

215 files changed

+1509
-2489
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: 55bc488db46c656c18c61c56de10446c3572b7d7
26+
refs/heads/beta: d3ae29d9c101a4495d95faa6e2266a04630765f1
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/COMPILER_TESTS.md

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -42,43 +42,3 @@ whole, instead of just a few lines inside the test.
4242
* `ignore-test` always ignores the test
4343
* `ignore-lldb` and `ignore-gdb` will skip the debuginfo tests
4444
* `min-{gdb,lldb}-version`
45-
* `should-fail` indicates that the test should fail; used for "meta testing",
46-
where we test the compiletest program itself to check that it will generate
47-
errors in appropriate scenarios. This header is ignored for pretty-printer tests.
48-
49-
## Revisions
50-
51-
Certain classes of tests support "revisions" (as of the time of this
52-
writing, this includes run-pass, compile-fail, run-fail, and
53-
incremental, though incremental tests are somewhat
54-
different). Revisions allow a single test file to be used for multiple
55-
tests. This is done by adding a special header at the top of the file:
56-
57-
```
58-
// revisions: foo bar baz
59-
```
60-
61-
This will result in the test being compiled (and tested) three times,
62-
once with `--cfg foo`, once with `--cfg bar`, and once with `--cfg
63-
baz`. You can therefore use `#[cfg(foo)]` etc within the test to tweak
64-
each of these results.
65-
66-
You can also customize headers and expected error messages to a particular
67-
revision. To do this, add `[foo]` (or `bar`, `baz`, etc) after the `//`
68-
comment, like so:
69-
70-
```
71-
// A flag to pass in only for cfg `foo`:
72-
//[foo]compile-flags: -Z verbose
73-
74-
#[cfg(foo)]
75-
fn test_foo() {
76-
let x: usize = 32_u32; //[foo]~ ERROR mismatched types
77-
}
78-
```
79-
80-
Note that not all headers have meaning when customized too a revision.
81-
For example, the `ignore-test` header (and all "ignore" headers)
82-
currently only apply to the test as a whole, not to particular
83-
revisions. The only headers that are intended to really work when
84-
customized to a revision are error patterns and compiler flags.

branches/beta/src/compiletest/compiletest.rs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -354,25 +354,11 @@ pub fn is_test(config: &Config, testfile: &Path) -> bool {
354354
}
355355

356356
pub fn make_test(config: &Config, testpaths: &TestPaths) -> test::TestDescAndFn {
357-
let early_props = header::early_props(config, &testpaths.file);
358-
359-
// The `should-fail` annotation doesn't apply to pretty tests,
360-
// since we run the pretty printer across all tests by default.
361-
// If desired, we could add a `should-fail-pretty` annotation.
362-
let should_panic = match config.mode {
363-
Pretty => test::ShouldPanic::No,
364-
_ => if early_props.should_fail {
365-
test::ShouldPanic::Yes
366-
} else {
367-
test::ShouldPanic::No
368-
}
369-
};
370-
371357
test::TestDescAndFn {
372358
desc: test::TestDesc {
373359
name: make_test_name(config, testpaths),
374-
ignore: early_props.ignore,
375-
should_panic: should_panic,
360+
ignore: header::is_test_ignored(config, &testpaths.file),
361+
should_panic: test::ShouldPanic::No,
376362
},
377363
testfn: make_test_closure(config, testpaths),
378364
}

branches/beta/src/compiletest/errors.rs

Lines changed: 20 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,8 @@ enum WhichLine { ThisLine, FollowPrevious(usize), AdjustBackward(usize) }
3030
/// Goal is to enable tests both like: //~^^^ ERROR go up three
3131
/// and also //~^ ERROR message one for the preceding line, and
3232
/// //~| ERROR message two for that same line.
33-
///
34-
/// If cfg is not None (i.e., in an incremental test), then we look
35-
/// for `//[X]~` instead, where `X` is the current `cfg`.
36-
pub fn load_errors(testfile: &Path, cfg: Option<&str>) -> Vec<ExpectedError> {
33+
// Load any test directives embedded in the file
34+
pub fn load_errors(testfile: &Path) -> Vec<ExpectedError> {
3735
let rdr = BufReader::new(File::open(testfile).unwrap());
3836

3937
// `last_nonfollow_error` tracks the most recently seen
@@ -46,41 +44,30 @@ pub fn load_errors(testfile: &Path, cfg: Option<&str>) -> Vec<ExpectedError> {
4644
// updating it in the map callback below.)
4745
let mut last_nonfollow_error = None;
4846

49-
let tag = match cfg {
50-
Some(rev) => format!("//[{}]~", rev),
51-
None => format!("//~")
52-
};
53-
54-
rdr.lines()
55-
.enumerate()
56-
.filter_map(|(line_no, ln)| {
57-
parse_expected(last_nonfollow_error,
58-
line_no + 1,
59-
&ln.unwrap(),
60-
&tag)
61-
.map(|(which, error)| {
62-
match which {
63-
FollowPrevious(_) => {}
64-
_ => last_nonfollow_error = Some(error.line),
65-
}
66-
error
67-
})
68-
})
69-
.collect()
47+
rdr.lines().enumerate().filter_map(|(line_no, ln)| {
48+
parse_expected(last_nonfollow_error,
49+
line_no + 1,
50+
&ln.unwrap())
51+
.map(|(which, error)| {
52+
match which {
53+
FollowPrevious(_) => {}
54+
_ => last_nonfollow_error = Some(error.line),
55+
}
56+
error
57+
})
58+
}).collect()
7059
}
7160

7261
fn parse_expected(last_nonfollow_error: Option<usize>,
7362
line_num: usize,
74-
line: &str,
75-
tag: &str)
76-
-> Option<(WhichLine, ExpectedError)> {
77-
let start = match line.find(tag) { Some(i) => i, None => return None };
78-
let (follow, adjusts) = if line.char_at(start + tag.len()) == '|' {
63+
line: &str) -> Option<(WhichLine, ExpectedError)> {
64+
let start = match line.find("//~") { Some(i) => i, None => return None };
65+
let (follow, adjusts) = if line.char_at(start + 3) == '|' {
7966
(true, 0)
8067
} else {
81-
(false, line[start + tag.len()..].chars().take_while(|c| *c == '^').count())
68+
(false, line[start + 3..].chars().take_while(|c| *c == '^').count())
8269
};
83-
let kind_start = start + tag.len() + adjusts + (follow as usize);
70+
let kind_start = start + 3 + adjusts + (follow as usize);
8471
let letters = line[kind_start..].chars();
8572
let kind = letters.skip_while(|c| c.is_whitespace())
8673
.take_while(|c| !c.is_whitespace())
@@ -104,9 +91,7 @@ fn parse_expected(last_nonfollow_error: Option<usize>,
10491
(which, line)
10592
};
10693

107-
debug!("line={} tag={:?} which={:?} kind={:?} msg={:?}",
108-
line_num, tag, which, kind, msg);
109-
94+
debug!("line={} which={:?} kind={:?} msg={:?}", line_num, which, kind, msg);
11095
Some((which, ExpectedError { line: line,
11196
kind: kind,
11297
msg: msg, }))

0 commit comments

Comments
 (0)