File tree Expand file tree Collapse file tree 2 files changed +15
-12
lines changed Expand file tree Collapse file tree 2 files changed +15
-12
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,8 @@ use chalk_solve::ext::*;
8
8
use chalk_solve:: RustIrDatabase ;
9
9
use chalk_solve:: { Solution , SolverChoice } ;
10
10
11
+ use crate :: test_util:: assert_same;
12
+
11
13
#[ cfg( feature = "bench" ) ]
12
14
mod bench;
13
15
mod coherence;
@@ -32,15 +34,6 @@ fn assert_result(mut result: Option<Solution<ChalkIr>>, expected: &str) {
32
34
assert_same ( & result, expected) ;
33
35
}
34
36
35
- fn assert_same ( result : & str , expected : & str ) {
36
- println ! ( "expected:\n {}" , expected) ;
37
- println ! ( "actual:\n {}" , result) ;
38
-
39
- let expected1: String = expected. chars ( ) . filter ( |w| !w. is_whitespace ( ) ) . collect ( ) ;
40
- let result1: String = result. chars ( ) . filter ( |w| !w. is_whitespace ( ) ) . collect ( ) ;
41
- assert ! ( !expected1. is_empty( ) && result1. starts_with( & expected1) ) ;
42
- }
43
-
44
37
// different goals
45
38
enum TestGoal {
46
39
// solver should produce same aggregated single solution
Original file line number Diff line number Diff line change @@ -27,8 +27,18 @@ macro_rules! lowering_error {
27
27
chalk_solve:: SolverChoice :: default ( ) ,
28
28
)
29
29
. checked_program( )
30
- . unwrap_err( ) ;
31
- let expected = $expected;
32
- assert_eq!( error. to_string( ) , expected. to_string( ) ) ;
30
+ . unwrap_err( )
31
+ . to_string( ) ;
32
+ let expected = $expected. to_string( ) ;
33
+ crate :: test_util:: assert_same( & error, & expected) ;
33
34
} ;
34
35
}
36
+
37
+ pub fn assert_same ( result : & str , expected : & str ) {
38
+ println ! ( "expected:\n {}" , expected) ;
39
+ println ! ( "actual:\n {}" , result) ;
40
+
41
+ let expected1: String = expected. chars ( ) . filter ( |w| !w. is_whitespace ( ) ) . collect ( ) ;
42
+ let result1: String = result. chars ( ) . filter ( |w| !w. is_whitespace ( ) ) . collect ( ) ;
43
+ assert ! ( !expected1. is_empty( ) && result1. starts_with( & expected1) ) ;
44
+ }
You can’t perform that action at this time.
0 commit comments