You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wish to test against a file with the line endings as CRLF, using expect_file
When I use UPDATE_EXPECT, the test passes, but if I then re-run the test, it fails, with no highlighted error characters.
The text was updated successfully, but these errors were encountered:
Do you mean that the value which you are testing is a string containing a CRLF? In other words something like
use expect_test::expect;#[test]fnfoo(){let actual = "foo\r\n";let expected = expect![[r#" foo"#]];
expected.assert_eq(&actual);}
? Rust normalizes all strings from CRLF to LF, so expect_test will think that the test expectation is meant to use LF even if the source file contains CRLF. This then results in a mismatch between the actual (CRLF line endings) and expected (LF line endings) value. You can use .assert_debug_eq() instead of .assert_eq() to make the line endings get rendered as \r\n in the test expectation to avoid this normalization:
use expect_test::expect;#[test]fnfoo(){let actual = "foo\r\n";let expected = expect![[r#" "foo\r\n" "#]];
expected.assert_debug_eq(&actual);}
I wish to test against a file with the line endings as CRLF, using expect_file
When I use UPDATE_EXPECT, the test passes, but if I then re-run the test, it fails, with no highlighted error characters.
The text was updated successfully, but these errors were encountered: