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::*;
88use chalk_solve:: RustIrDatabase ;
99use chalk_solve:: { Solution , SolverChoice } ;
1010
11+ use crate :: test_util:: assert_same;
12+
1113#[ cfg( feature = "bench" ) ]
1214mod bench;
1315mod coherence;
@@ -32,15 +34,6 @@ fn assert_result(mut result: Option<Solution<ChalkIr>>, expected: &str) {
3234 assert_same ( & result, expected) ;
3335}
3436
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-
4437// different goals
4538enum TestGoal {
4639 // 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 {
2727 chalk_solve:: SolverChoice :: default ( ) ,
2828 )
2929 . 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) ;
3334 } ;
3435}
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