File tree 4 files changed +352
-151
lines changed
src/tools/compiletest/src
4 files changed +352
-151
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ use std::fmt;
13
13
use std:: str:: FromStr ;
14
14
use std:: path:: PathBuf ;
15
15
16
- use test:: ColorConfig ;
16
+ use test:: { ColorConfig , TestPaths } ;
17
17
18
18
#[ derive( Clone , Copy , PartialEq , Debug ) ]
19
19
pub enum Mode {
@@ -221,3 +221,17 @@ pub struct Config {
221
221
pub llvm_cxxflags : String ,
222
222
pub nodejs : Option < String > ,
223
223
}
224
+
225
+ /// Used by `ui` tests to generate things like `foo.stderr` from `foo.rs`.
226
+ pub fn expected_output_path ( testpaths : & TestPaths , revision : Option < & str > , kind : & str ) -> PathBuf {
227
+ assert ! ( UI_EXTENSIONS . contains( & kind) ) ;
228
+ let extension = match revision {
229
+ Some ( r) => format ! ( "{}.{}" , r, kind) ,
230
+ None => kind. to_string ( ) ,
231
+ } ;
232
+ testpaths. file . with_extension ( extension)
233
+ }
234
+
235
+ pub const UI_EXTENSIONS : & [ & str ] = & [ UI_STDERR , UI_STDOUT ] ;
236
+ pub const UI_STDERR : & str = "stderr" ;
237
+ pub const UI_STDOUT : & str = "stdout" ;
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ pub struct EarlyProps {
26
26
pub ignore : bool ,
27
27
pub should_fail : bool ,
28
28
pub aux : Vec < String > ,
29
+ pub revisions : Vec < String > ,
29
30
}
30
31
31
32
impl EarlyProps {
@@ -34,6 +35,7 @@ impl EarlyProps {
34
35
ignore : false ,
35
36
should_fail : false ,
36
37
aux : Vec :: new ( ) ,
38
+ revisions : vec ! [ ] ,
37
39
} ;
38
40
39
41
iter_header ( testfile,
@@ -50,6 +52,10 @@ impl EarlyProps {
50
52
props. aux . push ( s) ;
51
53
}
52
54
55
+ if let Some ( r) = config. parse_revisions ( ln) {
56
+ props. revisions . extend ( r) ;
57
+ }
58
+
53
59
props. should_fail = props. should_fail || config. parse_name_directive ( ln, "should-fail" ) ;
54
60
} ) ;
55
61
You can’t perform that action at this time.
0 commit comments