1 string expected = "line1\nline2\nline3"; 2 {// Mismatch in line 2 } 3 string actual = "line1\nlin2\nline3"; 4 auto res = expectationMismatch(expected, actual); 5 assert("Mismatch in line 2\nExpected: line2\n Actual: lin2" == res); 6 } 7 {// Too short 8 string actual = "line1"; 9 auto res = expectationMismatch(expected, actual); 10 assert("Expected 3 lines (got 1)" == res); 11 } 12 {// Too long 13 string actual = "line1\nline2\nline3\nline4"; 14 auto res = expectationMismatch(expected, actual); 15 assert("Expected 3 lines (got 4)" == res); 16 }
Pretty printing of mismatches in regression tests