File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -506,11 +506,18 @@ pub fn default_validator(
506506 let actual_snapshot = actual_rows. join ( "\n " ) ;
507507 let fragments: Vec < & str > = expected_snapshot. split ( IGNORE_MARKER ) . collect ( ) ;
508508 let mut pos = 0 ;
509- for frag in fragments {
509+ for ( i , frag) in fragments. iter ( ) . enumerate ( ) {
510510 if frag. is_empty ( ) {
511511 continue ;
512512 }
513513 if let Some ( idx) = actual_snapshot[ pos..] . find ( frag) {
514+ // Edge case: The following example is expected to fail
515+ // Actual - 'foo bar baz'
516+ // Expected - 'bar <slt:ignore>'
517+ if ( i == 0 ) && ( idx != 0 ) {
518+ return false ;
519+ }
520+
514521 pos += idx + frag. len ( ) ;
515522 } else {
516523 tracing:: error!(
@@ -2361,7 +2368,10 @@ Caused by:
23612368 "beta" . to_string( ) ,
23622369 "gamma" . to_string( ) ,
23632370 ] ] ;
2364- let expected = vec ! [ "alpha<slt:ignore>delta" . to_string( ) ] ;
2365- assert ! ( !default_validator( normalizer, & actual, & expected) ) ;
2371+ let expected1 = vec ! [ "alpha<slt:ignore>delta" . to_string( ) ] ;
2372+ assert ! ( !default_validator( normalizer, & actual, & expected1) ) ;
2373+
2374+ let expected2 = vec ! [ "pha<slt:ignore>gamma" . to_string( ) ] ;
2375+ assert ! ( !default_validator( normalizer, & actual, & expected2) ) ;
23662376 }
23672377}
You can’t perform that action at this time.
0 commit comments