1
1
use std:: path:: { Path , PathBuf } ;
2
2
3
- use super :: { check_annotations , Comments , Config , Error , Mode , OutputConflictHandling } ;
3
+ use super :: * ;
4
4
5
5
fn config ( ) -> Config {
6
6
Config {
7
7
args : vec ! [ ] ,
8
8
target : None ,
9
9
stderr_filters : vec ! [ ] ,
10
10
stdout_filters : vec ! [ ] ,
11
- root_dir : PathBuf :: from ( ". " ) ,
11
+ root_dir : PathBuf :: from ( "$RUSTROOT " ) ,
12
12
mode : Mode :: Fail ,
13
13
path_filter : vec ! [ ] ,
14
14
program : PathBuf :: from ( "cake" ) ,
@@ -25,10 +25,12 @@ fn main() {
25
25
let _x: &i32 = unsafe { mem::transmute(16usize) }; //~ ERROR encountered a dangling reference (address $HEX is unallocated)
26
26
}
27
27
" ;
28
- let comments = Comments :: parse ( Path :: new ( "<dummy>" ) , s) ;
28
+ let path = Path :: new ( "$DIR/<dummy>" ) ;
29
+ let comments = Comments :: parse ( & path, s) ;
29
30
let mut errors = vec ! [ ] ;
30
31
let config = config ( ) ;
31
- let unnormalized_stderr = r"
32
+ // Crucially, the intended error string *does* appear in this output, as a quote of the comment itself.
33
+ let stderr = br"
32
34
error: Undefined Behavior: type validation failed: encountered a dangling reference (address 0x10 is unallocated)
33
35
--> tests/compile-fail/validity/dangling_ref1.rs:6:29
34
36
|
@@ -42,9 +44,10 @@ LL | let _x: &i32 = unsafe { mem::transmute(16usize) }; //~ ERROR encountere
42
44
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
43
45
error: aborting due to previous error
44
46
" ;
45
- check_annotations ( unnormalized_stderr, & mut errors, & config, "" , & comments) ;
47
+ check_test_result ( & path, & config, "" , "" , & comments, & mut errors, /*stdout*/ br"" , stderr) ;
48
+ // The "OutputDiffers" is because we cannot open the .rs file
46
49
match & errors[ ..] {
47
- [ Error :: PatternNotFound { .. } ] => { }
50
+ [ Error :: OutputDiffers { .. } , Error :: PatternNotFound { .. } ] => { }
48
51
_ => panic ! ( "not the expected error: {:#?}" , errors) ,
49
52
}
50
53
}
0 commit comments