diff --git a/examples/colored_diffs.png b/examples/colored_diffs.png index 11cc179..7087e31 100644 Binary files a/examples/colored_diffs.png and b/examples/colored_diffs.png differ diff --git a/src/bigdecimal/tests.rs b/src/bigdecimal/tests.rs index 8f4e80d..c56ecc9 100644 --- a/src/bigdecimal/tests.rs +++ b/src/bigdecimal/tests.rs @@ -27,7 +27,7 @@ fn verify_bigdecimal_is_equal_to_other_fails() { assert_eq!( failures, &[ - r"assertion failed: expected subject to be equal to BigDecimal(sign=Minus, scale=3, digits=[42831]) + r"expected subject to be equal to BigDecimal(sign=Minus, scale=3, digits=[42831]) but was: BigDecimal(sign=Plus, scale=3, digits=[42831]) expected: BigDecimal(sign=Minus, scale=3, digits=[42831]) " @@ -181,7 +181,7 @@ fn verify_bigdecimalref_is_equal_to_other_fails() { assert_eq!( failures, &[ - r"assertion failed: expected subject to be equal to BigDecimalRef { sign: Minus, digits: 42831, scale: 3 } + r"expected subject to be equal to BigDecimalRef { sign: Minus, digits: 42831, scale: 3 } but was: BigDecimalRef { sign: Plus, digits: 42831, scale: 3 } expected: BigDecimalRef { sign: Minus, digits: 42831, scale: 3 } " @@ -264,12 +264,10 @@ fn verify_bigdecimal_has_precision_of_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected subject to have a precision of 7 + &[r"expected subject to have a precision of 7 but was: 9 expected: 7 -" - ] +"] ); } @@ -299,7 +297,7 @@ fn verify_bigdecimal_has_scale_of_fails() { assert_eq!( failures, - &[r"assertion failed: expected subject to have a scale of 5 + &[r"expected subject to have a scale of 5 but was: 2 expected: 5 "] @@ -335,7 +333,7 @@ fn verify_bigdecimal_is_integer_fails() { assert_eq!( failures, - &[r"assertion failed: expected subject to be an integer value + &[r"expected subject to be an integer value but was: BigDecimal(sign=Plus, scale=2, digits=[420810]) expected: an integer value "] diff --git a/src/boolean/tests.rs b/src/boolean/tests.rs index e9d15c7..afa9bd7 100644 --- a/src/boolean/tests.rs +++ b/src/boolean/tests.rs @@ -23,12 +23,10 @@ fn verify_bool_is_not_equal_to_false_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to be not equal to false + &[r"expected my_thing to be not equal to false but was: false expected: not false -" - ] +"] ); } @@ -49,7 +47,7 @@ fn verify_bool_is_true_fails() { .named("my_thing") .is_true() .display_failures(), - &[r"assertion failed: expected my_thing to be true + &[r"expected my_thing to be true but was: false expected: true "] @@ -65,7 +63,7 @@ fn verify_bool_is_false_fails() { assert_eq!( failures, - &[r"assertion failed: expected my_thing to be false + &[r"expected my_thing to be false but was: true expected: false "] @@ -85,7 +83,7 @@ mod colored { assert_eq!( failures, - &["assertion failed: expected subject to be true\n \ + &["expected subject to be true\n \ but was: \u{1b}[31mfalse\u{1b}[0m\n \ expected: \u{1b}[32mtrue\u{1b}[0m\n\ "] @@ -101,7 +99,7 @@ mod colored { assert_eq!( failures, - &["assertion failed: expected subject to be false\n \ + &["expected subject to be false\n \ but was: \u{1b}[31mtrue\u{1b}[0m\n \ expected: \u{1b}[33mfalse\u{1b}[0m\n\ "] diff --git a/src/char/tests.rs b/src/char/tests.rs index 9bbe2f0..8899b35 100644 --- a/src/char/tests.rs +++ b/src/char/tests.rs @@ -12,7 +12,7 @@ fn verify_char_is_lowercase_fails() { assert_eq!( failures, - &[r"assertion failed: expected subject to be lowercase + &[r"expected subject to be lowercase but was: M expected: m "] @@ -30,7 +30,7 @@ fn verify_borrowed_char_is_lowercase_fails() { assert_eq!( failures, - &[r"assertion failed: expected subject to be lowercase + &[r"expected subject to be lowercase but was: M expected: m "] @@ -48,7 +48,7 @@ fn verify_char_is_uppercase_fails() { assert_eq!( failures, - &[r"assertion failed: expected subject to be uppercase + &[r"expected subject to be uppercase but was: k expected: K "] @@ -66,7 +66,7 @@ fn verify_borrowed_char_is_uppercase_fails() { assert_eq!( failures, - &[r"assertion failed: expected subject to be uppercase + &[r"expected subject to be uppercase but was: x expected: X "] @@ -84,12 +84,10 @@ fn verify_char_is_ascii_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected subject to be an ASCII character + &[r"expected subject to be an ASCII character but was: € expected: an ASCII character -" - ] +"] ); } @@ -104,12 +102,10 @@ fn verify_borrowed_char_is_ascii_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected subject to be an ASCII character + &[r"expected subject to be an ASCII character but was: ❤ expected: an ASCII character -" - ] +"] ); } @@ -124,12 +120,10 @@ fn verify_char_is_alphabetic_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected subject to be an alphabetic character + &[r"expected subject to be an alphabetic character but was: 1 expected: an alphabetic character -" - ] +"] ); } @@ -144,12 +138,10 @@ fn verify_borrowed_char_is_alphabetic_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected subject to be an alphabetic character + &[r"expected subject to be an alphabetic character but was: @ expected: an alphabetic character -" - ] +"] ); } @@ -165,12 +157,10 @@ fn verify_char_is_alphanumeric_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected subject to be an alphanumeric character + &[r"expected subject to be an alphanumeric character but was: @ expected: an alphanumeric character -" - ] +"] ); } @@ -186,12 +176,10 @@ fn verify_borrowed_char_is_alphanumeric_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected subject to be an alphanumeric character + &[r"expected subject to be an alphanumeric character but was: + expected: an alphanumeric character -" - ] +"] ); } @@ -206,12 +194,10 @@ fn verify_char_is_control_char_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected subject to be a control character + &[r"expected subject to be a control character but was: [ expected: a control character -" - ] +"] ); } @@ -226,12 +212,10 @@ fn verify_borrowed_char_is_control_char_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected subject to be a control character + &[r"expected subject to be a control character but was: @ expected: a control character -" - ] +"] ); } @@ -246,12 +230,10 @@ fn verify_char_is_digit_in_radix_10_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected subject to be a digit in the radix 10 + &[r"expected subject to be a digit in the radix 10 but was: A expected: a digit in the radix 10 -" - ] +"] ); } @@ -266,12 +248,10 @@ fn verify_borrowed_char_is_digit_in_radix_10_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected subject to be a digit in the radix 10 + &[r"expected subject to be a digit in the radix 10 but was: F expected: a digit in the radix 10 -" - ] +"] ); } @@ -286,12 +266,10 @@ fn verify_char_is_digit_in_radix_16_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected subject to be a digit in the radix 16 + &[r"expected subject to be a digit in the radix 16 but was: G expected: a digit in the radix 16 -" - ] +"] ); } @@ -306,12 +284,10 @@ fn verify_borrowed_char_is_digit_in_radix_16_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected subject to be a digit in the radix 16 + &[r"expected subject to be a digit in the radix 16 but was: g expected: a digit in the radix 16 -" - ] +"] ); } @@ -326,12 +302,10 @@ fn verify_char_is_digit_in_radix_7_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected subject to be a digit in the radix 7 + &[r"expected subject to be a digit in the radix 7 but was: 7 expected: a digit in the radix 7 -" - ] +"] ); } @@ -346,12 +320,10 @@ fn verify_borrowed_char_is_digit_in_radix_7_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected subject to be a digit in the radix 7 + &[r"expected subject to be a digit in the radix 7 but was: 9 expected: a digit in the radix 7 -" - ] +"] ); } @@ -366,7 +338,7 @@ fn verify_char_is_whitespace_fails() { assert_eq!( failures, - &[r"assertion failed: expected subject to be whitespace + &[r"expected subject to be whitespace but was: _ expected: whitespace "] @@ -384,7 +356,7 @@ fn verify_borrowed_char_is_whitespace_fails() { assert_eq!( failures, - &[r"assertion failed: expected subject to be whitespace + &[r"expected subject to be whitespace but was: = expected: whitespace "] diff --git a/src/colored/tests.rs b/src/colored/tests.rs index a45c53e..83226f1 100644 --- a/src/colored/tests.rs +++ b/src/colored/tests.rs @@ -60,7 +60,7 @@ mod with_colored_feature { .display_failures(); assert_eq!(failures, &[ - "assertion failed: expected subject to be equal to Some(Foo { lorem: \"Hello World!\", ipsum: 42, dolor: Some(\"hey ho!\") })\n \ + "expected subject to be equal to Some(Foo { lorem: \"Hello World!\", ipsum: 42, dolor: Some(\"hey ho!\") })\n \ but was: Some(Foo { lorem: \"\u{1b}[31m¡\u{1b}[0mH\u{1b}[31mo\u{1b}[0ml\u{1b}[31ma,\u{1b}[0m W\u{1b}[31me\u{1b}[0ml\u{1b}[31mt\u{1b}[0m!\", ipsum: 42, dolor: Some(\"hey\") })\n \ expected: Some(Foo { lorem: \"H\u{1b}[32me\u{1b}[0ml\u{1b}[32mlo\u{1b}[0m W\u{1b}[32mor\u{1b}[0ml\u{1b}[32md\u{1b}[0m!\", ipsum: 42, dolor: Some(\"hey\u{1b}[32m ho!\u{1b}[0m\") })\n\ ", diff --git a/src/error/tests.rs b/src/error/tests.rs index 8681f8e..0155b2f 100644 --- a/src/error/tests.rs +++ b/src/error/tests.rs @@ -59,7 +59,7 @@ fn verify_error_has_debug_message_fails() { assert_eq!( failures, &[ - r#"assertion failed: expected subject to have debug message "SuperError { source: Bar }" + r#"expected subject to have debug message "SuperError { source: Bar }" but was: SuperError { source: Foo } expected: SuperError { source: Bar } "# @@ -89,7 +89,7 @@ fn verify_error_does_not_have_debug_message_fails() { assert_eq!( failures, &[ - r#"assertion failed: expected subject to not have debug message "SuperError { source: Bar }" + r#"expected subject to not have debug message "SuperError { source: Bar }" but was: SuperError { source: Bar } expected: not SuperError { source: Bar } "# @@ -119,7 +119,7 @@ fn verify_error_has_display_message_fails() { assert_eq!( failures, &[ - r#"assertion failed: expected subject to have display message "super-error caused by bar error" + r#"expected subject to have display message "super-error caused by bar error" but was: "super-error caused by foo error" expected: "super-error caused by bar error" "# @@ -149,7 +149,7 @@ fn verify_error_does_not_have_display_message_fails() { assert_eq!( failures, &[ - r#"assertion failed: expected subject to not have display message "super-error caused by foo error" + r#"expected subject to not have display message "super-error caused by foo error" but was: "super-error caused by foo error" expected: not "super-error caused by foo error" "# @@ -177,7 +177,7 @@ fn verify_error_has_no_source_fails() { assert_eq!( failures, - &[r"assertion failed: expected my error to have no source + &[r"expected my error to have no source but was: SuperError { source: Foo } expected: "] @@ -204,7 +204,7 @@ fn verify_error_has_source_fails() { assert_eq!( failures, - &[r"assertion failed: expected my error to have a source + &[r"expected my error to have a source but was: Bar expected: "] @@ -234,7 +234,7 @@ fn verify_error_has_source_message_fails_wrong_source() { assert_eq!( failures, &[ - r#"assertion failed: expected my error to have a source message equal to "foo error" + r#"expected my error to have a source message equal to "foo error" but was: "bar error" expected: "foo error" "# @@ -254,7 +254,7 @@ fn verify_error_has_source_message_fails_error_without_source() { assert_eq!( failures, &[ - r#"assertion failed: expected my error to have a source message equal to "foo error" + r#"expected my error to have a source message equal to "foo error" but was: Foo - which has no source expected: "foo error" "# @@ -292,7 +292,7 @@ mod colored { assert_eq!( failures, - &["assertion failed: expected subject to have no source\n \ + &["expected subject to have no source\n \ but was: \u{1b}[31mSuperError { source: Foo }\u{1b}[0m\n \ expected: \u{1b}[33m\u{1b}[0m\n\ "] @@ -310,7 +310,7 @@ mod colored { assert_eq!( failures, - &["assertion failed: expected subject to have a source\n \ + &["expected subject to have a source\n \ but was: \u{1b}[31mFoo\u{1b}[0m\n \ expected: \u{1b}[33m\u{1b}[0m\n\ "] @@ -331,7 +331,7 @@ mod colored { assert_eq!( failures, &[ - "assertion failed: expected subject to have a source message equal to \"foo error\"\n \ + "expected subject to have a source message equal to \"foo error\"\n \ but was: \"\u{1b}[31mbar error\u{1b}[0m\"\n \ expected: \"\u{1b}[33mfoo error\u{1b}[0m\"\n\ " @@ -351,7 +351,7 @@ mod colored { assert_eq!( failures, &[ - "assertion failed: expected subject to have a source message equal to \"foo error\"\n \ + "expected subject to have a source message equal to \"foo error\"\n \ but was: \u{1b}[31mFoo\u{1b}[0m - which has no source\n \ expected: \u{1b}[33m\"foo error\"\u{1b}[0m\n\ " diff --git a/src/expectation_combinators/tests.rs b/src/expectation_combinators/tests.rs index a5e5095..82e8f4b 100644 --- a/src/expectation_combinators/tests.rs +++ b/src/expectation_combinators/tests.rs @@ -80,7 +80,7 @@ fn verify_all_combinator_asserts_2_expectations_fails() { assert_eq!( failures, - &["assertion failed: expected subject to be negative\n \ + &["expected subject to be negative\n \ but was: 42\n \ expected: < 0\n\ expected subject to be zero\n \ @@ -115,7 +115,7 @@ fn verify_all_combinator_asserts_3_expectations_fails() { assert_eq!( failures, - &["assertion failed: expected subject to be positive\n \ + &["expected subject to be positive\n \ but was: -42\n \ expected: > 0\n\ expected subject to be between 41 and 43\n \ @@ -152,7 +152,7 @@ fn verify_all_combinator_asserts_4_expectations_fails() { assert_eq!( failures, - &["assertion failed: expected subject to be positive\n \ + &["expected subject to be positive\n \ but was: -42\n \ expected: > 0\n\ expected subject to be greater than 2\n \ @@ -255,12 +255,10 @@ fn verify_any_combinator_asserts_1_expectations_fails() { assert_eq!( failures, - &[ - "assertion failed: expected subject to contain \"fugiaty\"\n \ + &["expected subject to contain \"fugiaty\"\n \ but was: \"nulla elit fugiat reprehenderit\"\n \ expected: \"fugiaty\"\n\ - \n" - ] + \n"] ); } @@ -291,15 +289,13 @@ fn verify_any_combinator_asserts_2_expectations_fails() { assert_eq!( failures, - &[ - "assertion failed: expected subject to contain \"fugiaty\"\n \ + &["expected subject to contain \"fugiaty\"\n \ but was: \"nulla elit fugiat reprehenderit\"\n \ expected: \"fugiaty\"\n\ expected subject to contain \"ellit\"\n \ but was: \"nulla elit fugiat reprehenderit\"\n \ expected: \"ellit\"\n\ - \n" - ] + \n"] ); } @@ -336,8 +332,7 @@ fn verify_any_combinator_asserts_3_expectations_fails() { assert_eq!( failures, - &[ - "assertion failed: expected subject to contain \"fugiaty\"\n \ + &["expected subject to contain \"fugiaty\"\n \ but was: \"nulla elit fugiat reprehenderit\"\n \ expected: \"fugiaty\"\n\ expected subject to contain \"ellit\"\n \ @@ -346,8 +341,7 @@ fn verify_any_combinator_asserts_3_expectations_fails() { expected subject to contain any of ['x', 'y', 'z']\n \ but was: \"nulla elit fugiat reprehenderit\"\n \ expected: ['x', 'y', 'z']\n\ - \n" - ] + \n"] ); } diff --git a/src/float/tests.rs b/src/float/tests.rs index 326a2f2..76e15fe 100644 --- a/src/float/tests.rs +++ b/src/float/tests.rs @@ -35,7 +35,7 @@ fn verify_f64_is_negative_fails() { assert_eq!( failures, - &[r"assertion failed: expected some_number to be negative + &[r"expected some_number to be negative but was: 0.0 expected: < 0 "] @@ -79,7 +79,7 @@ fn verify_f64_is_not_negative_fails() { assert_eq!( failures, - &[r"assertion failed: expected some_number to be not negative + &[r"expected some_number to be not negative but was: -0.001 expected: >= 0 "] @@ -119,7 +119,7 @@ fn verify_f64_is_positive_fails() { assert_eq!( failures, - &[r"assertion failed: expected some_number to be positive + &[r"expected some_number to be positive but was: 0.0 expected: > 0 "] @@ -163,7 +163,7 @@ fn verify_f64_is_not_positive_fails() { assert_eq!( failures, - &[r"assertion failed: expected some_number to be not positive + &[r"expected some_number to be not positive but was: 0.001 expected: <= 0 "] @@ -199,7 +199,7 @@ fn verify_f64_is_zero_fails() { assert_eq!( failures, - &[r"assertion failed: expected some_number to be zero + &[r"expected some_number to be zero but was: 1.0 expected: 0.0 "] @@ -235,7 +235,7 @@ fn verify_f64_is_one_fails() { assert_eq!( failures, - &[r"assertion failed: expected some_number to be one + &[r"expected some_number to be one but was: 0.0 expected: 1.0 "] @@ -285,7 +285,7 @@ fn verify_f64_is_finite_fails() { assert_eq!( failures, - &[r"assertion failed: expected some_number to be finite + &[r"expected some_number to be finite but was: -inf expected: a finite number "] @@ -320,7 +320,7 @@ fn verify_f64_is_infinite_fails() { assert_eq!( failures, - &[r"assertion failed: expected some_number to be infinite + &[r"expected some_number to be infinite but was: 0.0 expected: an infinite number "] @@ -374,7 +374,7 @@ fn verify_f64_is_a_number_fails() { assert_eq!( failures, - &[r"assertion failed: expected some_number to be a number + &[r"expected some_number to be a number but was: NaN expected: a number "] @@ -395,7 +395,7 @@ fn verify_f32_is_not_a_number_fails() { assert_eq!( failures, - &[r"assertion failed: expected some_number to be not a number + &[r"expected some_number to be not a number but was: 0.0 expected: NaN "] @@ -427,7 +427,7 @@ fn verify_f64_is_not_a_number_fails() { assert_eq!( failures, - &[r"assertion failed: expected some_number to be not a number + &[r"expected some_number to be not a number but was: 0.0 expected: NaN "] @@ -452,7 +452,7 @@ mod cmp { assert_eq!( failures, - &[r"assertion failed: expected tau / 2 to be close to 3.15 + &[r"expected tau / 2 to be close to 3.15 within a margin of epsilon=4.7683716e-7 and ulps=4 but was: 3.14 expected: 3.15 @@ -474,7 +474,7 @@ mod cmp { assert_eq!( failures, - &[r"assertion failed: expected tau / 2 to be not close to 3.14 + &[r"expected tau / 2 to be not close to 3.14 within a margin of epsilon=4.7683716e-7 and ulps=4 but was: 3.14 expected: 3.14 @@ -496,7 +496,7 @@ mod cmp { assert_eq!( failures, - &[r"assertion failed: expected tau / 2 to be close to 3.15 + &[r"expected tau / 2 to be close to 3.15 within a margin of epsilon=2.3841858e-7 and ulps=3 but was: 3.14 expected: 3.15 @@ -518,7 +518,7 @@ mod cmp { assert_eq!( failures, - &[r"assertion failed: expected tau / 2 to be not close to 3.14 + &[r"expected tau / 2 to be not close to 3.14 within a margin of epsilon=2.3841858e-7 and ulps=3 but was: 3.14 expected: 3.14 @@ -540,7 +540,7 @@ mod cmp { assert_eq!( failures, - &[r"assertion failed: expected tau / 2 to be close to 3.15 + &[r"expected tau / 2 to be close to 3.15 within a margin of epsilon=8.881784197001252e-16 and ulps=4 but was: 3.14 expected: 3.15 @@ -562,7 +562,7 @@ mod cmp { assert_eq!( failures, - &[r"assertion failed: expected tau / 2 to be not close to 3.14 + &[r"expected tau / 2 to be not close to 3.14 within a margin of epsilon=8.881784197001252e-16 and ulps=4 but was: 3.14 expected: 3.14 @@ -584,7 +584,7 @@ mod cmp { assert_eq!( failures, - &[r"assertion failed: expected tau / 2 to be close to 3.15 + &[r"expected tau / 2 to be close to 3.15 within a margin of epsilon=4.440892098500626e-16 and ulps=3 but was: 3.14 expected: 3.15 @@ -606,7 +606,7 @@ mod cmp { assert_eq!( failures, - &[r"assertion failed: expected tau / 2 to be not close to 3.14 + &[r"expected tau / 2 to be not close to 3.14 within a margin of epsilon=4.440892098500626e-16 and ulps=3 but was: 3.14 expected: 3.14 @@ -627,13 +627,11 @@ mod cmp { assert_eq!( failures, - &[ - "assertion failed: expected subject to be close to 3.15148\n \ + &["expected subject to be close to 3.15148\n \ within a margin of epsilon=2.3841858e-7 and ulps=3\n \ but was: 3.1\u{1b}[31m41\u{1b}[0m5\u{1b}[31m9\u{1b}[0m\n \ expected: 3.15\u{1b}[34m148\u{1b}[0m\n\ - " - ] + "] ); } @@ -646,13 +644,11 @@ mod cmp { assert_eq!( failures, - &[ - "assertion failed: expected subject to be close to 3.15148\n \ + &["expected subject to be close to 3.15148\n \ within a margin of epsilon=4.440892098500626e-16 and ulps=3\n \ but was: 3.1\u{1b}[31m41\u{1b}[0m5\u{1b}[31m9\u{1b}[0m\n \ expected: 3.15\u{1b}[34m148\u{1b}[0m\n\ - " - ] + "] ); } } diff --git a/src/integer/tests.rs b/src/integer/tests.rs index 6c87666..e4df857 100644 --- a/src/integer/tests.rs +++ b/src/integer/tests.rs @@ -37,7 +37,7 @@ fn verify_i32_is_equal_to_i32_fails() { assert_eq!( failures, - &[r"assertion failed: expected my_thing to be equal to -42 + &[r"expected my_thing to be equal to -42 but was: 42 expected: -42 "] @@ -101,7 +101,7 @@ fn verify_i32_is_negative_fails() { assert_eq!( failures, - &[r"assertion failed: expected some_number to be negative + &[r"expected some_number to be negative but was: 0 expected: < 0 "] @@ -173,7 +173,7 @@ fn verify_i32_is_not_negative_fails() { assert_eq!( failures, - &[r"assertion failed: expected some_number to be not negative + &[r"expected some_number to be not negative but was: -1 expected: >= 0 "] @@ -237,7 +237,7 @@ fn verify_i32_is_positive_fails() { assert_eq!( failures, - &[r"assertion failed: expected some_number to be positive + &[r"expected some_number to be positive but was: 0 expected: > 0 "] @@ -309,7 +309,7 @@ fn verify_i32_is_not_positive_fails() { assert_eq!( failures, - &[r"assertion failed: expected some_number to be not positive + &[r"expected some_number to be not positive but was: 1 expected: <= 0 "] @@ -390,7 +390,7 @@ fn verify_u64_is_zero_fails() { assert_eq!( failures, - &[r"assertion failed: expected some_number to be zero + &[r"expected some_number to be zero but was: 1 expected: 0 "] @@ -471,7 +471,7 @@ fn verify_u64_is_one_fails() { assert_eq!( failures, - &[r"assertion failed: expected some_number to be one + &[r"expected some_number to be one but was: 0 expected: 1 "] @@ -491,7 +491,7 @@ mod colored { assert_eq!( failures, - &["assertion failed: expected subject to be equal to 42\n \ + &["expected subject to be equal to 42\n \ but was: \u{1b}[31m37\u{1b}[0m\n \ expected: \u{1b}[34m42\u{1b}[0m\n\ "] @@ -507,12 +507,10 @@ mod colored { assert_eq!( failures, - &[ - "assertion failed: expected subject to be not equal to 42\n \ + &["expected subject to be not equal to 42\n \ but was: 42\n \ expected: not 42\n\ - " - ] + "] ); } } diff --git a/src/iterator/tests.rs b/src/iterator/tests.rs index 3d28731..3194bfb 100644 --- a/src/iterator/tests.rs +++ b/src/iterator/tests.rs @@ -97,7 +97,7 @@ fn verify_custom_collection_contains_fails() { assert_eq!( failures, - &[r"assertion failed: expected my_thing to contain 42 + &[r"expected my_thing to contain 42 but was: [1, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43] expected: 42 "] @@ -128,7 +128,7 @@ fn verify_custom_iterator_contains_fails() { assert_eq!( failures, - &[r"assertion failed: expected my_thing to contain 42 + &[r"expected my_thing to contain 42 but was: [1, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43] expected: 42 "] @@ -160,7 +160,7 @@ fn verify_custom_collection_does_not_contain_fails() { assert_eq!( failures, - &[r"assertion failed: expected my_thing to not contain 19 + &[r"expected my_thing to not contain 19 but was: [1, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43] expected: not 19 "] @@ -194,7 +194,7 @@ fn verify_custom_iterator_does_not_contain_fails() { assert_eq!( failures, - &[r"assertion failed: expected my_thing to not contain 19 + &[r"expected my_thing to not contain 19 but was: [1, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43] expected: not 19 "] diff --git a/src/lib.rs b/src/lib.rs index 21a6d7e..727a763 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -59,7 +59,7 @@ //! will print the error message: //! //! ```console -//! assertion failed: expected 6 * 8 - 5 to be equal to 42 +//! expected 6 * 8 - 5 to be equal to 42 //! but was: 43 //! expected: 42 //! ``` @@ -149,11 +149,11 @@ //! assertions in the panic message: //! //! ```console -//! assertion failed: expected subject to contain "unimportant" +//! expected subject to contain "unimportant" //! but was: "the answer to all important questions is 42" //! expected: "unimportant" //! -//! assertion failed: expected subject to have at most a length of 41 +//! expected subject to have at most a length of 41 //! but was: 43 //! expected: <= 41 //! ``` @@ -319,7 +319,7 @@ //! let failures = verify_that!(7 * 5).is_equal_to(42).display_failures(); //! //! assert_that!(failures).contains_exactly([ -//! r"assertion failed: expected 7 * 5 to be equal to 42 +//! r"expected 7 * 5 to be equal to 42 //! but was: 35 //! expected: 42 //! " diff --git a/src/map/tests.rs b/src/map/tests.rs index b857d0d..f04e974 100644 --- a/src/map/tests.rs +++ b/src/map/tests.rs @@ -88,7 +88,7 @@ mod hashbrown { assert_eq!( failures, &[format!( - r"assertion failed: expected foo_map to contain the key 7 + r"expected foo_map to contain the key 7 but was: {formatted_actual} expected: 7 " @@ -116,7 +116,7 @@ mod hashbrown { assert_eq!( failures, &[format!( - r"assertion failed: expected foo_map to not contain the key 5 + r"expected foo_map to not contain the key 5 but was: {formatted_actual} expected: not 5 " @@ -158,7 +158,7 @@ mod hashbrown { assert_eq!( failures, &[format!( - r#"assertion failed: expected foo_map to contain the value "six" + r#"expected foo_map to contain the value "six" but was: {formatted_actual} expected: "six" "# @@ -186,7 +186,7 @@ mod hashbrown { assert_eq!( failures, &[format!( - r#"assertion failed: expected foo_map to not contain the value "five" + r#"expected foo_map to not contain the value "five" but was: {formatted_actual} expected: not "five" "# @@ -214,7 +214,7 @@ mod hashbrown { assert_eq!( failures, &[format!( - r"assertion failed: expected foo_map to contain the keys [5, 3, 4] + r"expected foo_map to contain the keys [5, 3, 4] but was: {formatted_actual} expected: [5, 3, 4] missing: [3] @@ -236,7 +236,7 @@ mod hashbrown { assert_eq!( failures, &[format!( - r"assertion failed: expected foo_map to contain the keys [5, 3, 4] + r"expected foo_map to contain the keys [5, 3, 4] but was: {formatted_actual} expected: [5, 3, 4] missing: [3] @@ -258,7 +258,7 @@ mod hashbrown { assert_eq!( failures, &[format!( - r"assertion failed: expected foo_map to contain the keys [5, 3, 4] + r"expected foo_map to contain the keys [5, 3, 4] but was: {formatted_actual} expected: [5, 3, 4] missing: [3] @@ -287,7 +287,7 @@ mod hashbrown { assert_eq!( failures, &[format!( - r#"assertion failed: expected foo_map to contain the values ["one", "two", "three"] + r#"expected foo_map to contain the values ["one", "two", "three"] but was: {formatted_actual} expected: ["one", "two", "three"] missing: ["two", "three"] @@ -323,7 +323,7 @@ mod hashbrown { assert_eq!( failures, &[format!( - r"assertion failed: expected foo_map to not contain the keys [5, 3, 4] + r"expected foo_map to not contain the keys [5, 3, 4] but was: {formatted_actual} expected: [5, 3, 4] extra: {formatted_extra} @@ -352,7 +352,7 @@ mod hashbrown { assert_eq!( failures, &[format!( - r#"assertion failed: expected foo_map to not contain the values ["one", "two", "three"] + r#"expected foo_map to not contain the values ["one", "two", "three"] but was: {formatted_actual} expected: ["one", "two", "three"] extra: ["one"] @@ -388,7 +388,7 @@ mod hashbrown { assert_eq!( failures, &[format!( - r"assertion failed: expected foo_map to contain exactly the keys [5, 2, 6, 3] + r"expected foo_map to contain exactly the keys [5, 2, 6, 3] but was: {formatted_actual} expected: [5, 2, 6, 3] missing: [2, 3] @@ -489,7 +489,7 @@ mod std_hash_map { assert_eq!( failures, &[format!( - r"assertion failed: expected foo_map to contain the key 7 + r"expected foo_map to contain the key 7 but was: {formatted_actual} expected: 7 " @@ -517,7 +517,7 @@ mod std_hash_map { assert_eq!( failures, &[format!( - r"assertion failed: expected foo_map to not contain the key 4 + r"expected foo_map to not contain the key 4 but was: {formatted_actual} expected: not 4 " @@ -559,7 +559,7 @@ mod std_hash_map { assert_eq!( failures, &[format!( - r#"assertion failed: expected foo_map to contain the value "six" + r#"expected foo_map to contain the value "six" but was: {formatted_actual} expected: "six" "# @@ -587,7 +587,7 @@ mod std_hash_map { assert_eq!( failures, &[format!( - r#"assertion failed: expected foo_map to not contain the value "four" + r#"expected foo_map to not contain the value "four" but was: {formatted_actual} expected: not "four" "# @@ -615,7 +615,7 @@ mod std_hash_map { assert_eq!( failures, &[format!( - r"assertion failed: expected foo_map to contain the keys [2, 3, 5] + r"expected foo_map to contain the keys [2, 3, 5] but was: {formatted_actual} expected: [2, 3, 5] missing: [2, 3] @@ -637,7 +637,7 @@ mod std_hash_map { assert_eq!( failures, &[format!( - r"assertion failed: expected foo_map to contain the keys [2, 3, 5] + r"expected foo_map to contain the keys [2, 3, 5] but was: {formatted_actual} expected: [2, 3, 5] missing: [2, 3] @@ -659,7 +659,7 @@ mod std_hash_map { assert_eq!( failures, &[format!( - r"assertion failed: expected foo_map to contain the keys [2, 3, 5] + r"expected foo_map to contain the keys [2, 3, 5] but was: {formatted_actual} expected: [2, 3, 5] missing: [2, 3] @@ -688,7 +688,7 @@ mod std_hash_map { assert_eq!( failures, &[format!( - r#"assertion failed: expected foo_map to contain the values ["one", "two", "three"] + r#"expected foo_map to contain the values ["one", "two", "three"] but was: {formatted_actual} expected: ["one", "two", "three"] missing: ["two", "three"] @@ -717,7 +717,7 @@ mod std_hash_map { assert_eq!( failures, &[format!( - r"assertion failed: expected foo_map to contain exactly the keys [4, 5, 6, 3] + r"expected foo_map to contain exactly the keys [4, 5, 6, 3] but was: {formatted_actual} expected: [4, 5, 6, 3] missing: [3] @@ -816,7 +816,7 @@ mod btree_map { assert_eq!( failures, - &[r#"assertion failed: expected foo_map to contain the key 7 + &[r#"expected foo_map to contain the key 7 but was: {1: "one", 4: "four", 5: "five"} expected: 7 "#] @@ -841,12 +841,10 @@ mod btree_map { assert_eq!( failures, - &[ - r#"assertion failed: expected foo_map to not contain the key 1 + &[r#"expected foo_map to not contain the key 1 but was: {1: "one", 4: "four", 5: "five"} expected: not 1 -"# - ] +"#] ); } @@ -882,12 +880,10 @@ mod btree_map { assert_eq!( failures, - &[ - r#"assertion failed: expected foo_map to contain the value "six" + &[r#"expected foo_map to contain the value "six" but was: {1: "one", 4: "four", 5: "five"} expected: "six" -"# - ] +"#] ); } @@ -909,12 +905,10 @@ mod btree_map { assert_eq!( failures, - &[ - r#"assertion failed: expected foo_map to not contain the value "one" + &[r#"expected foo_map to not contain the value "one" but was: {1: "one", 4: "four", 5: "five"} expected: not "one" -"# - ] +"#] ); } @@ -938,7 +932,7 @@ mod btree_map { assert_eq!( failures, &[format!( - r"assertion failed: expected foo_map to contain the keys [5, 3, 7] + r"expected foo_map to contain the keys [5, 3, 7] but was: {formatted_actual} expected: [5, 3, 7] missing: [3, 7] @@ -960,7 +954,7 @@ mod btree_map { assert_eq!( failures, &[format!( - r"assertion failed: expected foo_map to contain the keys [5, 3, 7] + r"expected foo_map to contain the keys [5, 3, 7] but was: {formatted_actual} expected: [5, 3, 7] missing: [3, 7] @@ -982,7 +976,7 @@ mod btree_map { assert_eq!( failures, &[format!( - r"assertion failed: expected foo_map to contain the keys [5, 3, 7] + r"expected foo_map to contain the keys [5, 3, 7] but was: {formatted_actual} expected: [5, 3, 7] missing: [3, 7] @@ -1011,7 +1005,7 @@ mod btree_map { assert_eq!( failures, &[format!( - r#"assertion failed: expected foo_map to contain the values ["one", "two", "three"] + r#"expected foo_map to contain the values ["one", "two", "three"] but was: {formatted_actual} expected: ["one", "two", "three"] missing: ["two", "three"] @@ -1047,7 +1041,7 @@ mod btree_map { assert_eq!( failures, &[format!( - r"assertion failed: expected foo_map to contain exactly the keys [5, 2, 6, 3] + r"expected foo_map to contain exactly the keys [5, 2, 6, 3] but was: {formatted_actual} expected: [5, 2, 6, 3] missing: [2, 3] @@ -1083,7 +1077,7 @@ mod colored { assert_eq!( failures, &[format!( - "assertion failed: expected foo_map to contain the key 2\n \ + "expected foo_map to contain the key 2\n \ but was: {formatted_actual}\n \ expected: \u{1b}[32m2\u{1b}[0m\n\ " @@ -1106,7 +1100,7 @@ mod colored { assert_eq!( failures, &[format!( - "assertion failed: expected foo_map to not contain the key 1\n \ + "expected foo_map to not contain the key 1\n \ but was: {formatted_actual}\n \ expected: not \u{1b}[32m1\u{1b}[0m\n\ " @@ -1132,7 +1126,7 @@ mod colored { assert_eq!( failures, &[format!( - "assertion failed: expected foo_map to contain the value \"three\"\n \ + "expected foo_map to contain the value \"three\"\n \ but was: {formatted_actual}\n \ expected: \u{1b}[32m\"three\"\u{1b}[0m\n\ " @@ -1155,7 +1149,7 @@ mod colored { assert_eq!( failures, &[format!( - "assertion failed: expected foo_map to not contain the value \"four\"\n \ + "expected foo_map to not contain the value \"four\"\n \ but was: {formatted_actual}\n \ expected: not \u{1b}[32m\"four\"\u{1b}[0m\n\ " @@ -1179,7 +1173,7 @@ mod colored { assert_eq!( failures, &[format!( - "assertion failed: expected foo_map to contain the keys [5, 2, 4, 7]\n \ + "expected foo_map to contain the keys [5, 2, 4, 7]\n \ but was: {formatted_actual}\n \ expected: [5, \u{1b}[32m2\u{1b}[0m, 4, \u{1b}[32m7\u{1b}[0m]\n \ missing: [2, 7]\n\ @@ -1211,7 +1205,7 @@ mod colored { assert_eq!( failures, &[format!( - "assertion failed: expected foo_map to not contain the keys [5, 2, 4, 7]\n \ + "expected foo_map to not contain the keys [5, 2, 4, 7]\n \ but was: {formatted_actual}\n \ expected: [\u{1b}[32m5\u{1b}[0m, 2, \u{1b}[32m4\u{1b}[0m, 7]\n \ extra: {formatted_extra}\n\ @@ -1236,7 +1230,7 @@ mod colored { assert_eq!( failures, &[format!( - "assertion failed: expected foo_map to contain the values [\"five\", \"two\", \"four\", \"seven\"]\n \ + "expected foo_map to contain the values [\"five\", \"two\", \"four\", \"seven\"]\n \ but was: {formatted_actual}\n \ expected: [\"five\", \u{1b}[32m\"two\"\u{1b}[0m, \"four\", \u{1b}[32m\"seven\"\u{1b}[0m]\n \ missing: [\"two\", \"seven\"]\n\ @@ -1268,7 +1262,7 @@ mod colored { assert_eq!( failures, &[format!( - "assertion failed: expected foo_map to not contain the values [\"five\", \"two\", \"four\", \"seven\"]\n \ + "expected foo_map to not contain the values [\"five\", \"two\", \"four\", \"seven\"]\n \ but was: {formatted_actual}\n \ expected: [\u{1b}[32m\"five\"\u{1b}[0m, \"two\", \u{1b}[32m\"four\"\u{1b}[0m, \"seven\"]\n \ extra: {formatted_extra}\n\ @@ -1300,7 +1294,7 @@ mod colored { assert_eq!( failures, &[format!( - "assertion failed: expected foo_map to contain exactly the keys [5, 2, 6, 3]\n \ + "expected foo_map to contain exactly the keys [5, 2, 6, 3]\n \ but was: {formatted_actual}\n \ expected: [5, \u{1b}[32m2\u{1b}[0m, 6, \u{1b}[32m3\u{1b}[0m]\n \ missing: [2, 3]\n \ diff --git a/src/num_bigint/tests.rs b/src/num_bigint/tests.rs index 90a1801..ff21f63 100644 --- a/src/num_bigint/tests.rs +++ b/src/num_bigint/tests.rs @@ -18,7 +18,7 @@ fn verify_bigint_is_equal_to_other_fails() { assert_eq!( failures, - &[r"assertion failed: expected subject to be equal to -42 + &[r"expected subject to be equal to -42 but was: 42 expected: -42 "] @@ -156,7 +156,7 @@ fn verify_biguint_is_equal_to_other_fails() { assert_eq!( failures, - &[r"assertion failed: expected subject to be equal to 22 + &[r"expected subject to be equal to 22 but was: 42 expected: 22 "] diff --git a/src/option/mod.rs b/src/option/mod.rs index 7b151ad..95302a7 100644 --- a/src/option/mod.rs +++ b/src/option/mod.rs @@ -46,7 +46,7 @@ where fn some(self) -> Spec<'a, T, R> { self.mapping(|subject| match subject { None => { - panic!("assertion failed: expected the subject to be `Some(_)`, but was `None`") + panic!("expected the subject to be `Some(_)`, but was `None`") }, Some(value) => value, }) @@ -60,7 +60,7 @@ where fn some(self) -> Spec<'a, &'a T, R> { self.mapping(|subject| match subject { None => { - panic!("assertion failed: expected the subject to be `Some(_)`, but was `None`") + panic!("expected the subject to be `Some(_)`, but was `None`") }, Some(value) => value, }) diff --git a/src/option/tests.rs b/src/option/tests.rs index ef810dc..aa2507a 100644 --- a/src/option/tests.rs +++ b/src/option/tests.rs @@ -56,7 +56,7 @@ fn verify_option_of_custom_struct_is_none_fails() { assert_eq!( failures, - &[r"assertion failed: expected my_thing to be None + &[r"expected my_thing to be None but was: Some(Foo) expected: None "] @@ -87,7 +87,7 @@ fn verify_option_of_custom_struct_is_some_fails() { assert_eq!( failures, - &[r"assertion failed: expected my_thing to be Some(_) + &[r"expected my_thing to be Some(_) but was: None expected: Some(_) "] @@ -118,7 +118,7 @@ fn verify_borrowed_option_of_custom_struct_is_none_fails() { assert_eq!( failures, - &[r"assertion failed: expected my_thing to be None + &[r"expected my_thing to be None but was: Some(Foo) expected: None "] @@ -149,7 +149,7 @@ fn verify_borrowed_option_of_custom_struct_is_some_fails() { assert_eq!( failures, - &[r"assertion failed: expected my_thing to be Some(_) + &[r"expected my_thing to be Some(_) but was: None expected: Some(_) "] @@ -195,7 +195,7 @@ fn verify_option_of_string_has_some_value_fails() { assert_eq!( failures, &[ - r#"assertion failed: expected my_thing to be some containing "labore dolores voluptate culpa" + r#"expected my_thing to be some containing "labore dolores voluptate culpa" but was: Some("labore dolore voluptate culpa") expected: Some("labore dolores voluptate culpa") "# @@ -241,12 +241,10 @@ fn verify_option_of_custom_struct_has_value_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to be some containing Foo + &[r"expected my_thing to be some containing Foo but was: None expected: Some(Foo) -" - ] +"] ); } @@ -274,12 +272,10 @@ fn verify_borrowed_option_of_custom_struct_has_value_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to be some containing Foo + &[r"expected my_thing to be some containing Foo but was: None expected: Some(Foo) -" - ] +"] ); } @@ -308,7 +304,7 @@ fn map_option_with_none_to_its_value() { assert_that_code(|| { assert_that(subject).some().is_empty(); }) - .panics_with_message("assertion failed: expected the subject to be `Some(_)`, but was `None`"); + .panics_with_message("expected the subject to be `Some(_)`, but was `None`"); } #[test] @@ -326,7 +322,7 @@ fn map_borrowed_option_with_none_to_its_value() { assert_that_code(|| { assert_that(&subject).some().is_empty(); }) - .panics_with_message("assertion failed: expected the subject to be `Some(_)`, but was `None`"); + .panics_with_message("expected the subject to be `Some(_)`, but was `None`"); } #[cfg(feature = "colored")] @@ -345,7 +341,7 @@ mod colored { assert_eq!( failures, - &["assertion failed: expected subject to be Some(_)\n \ + &["expected subject to be Some(_)\n \ but was: \u{1b}[31mNone\u{1b}[0m\n \ expected: \u{1b}[33mSome(_)\u{1b}[0m\n\ "] @@ -363,7 +359,7 @@ mod colored { assert_eq!( failures, - &["assertion failed: expected subject to be None\n \ + &["expected subject to be None\n \ but was: \u{1b}[31mSome(3500)\u{1b}[0m\n \ expected: \u{1b}[33mNone\u{1b}[0m\n\ "] @@ -382,7 +378,7 @@ mod colored { assert_eq!( failures, &[ - "assertion failed: expected subject to be some containing [1, 2, 3, 5, 7]\n \ + "expected subject to be some containing [1, 2, 3, 5, 7]\n \ but was: \u{1b}[31mNone\u{1b}[0m\n \ expected: \u{1b}[33mSome([1, 2, 3, 5, 7])\u{1b}[0m\n\ " diff --git a/src/order/tests.rs b/src/order/tests.rs index 7247e0b..2583e1c 100644 --- a/src/order/tests.rs +++ b/src/order/tests.rs @@ -22,7 +22,7 @@ fn verify_i32_is_less_than_other_i32_fails() { assert_eq!( failures, - &[r"assertion failed: expected my_thing to be less than 42 + &[r"expected my_thing to be less than 42 but was: 42 expected: < 42 "] @@ -47,7 +47,7 @@ fn verify_i32_is_greater_than_other_i32_fails() { assert_eq!( failures, - &[r"assertion failed: expected my_thing to be greater than 42 + &[r"expected my_thing to be greater than 42 but was: 42 expected: > 42 "] @@ -72,7 +72,7 @@ fn verify_i32_is_at_most_other_i32_fails() { assert_eq!( failures, - &[r"assertion failed: expected my_thing to be at most 41 + &[r"expected my_thing to be at most 41 but was: 42 expected: <= 41 "] @@ -97,7 +97,7 @@ fn verify_i32_is_at_least_other_i32_fails() { assert_eq!( failures, - &[r"assertion failed: expected my_thing to be at least 43 + &[r"expected my_thing to be at least 43 but was: 42 expected: >= 43 "] @@ -126,7 +126,7 @@ fn verify_char_is_less_than_other_char_fails() { assert_eq!( failures, - &[r"assertion failed: expected my_thing to be less than 'C' + &[r"expected my_thing to be less than 'C' but was: 'C' expected: < 'C' "] @@ -151,7 +151,7 @@ fn verify_char_is_greater_than_other_char_fails() { assert_eq!( failures, - &[r"assertion failed: expected my_thing to be greater than 'D' + &[r"expected my_thing to be greater than 'D' but was: 'D' expected: > 'D' "] @@ -176,7 +176,7 @@ fn verify_char_is_at_most_other_char_fails() { assert_eq!( failures, - &[r"assertion failed: expected my_thing to be at most 'B' + &[r"expected my_thing to be at most 'B' but was: 'C' expected: <= 'B' "] @@ -201,7 +201,7 @@ fn verify_char_is_at_least_other_char_fails() { assert_eq!( failures, - &[r"assertion failed: expected my_thing to be at least 'E' + &[r"expected my_thing to be at least 'E' but was: 'D' expected: >= 'E' "] @@ -226,7 +226,7 @@ fn verify_char_is_before_other_char_fails() { assert_eq!( failures, - &[r"assertion failed: expected my_thing to be before 'L' + &[r"expected my_thing to be before 'L' but was: 'L' expected: < 'L' "] @@ -251,7 +251,7 @@ fn verify_char_is_after_other_char_fails() { assert_eq!( failures, - &[r"assertion failed: expected my_thing to be after 'L' + &[r"expected my_thing to be after 'L' but was: 'L' expected: > 'L' "] @@ -278,12 +278,10 @@ fn verify_char_is_between_a_min_char_and_a_max_char_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to be between 'M' and 'P' + &[r"expected my_thing to be between 'M' and 'P' but was: 'L' expected: 'M' <= x <= 'P' -" - ] +"] ); } @@ -302,12 +300,10 @@ mod colored { assert_eq!( failures, - &[ - "assertion failed: expected subject to be less than 3.779\n \ + &["expected subject to be less than 3.779\n \ but was: \u{1b}[31m3.781\u{1b}[0m\n \ expected: < \u{1b}[32m3.779\u{1b}[0m\n\ - " - ] + "] ); } @@ -322,12 +318,10 @@ mod colored { assert_eq!( failures, - &[ - "assertion failed: expected subject to be at most 3.779\n \ + &["expected subject to be at most 3.779\n \ but was: \u{1b}[31m3.781\u{1b}[0m\n \ expected: <= \u{1b}[34m3.779\u{1b}[0m\n\ - " - ] + "] ); } @@ -342,12 +336,10 @@ mod colored { assert_eq!( failures, - &[ - "assertion failed: expected subject to be greater than 3.782\n \ + &["expected subject to be greater than 3.782\n \ but was: \u{1b}[31m3.781\u{1b}[0m\n \ expected: > \u{1b}[33m3.782\u{1b}[0m\n\ - " - ] + "] ); } @@ -362,12 +354,10 @@ mod colored { assert_eq!( failures, - &[ - "assertion failed: expected subject to be at least 3.782\n \ + &["expected subject to be at least 3.782\n \ but was: \u{1b}[31m3.781\u{1b}[0m\n \ expected: >= \u{1b}[34m3.782\u{1b}[0m\n\ - " - ] + "] ); } @@ -382,12 +372,10 @@ mod colored { assert_eq!( failures, - &[ - "assertion failed: expected subject to be between 'M' and 'P'\n \ + &["expected subject to be between 'M' and 'P'\n \ but was: \u{1b}[31m'L'\u{1b}[0m\n \ expected: \u{1b}[33m'M'\u{1b}[0m <= x <= 'P'\n\ - " - ] + "] ); } @@ -402,12 +390,10 @@ mod colored { assert_eq!( failures, - &[ - "assertion failed: expected subject to be between 'H' and 'K'\n \ + &["expected subject to be between 'H' and 'K'\n \ but was: \u{1b}[31m'L'\u{1b}[0m\n \ expected: 'H' <= x <= \u{1b}[33m'K'\u{1b}[0m\n\ - " - ] + "] ); } } diff --git a/src/panic/tests.rs b/src/panic/tests.rs index fb9d033..53f54d8 100644 --- a/src/panic/tests.rs +++ b/src/panic/tests.rs @@ -21,11 +21,9 @@ fn verify_code_does_not_panic_fails() { assert_eq!( failures, - &[ - r#"assertion failed: expected my_closure to not panic, but did panic + &[r#"expected my_closure to not panic, but did panic with message: "excepteur stet sadipscing eu" -"# - ] +"#] ); } @@ -52,9 +50,7 @@ fn code_does_panic_with_message_from_assertion() { .with_diff_format(DIFF_FORMAT_NO_HIGHLIGHT) .is_equal_to(4); }) - .panics_with_message( - "assertion failed: expected subject to be equal to 4\n but was: 5\n expected: 4\n", - ); + .panics_with_message("expected subject to be equal to 4\n but was: 5\n expected: 4\n"); } #[test] @@ -76,10 +72,8 @@ fn verify_code_does_panic_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_closure to panic, but did not panic -" - ] + &[r"expected my_closure to panic, but did not panic +"] ); } @@ -95,7 +89,7 @@ fn verify_code_does_panic_with_message_fails_because_code_does_not_panic() { assert_eq!( failures, &[ - r#"assertion failed: expected my_closure to panic with message "nam veniam ut et", + r#"expected my_closure to panic with message "nam veniam ut et", but did not panic "# ] @@ -116,8 +110,8 @@ fn verify_code_does_panic_with_message_fails_because_unexpected_panic_message() assert_eq!( failures, &[ - "assertion failed: expected my_closure to panic with message \"lobortis lorem aliquam ex\"\n \ - but was: \"assertion failed: expected subject to be equal to 4\n but was: 5\n expected: 4\n\"\n \ + "expected my_closure to panic with message \"lobortis lorem aliquam ex\"\n \ + but was: \"expected subject to be equal to 4\n but was: 5\n expected: 4\n\"\n \ expected: \"lobortis lorem aliquam ex\"\n\ " ] @@ -145,7 +139,7 @@ mod colored { assert_eq!( failures, &[ - "assertion failed: expected foo to not panic, but \u{1b}[31mdid panic\u{1b}[0m\n \ + "expected foo to not panic, but \u{1b}[31mdid panic\u{1b}[0m\n \ with message: \"\u{1b}[31mfoo does not work with message\u{1b}[0m\"\n\ " ] @@ -162,7 +156,7 @@ mod colored { assert_eq!( failures, - &["assertion failed: expected foo to panic, but \u{1b}[31mdid not panic\u{1b}[0m\n"] + &["expected foo to panic, but \u{1b}[31mdid not panic\u{1b}[0m\n"] ); } @@ -176,8 +170,10 @@ mod colored { assert_eq!( failures, - &["assertion failed: expected foo to panic with message \"hendrerit sint tempor ipsum\",\n \ - but \u{1b}[31mdid not panic\u{1b}[0m\n"] + &[ + "expected foo to panic with message \"hendrerit sint tempor ipsum\",\n \ + but \u{1b}[31mdid not panic\u{1b}[0m\n" + ] ); } @@ -191,7 +187,8 @@ mod colored { assert_eq!( failures, - &["assertion failed: expected foo to panic with message \"hendrerit sint tempor ipsum\"\n \ + &[ + "expected foo to panic with message \"hendrerit sint tempor ipsum\"\n \ but was: \"\u{1b}[31mfoo does not work with message\u{1b}[0m\"\n \ expected: \"\u{1b}[32mhendrerit sint tempor ipsum\u{1b}[0m\"\n\ " diff --git a/src/predicate/tests.rs b/src/predicate/tests.rs index 99d5e46..6ee8c15 100644 --- a/src/predicate/tests.rs +++ b/src/predicate/tests.rs @@ -20,7 +20,7 @@ fn verify_that_subject_satisfies_predicate_fails() { assert_eq!( failures, - &["assertion failed: expected my_thing to satisfy the given predicate, but returned false\n"] + &["expected my_thing to satisfy the given predicate, but returned false\n"] ); } @@ -35,8 +35,5 @@ fn verify_that_subject_satisfies_predicate_fails_with_custom_message() { }) .display_failures(); - assert_eq!( - failures, - &["assertion failed: the answer to all important questions is 42\n"] - ); + assert_eq!(failures, &["the answer to all important questions is 42\n"]); } diff --git a/src/range/tests.rs b/src/range/tests.rs index bc5a72d..b16bf9a 100644 --- a/src/range/tests.rs +++ b/src/range/tests.rs @@ -22,12 +22,10 @@ fn verify_i32_is_in_range_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to be within range of 43..51 + &[r"expected my_thing to be within range of 43..51 but was: 42 expected: 43 <= x < 51 -" - ] +"] ); } @@ -49,12 +47,10 @@ fn verify_i32_is_in_inclusive_range_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to be within range of 43..=51 + &[r"expected my_thing to be within range of 43..=51 but was: 42 expected: 43 <= x <= 51 -" - ] +"] ); } @@ -76,12 +72,10 @@ fn verify_i32_is_in_range_from_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to be within range of 43.. + &[r"expected my_thing to be within range of 43.. but was: 42 expected: 43 <= x < .. -" - ] +"] ); } @@ -103,12 +97,10 @@ fn verify_i32_is_in_range_to_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to be within range of ..42 + &[r"expected my_thing to be within range of ..42 but was: 42 expected: .. < x < 42 -" - ] +"] ); } @@ -130,12 +122,10 @@ fn verify_i32_is_in_range_to_inclusive_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to be within range of ..=41 + &[r"expected my_thing to be within range of ..=41 but was: 42 expected: .. < x <= 41 -" - ] +"] ); } @@ -157,12 +147,10 @@ fn verify_i32_is_not_in_range_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to be not within range of 41..43 + &[r"expected my_thing to be not within range of 41..43 but was: 42 expected: x < 41 || x >= 43 -" - ] +"] ); } @@ -184,12 +172,10 @@ fn verify_i32_is_not_in_inclusive_range_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to be not within range of 41..=42 + &[r"expected my_thing to be not within range of 41..=42 but was: 42 expected: x < 41 || x > 42 -" - ] +"] ); } @@ -211,12 +197,10 @@ fn verify_i32_is_not_in_range_from_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to be not within range of 42.. + &[r"expected my_thing to be not within range of 42.. but was: 42 expected: x < 42 || x > .. -" - ] +"] ); } @@ -238,12 +222,10 @@ fn verify_i32_is_not_in_range_to_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to be not within range of ..43 + &[r"expected my_thing to be not within range of ..43 but was: 42 expected: x < .. || x >= 43 -" - ] +"] ); } @@ -265,12 +247,10 @@ fn verify_i32_is_not_in_range_to_inclusive_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to be not within range of ..=42 + &[r"expected my_thing to be not within range of ..=42 but was: 42 expected: x < .. || x > 42 -" - ] +"] ); } @@ -296,12 +276,10 @@ fn verify_char_is_in_range_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to be within range of 'L'..'Z' + &[r"expected my_thing to be within range of 'L'..'Z' but was: 'K' expected: 'L' <= x < 'Z' -" - ] +"] ); } @@ -323,12 +301,10 @@ fn verify_char_is_in_inclusive_range_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to be within range of 'L'..='Z' + &[r"expected my_thing to be within range of 'L'..='Z' but was: 'K' expected: 'L' <= x <= 'Z' -" - ] +"] ); } @@ -350,12 +326,10 @@ fn verify_char_is_not_in_range_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to be not within range of 'J'..'L' + &[r"expected my_thing to be not within range of 'J'..'L' but was: 'K' expected: x < 'J' || x >= 'L' -" - ] +"] ); } @@ -377,12 +351,10 @@ fn verify_char_is_not_in_inclusive_range_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to be not within range of 'J'..='K' + &[r"expected my_thing to be not within range of 'J'..='K' but was: 'K' expected: x < 'J' || x > 'K' -" - ] +"] ); } @@ -434,12 +406,10 @@ mod colored { assert_eq!( failures, - &[ - "assertion failed: expected subject to be within range of -4321..4322\n \ + &["expected subject to be within range of -4321..4322\n \ but was: \u{1b}[31m29834\u{1b}[0m\n \ expected: -4321 <= x < \u{1b}[34m4322\u{1b}[0m\n\ - " - ] + "] ); } @@ -454,12 +424,10 @@ mod colored { assert_eq!( failures, - &[ - "assertion failed: expected subject to be within range of -4321..4322\n \ + &["expected subject to be within range of -4321..4322\n \ but was: \u{1b}[31m-29834\u{1b}[0m\n \ expected: \u{1b}[34m-4321\u{1b}[0m <= x < 4322\n\ - " - ] + "] ); } @@ -474,12 +442,10 @@ mod colored { assert_eq!( failures, - &[ - "assertion failed: expected subject to be within range of -4321..=4321\n \ + &["expected subject to be within range of -4321..=4321\n \ but was: \u{1b}[31m29834\u{1b}[0m\n \ expected: -4321 <= x <= \u{1b}[34m4321\u{1b}[0m\n\ - " - ] + "] ); } @@ -494,12 +460,10 @@ mod colored { assert_eq!( failures, - &[ - "assertion failed: expected subject to be within range of -4321..=4321\n \ + &["expected subject to be within range of -4321..=4321\n \ but was: \u{1b}[31m-29834\u{1b}[0m\n \ expected: \u{1b}[34m-4321\u{1b}[0m <= x <= 4321\n\ - " - ] + "] ); } @@ -514,12 +478,10 @@ mod colored { assert_eq!( failures, - &[ - "assertion failed: expected subject to be not within range of 'a'..'p'\n \ + &["expected subject to be not within range of 'a'..'p'\n \ but was: \u{1b}[31m'm'\u{1b}[0m\n \ expected: x < \u{1b}[32m'a'\u{1b}[0m || x >= \u{1b}[32m'p'\u{1b}[0m\n\ - " - ] + "] ); } @@ -534,12 +496,10 @@ mod colored { assert_eq!( failures, - &[ - "assertion failed: expected subject to be not within range of 'a'..='z'\n \ + &["expected subject to be not within range of 'a'..='z'\n \ but was: \u{1b}[31m'm'\u{1b}[0m\n \ expected: x < \u{1b}[32m'a'\u{1b}[0m || x > \u{1b}[32m'z'\u{1b}[0m\n\ - " - ] + "] ); } } diff --git a/src/result/mod.rs b/src/result/mod.rs index 8b91293..7e1c61a 100644 --- a/src/result/mod.rs +++ b/src/result/mod.rs @@ -56,7 +56,7 @@ where self.mapping(|subject| match subject { Ok(value) => value, Err(error) => { - panic!("assertion failed: expected the subject to be `Ok(_)`, but was `Err({error:?})`") + panic!("expected the subject to be `Ok(_)`, but was `Err({error:?})`") }, }) } @@ -64,7 +64,7 @@ where fn err(self) -> Spec<'a, E, R> { self.mapping(|subject| match subject { Ok(value) => { - panic!("assertion failed: expected the subject to be `Err(_)`, but was `Ok({value:?})`") + panic!("expected the subject to be `Err(_)`, but was `Ok({value:?})`") }, Err(error) => error, }) @@ -80,7 +80,7 @@ where self.mapping(|subject| match subject { Ok(value) => value, Err(error) => { - panic!("assertion failed: expected the subject to be `Ok(_)`, but was `Err({error:?})`") + panic!("expected the subject to be `Ok(_)`, but was `Err({error:?})`") }, }) } @@ -88,7 +88,7 @@ where fn err(self) -> Spec<'a, &'a E, R> { self.mapping(|subject| match subject { Ok(value) => { - panic!("assertion failed: expected the subject to be `Err(_)`, but was `Ok({value:?})`") + panic!("expected the subject to be `Err(_)`, but was `Ok({value:?})`") }, Err(error) => error, }) @@ -154,7 +154,7 @@ where fn has_error_message(self, expected: X) -> Spec<'a, String, R> { self.mapping(|result| match result { Ok(value) => panic!( - r"assertion failed: expected the subject to be `Err(_)` with message {expected:?}, but was `Ok({value:?})`" + r"expected the subject to be `Err(_)` with message {expected:?}, but was `Ok({value:?})`" ), Err(error) => { error.to_string() @@ -174,7 +174,7 @@ where fn has_error_message(self, expected: X) -> Spec<'a, String, R> { self.mapping(|result| match result { Ok(value) => panic!( - r"assertion failed: expected the subject to be `Err(_)` with message {expected:?}, but was `Ok({value:?})`" + r"expected the subject to be `Err(_)` with message {expected:?}, but was `Ok({value:?})`" ), Err(error) => { error.to_string() diff --git a/src/result/tests.rs b/src/result/tests.rs index af67edf..b0656cc 100644 --- a/src/result/tests.rs +++ b/src/result/tests.rs @@ -58,7 +58,7 @@ fn verify_result_of_custom_types_is_ok_fails() { assert_eq!( failures, - &[r#"assertion failed: expected my_thing to be Ok(_) + &[r#"expected my_thing to be Ok(_) but was: Err(MyError("aute nam ad amet")) expected: Ok(_) "#] @@ -83,7 +83,7 @@ fn verify_result_of_custom_types_is_err_fails() { assert_eq!( failures, - &[r"assertion failed: expected my_thing to be Err(_) + &[r"expected my_thing to be Err(_) but was: Ok(MyValue(42)) expected: Err(_) "] @@ -135,7 +135,7 @@ fn verify_result_of_custom_types_has_value_fails() { assert_eq!( failures, &[ - r#"assertion failed: expected my_thing to be ok containing MyValue("sea non obcaecat nostrud") + r#"expected my_thing to be ok containing MyValue("sea non obcaecat nostrud") but was: Err(MyError("amet esse rebum feugait")) expected: Ok(MyValue("sea non obcaecat nostrud")) "# @@ -161,12 +161,10 @@ fn verify_result_of_custom_types_has_error_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to be an error containing MyError(-1) + &[r"expected my_thing to be an error containing MyError(-1) but was: Ok(MyValue(42)) expected: Err(MyError(-1)) -" - ] +"] ); } @@ -214,7 +212,7 @@ fn verify_borrowed_result_of_custom_types_is_ok_fails() { assert_eq!( failures, - &[r#"assertion failed: expected my_thing to be Ok(_) + &[r#"expected my_thing to be Ok(_) but was: Err(MyError("aute nam ad amet")) expected: Ok(_) "#] @@ -239,7 +237,7 @@ fn verify_borrowed_result_of_custom_types_is_err_fails() { assert_eq!( failures, - &[r"assertion failed: expected my_thing to be Err(_) + &[r"expected my_thing to be Err(_) but was: Ok(MyValue(42)) expected: Err(_) "] @@ -291,7 +289,7 @@ fn verify_borrowed_result_of_custom_types_has_value_fails() { assert_eq!( failures, &[ - r#"assertion failed: expected my_thing to be ok containing MyValue("sea non obcaecat nostrud") + r#"expected my_thing to be ok containing MyValue("sea non obcaecat nostrud") but was: Err(MyError("amet esse rebum feugait")) expected: Ok(MyValue("sea non obcaecat nostrud")) "# @@ -317,12 +315,10 @@ fn verify_borrowed_result_of_custom_types_has_error_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to be an error containing MyError(-1) + &[r"expected my_thing to be an error containing MyError(-1) but was: Ok(MyValue(42)) expected: Err(MyError(-1)) -" - ] +"] ); } @@ -341,7 +337,9 @@ fn map_result_with_err_value_to_its_ok_value() { assert_that_code(|| { assert_that(subject).ok().is_not_empty(); }) - .panics_with_message("assertion failed: expected the subject to be `Ok(_)`, but was `Err(\"nam nihil iure liber\")`"); + .panics_with_message( + "expected the subject to be `Ok(_)`, but was `Err(\"nam nihil iure liber\")`", + ); } #[test] @@ -359,9 +357,7 @@ fn map_result_with_ok_value_to_its_err_value() { assert_that_code(|| { assert_that(subject).err().is_not_empty(); }) - .panics_with_message( - "assertion failed: expected the subject to be `Err(_)`, but was `Ok([1, 2, 3])`", - ); + .panics_with_message("expected the subject to be `Err(_)`, but was `Ok([1, 2, 3])`"); } #[test] @@ -379,7 +375,9 @@ fn map_borrowed_result_with_err_value_to_its_ok_value() { assert_that_code(|| { assert_that(&subject).ok().is_not_empty(); }) - .panics_with_message("assertion failed: expected the subject to be `Ok(_)`, but was `Err(\"nam nihil iure liber\")`"); + .panics_with_message( + "expected the subject to be `Ok(_)`, but was `Err(\"nam nihil iure liber\")`", + ); } #[test] @@ -397,9 +395,7 @@ fn map_borrowed_result_with_ok_value_to_its_err_value() { assert_that_code(|| { assert_that(&subject).err().is_not_empty(); }) - .panics_with_message( - "assertion failed: expected the subject to be `Err(_)`, but was `Ok([1, 2, 3])`", - ); + .panics_with_message("expected the subject to be `Err(_)`, but was `Ok([1, 2, 3])`"); } #[test] @@ -434,7 +430,7 @@ fn verify_result_error_has_message_for_ok_value() { assert_that_code(|| { assert_that(subject).has_error_message("vulputate voluptate sanctus quod"); }).panics_with_message( - r#"assertion failed: expected the subject to be `Err(_)` with message "vulputate voluptate sanctus quod", but was `Ok(())`"#, + r#"expected the subject to be `Err(_)` with message "vulputate voluptate sanctus quod", but was `Ok(())`"#, ); } @@ -470,7 +466,7 @@ fn verify_borrowed_result_error_has_message_for_ok_value() { assert_that_code(|| { assert_that(&subject).has_error_message("vulputate voluptate sanctus quod"); }).panics_with_message( - r#"assertion failed: expected the subject to be `Err(_)` with message "vulputate voluptate sanctus quod", but was `Ok(())`"#, + r#"expected the subject to be `Err(_)` with message "vulputate voluptate sanctus quod", but was `Ok(())`"#, ); } @@ -494,7 +490,7 @@ mod colored { assert_eq!( failures, - &["assertion failed: expected subject to be Ok(_)\n \ + &["expected subject to be Ok(_)\n \ but was: \u{1b}[31mErr(\"esse augue id esse\")\u{1b}[0m\n \ expected: \u{1b}[34mOk(_)\u{1b}[0m\n\ "] @@ -512,7 +508,7 @@ mod colored { assert_eq!( failures, - &["assertion failed: expected subject to be Err(_)\n \ + &["expected subject to be Err(_)\n \ but was: \u{1b}[31mOk(3500)\u{1b}[0m\n \ expected: \u{1b}[32mErr(_)\u{1b}[0m\n\ "] @@ -530,12 +526,10 @@ mod colored { assert_eq!( failures, - &[ - "assertion failed: expected subject to be ok containing [1, 2, 3, 5, 7]\n \ + &["expected subject to be ok containing [1, 2, 3, 5, 7]\n \ but was: \u{1b}[31mErr(\"minim facer liber kasd\")\u{1b}[0m\n \ expected: \u{1b}[33mOk([1, 2, 3, 5, 7])\u{1b}[0m\n\ - " - ] + "] ); } @@ -551,7 +545,7 @@ mod colored { assert_eq!( failures, &[ - "assertion failed: expected subject to be an error containing \"at feugait nihil qui\"\n \ + "expected subject to be an error containing \"at feugait nihil qui\"\n \ but was: \u{1b}[31mOk([1, 2, 3, 5, 7])\u{1b}[0m\n \ expected: \u{1b}[33mErr(\"at feugait nihil qui\")\u{1b}[0m\n\ " diff --git a/src/rust_decimal/tests.rs b/src/rust_decimal/tests.rs index dca5cc1..5d6154e 100644 --- a/src/rust_decimal/tests.rs +++ b/src/rust_decimal/tests.rs @@ -22,7 +22,7 @@ fn verify_decimal_is_equal_to_other_fails() { assert_eq!( failures, - &[r"assertion failed: expected subject to be equal to -42.831 + &[r"expected subject to be equal to -42.831 but was: 42.831 expected: -42.831 "] @@ -168,12 +168,10 @@ fn verify_decimal_has_precision_of_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected subject to have a precision of 7 + &[r"expected subject to have a precision of 7 but was: 29 expected: 7 -" - ] +"] ); } @@ -210,7 +208,7 @@ fn verify_decimal_has_scale_of_fails() { assert_eq!( failures, - &[r"assertion failed: expected subject to have a scale of 5 + &[r"expected subject to have a scale of 5 but was: 2 expected: 5 "] @@ -239,7 +237,7 @@ fn verify_decimal_is_integer_fails() { assert_eq!( failures, - &[r"assertion failed: expected subject to be an integer value + &[r"expected subject to be an integer value but was: 4208.10 expected: an integer value "] diff --git a/src/slice/tests.rs b/src/slice/tests.rs index c3089be..9a9c950 100644 --- a/src/slice/tests.rs +++ b/src/slice/tests.rs @@ -31,12 +31,10 @@ fn verify_slice_is_equal_to_another_slice_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to be equal to [2, 4, 6, 8] + &[r"expected my_thing to be equal to [2, 4, 6, 8] but was: [1, 3, 5, 7] expected: [2, 4, 6, 8] -" - ] +"] ); } @@ -93,12 +91,10 @@ fn verify_slice_has_length_less_than_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to have a length less than 6 + &[r"expected my_thing to have a length less than 6 but was: 6 expected: < 6 -" - ] +"] ); } @@ -120,12 +116,10 @@ fn verify_slice_has_length_greater_than_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to have a length greater than 6 + &[r"expected my_thing to have a length greater than 6 but was: 6 expected: > 6 -" - ] +"] ); } @@ -148,12 +142,10 @@ fn verify_slice_has_at_most_length_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to have at most a length of 5 + &[r"expected my_thing to have at most a length of 5 but was: 6 expected: <= 5 -" - ] +"] ); } @@ -176,12 +168,10 @@ fn verify_slice_has_at_least_length_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to have at least a length of 7 + &[r"expected my_thing to have at least a length of 7 but was: 6 expected: >= 7 -" - ] +"] ); } @@ -206,7 +196,7 @@ fn verify_slice_contains_fails() { assert_eq!( failures, - &[r"assertion failed: expected my_thing to contain 21 + &[r"expected my_thing to contain 21 but was: [1, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43] expected: 21 "] @@ -234,7 +224,7 @@ fn verify_slice_iterator_contains_fails() { assert_eq!( failures, - &[r"assertion failed: expected my_thing to contain 21 + &[r"expected my_thing to contain 21 but was: [1, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43] expected: 21 "] @@ -262,7 +252,7 @@ fn verify_slice_does_not_contain_fails() { assert_eq!( failures, - &[r"assertion failed: expected my_thing to not contain 19 + &[r"expected my_thing to not contain 19 but was: [1, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43] expected: not 19 "] @@ -290,7 +280,7 @@ fn verify_slice_iterator_does_not_contain_fails() { assert_eq!( failures, - &[r"assertion failed: expected my_thing to not contain 19 + &[r"expected my_thing to not contain 19 but was: [1, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43] expected: not 19 "] @@ -318,7 +308,7 @@ fn verify_slice_contains_exactly_in_any_order_fails() { assert_eq!( failures, &[ - r"assertion failed: expected my_thing to contain exactly in any order [0, 1, 3, 5, 7, 11, 11, 13, 17, 19, 23, 29, 31, 37, 41] + r"expected my_thing to contain exactly in any order [0, 1, 3, 5, 7, 11, 11, 13, 17, 19, 23, 29, 31, 37, 41] but was: [5, 7, 11, 13, 1, 11, 3, 17, 23, 23, 29, 31, 41, 37, 43] expected: [0, 1, 3, 5, 7, 11, 11, 13, 17, 19, 23, 29, 31, 37, 41] missing: [0, 19] @@ -347,7 +337,7 @@ fn verify_slice_contains_any_of_fails() { assert_eq!( failures, &[ - r"assertion failed: expected my_thing to contain any of [0, 2, 4, 8, 16, 32, 64] + r"expected my_thing to contain any of [0, 2, 4, 8, 16, 32, 64] but was: [5, 7, 11, 13, 1, 11, 3, 17, 23, 23, 29, 31, 41, 37, 43] expected: [0, 2, 4, 8, 16, 32, 64] " @@ -374,7 +364,7 @@ fn verify_slice_does_not_contain_any_of_fails() { assert_eq!( failures, &[ - r"assertion failed: expected my_thing to not contain any of [0, 2, 4, 41, 16, 32, 64] + r"expected my_thing to not contain any of [0, 2, 4, 41, 16, 32, 64] but was: [5, 7, 11, 13, 1, 11, 3, 17, 23, 23, 29, 31, 41, 37, 43] expected: not [0, 2, 4, 41, 16, 32, 64] " @@ -401,7 +391,7 @@ fn verify_slice_contains_all_of_fails() { assert_eq!( failures, &[ - r"assertion failed: expected my_thing to contain all of [5, 18, 3, 17, 45, 1, 1, 29, 0] + r"expected my_thing to contain all of [5, 18, 3, 17, 45, 1, 1, 29, 0] but was: [5, 7, 11, 13, 1, 11, 3, 17, 23, 23, 29, 31, 41, 37, 43] expected: [5, 18, 3, 17, 45, 1, 1, 29, 0] missing: [18, 45, 0] @@ -428,13 +418,11 @@ fn verify_slice_contains_only_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to contain only [1, 3, 7, 11, 19] + &[r"expected my_thing to contain only [1, 3, 7, 11, 19] but was: [5, 11, 1, 3, 19, 17, 11, 43] expected: [1, 3, 7, 11, 19] extra: [5, 17, 43] -" - ] +"] ); } @@ -456,14 +444,12 @@ fn verify_slice_contains_only_once_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to contain only once [1, 3, 7, 11, 19] + &[r"expected my_thing to contain only once [1, 3, 7, 11, 19] but was: [5, 11, 1, 3, 3, 19, 17, 11, 3, 43] expected: [1, 3, 7, 11, 19] extra: [5, 17, 43] duplicates: [11, 3, 3, 11, 3] -" - ] +"] ); } @@ -514,7 +500,7 @@ fn verify_slice_contains_exactly_fails_out_of_order() { assert_eq!( failures, &[ - r#"assertion failed: expected my_thing to contain exactly in order ["two", "two", "one", "three", "four", "five", "six", "seven", "four", "eight", "nine"] + r#"expected my_thing to contain exactly in order ["two", "two", "one", "three", "four", "five", "six", "seven", "four", "eight", "nine"] but was: ["one", "two", "two", "three", "four", "five", "six", "four", "seven", "eight", "nine"] expected: ["two", "two", "one", "three", "four", "five", "six", "seven", "four", "eight", "nine"] missing: [] @@ -554,7 +540,7 @@ fn verify_slice_contains_exactly_fails_missing_and_extra() { assert_eq!( failures, &[ - r#"assertion failed: expected my_thing to contain exactly in order ["one", "two", "two", "three", "four", "five", "six", "six", "seven", "four", "eight", "nine"] + r#"expected my_thing to contain exactly in order ["one", "two", "two", "three", "four", "five", "six", "six", "seven", "four", "eight", "nine"] but was: ["one", "two", "six", "three", "four", "five", "six", "six", "seven", "eleven", "eight", "nine", "ten"] expected: ["one", "two", "two", "three", "four", "five", "six", "six", "seven", "four", "eight", "nine"] missing: ["two", "four"] @@ -592,7 +578,7 @@ fn verify_slice_contains_exactly_fails_expected_longer_than_vec() { assert_eq!( failures, &[ - r#"assertion failed: expected my_thing to contain exactly in order ["one", "two", "two", "three", "four", "five", "six", "four", "seven", "eight", "nine", "ten"] + r#"expected my_thing to contain exactly in order ["one", "two", "two", "three", "four", "five", "six", "four", "seven", "eight", "nine", "ten"] but was: ["one", "two", "two", "three", "four", "five", "six", "four", "seven", "eight", "nine"] expected: ["one", "two", "two", "three", "four", "five", "six", "four", "seven", "eight", "nine", "ten"] missing: ["ten"] @@ -655,7 +641,7 @@ fn verify_slice_contains_sequence_fails() { assert_eq!( failures, &[ - r#"assertion failed: expected my_thing to contain the sequence ["two", "three", "four", "five", "six", "six", "four"] + r#"expected my_thing to contain the sequence ["two", "three", "four", "five", "six", "six", "four"] but was: ["one", "two", "two", "three", "four", "five", "six", "four", "two", "seven", "two", "three", "five", "four", "six", "four", "eight", "nine", "ten"] expected: ["two", "three", "four", "five", "six", "six", "four"] missing: ["six", "four"] @@ -684,7 +670,7 @@ fn verify_slice_contains_sequence_fails_expected_longer_than_vec() { assert_eq!( failures, &[ - r#"assertion failed: expected my_thing to contain the sequence ["one", "two", "three", "four", "five", "six", "seven"] + r#"expected my_thing to contain the sequence ["one", "two", "three", "four", "five", "six", "seven"] but was: ["one", "two", "three", "four", "five", "six"] expected: ["one", "two", "three", "four", "five", "six", "seven"] missing: ["seven"] @@ -749,7 +735,7 @@ fn verify_slice_contains_all_in_order_fails() { assert_eq!( failures, &[ - r#"assertion failed: expected my_thing to contain all of ["one", "two", "two", "seven", "two", "three", "six", "six", "ten"] in order + r#"expected my_thing to contain all of ["one", "two", "two", "seven", "two", "three", "six", "six", "ten"] in order but was: ["one", "two", "two", "three", "four", "five", "six", "four", "two", "seven", "two", "three", "five", "four", "six", "four", "eight", "nine", "ten"] expected: ["one", "two", "two", "seven", "two", "three", "six", "six", "ten"] missing: ["six"] @@ -797,14 +783,12 @@ fn verify_vec_starts_with_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to start with [13, 5, 7, 1, 19] + &[r"expected my_thing to start with [13, 5, 7, 1, 19] but was: [13, 5, 7, 19, 1, 3, 11, 29, 23, 31, 37] expected: [13, 5, 7, 1, 19] missing: [1, 19] extra: [19, 1] -" - ] +"] ); } @@ -820,7 +804,7 @@ fn verify_empty_vec_starts_with_expected_sequence_longer_than_vec_fails() { assert_eq!( failures, &[ - r"assertion failed: expected my_thing to start with [13, 5, 7, 19, 1, 3, 11, 29, 23, 31, 37] + r"expected my_thing to start with [13, 5, 7, 19, 1, 3, 11, 29, 23, 31, 37] but was: [13, 5, 7, 19, 1, 3, 11, 29, 23, 31] expected: [13, 5, 7, 19, 1, 3, 11, 29, 23, 31, 37] missing: [37] @@ -869,14 +853,12 @@ fn verify_vec_ends_with_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to end with [11, 23, 23, 31, 73] + &[r"expected my_thing to end with [11, 23, 23, 31, 73] but was: [13, 5, 7, 19, 1, 3, 11, 29, 23, 31, 37] expected: [11, 23, 23, 31, 73] missing: [23, 73] extra: [29, 37] -" - ] +"] ); } @@ -892,7 +874,7 @@ fn verify_empty_vec_ends_with_expected_sequence_longer_than_vec_fails() { assert_eq!( failures, &[ - r"assertion failed: expected my_thing to end with [41, 13, 5, 7, 19, 1, 3, 11, 29, 23, 31] + r"expected my_thing to end with [41, 13, 5, 7, 19, 1, 3, 11, 29, 23, 31] but was: [13, 5, 7, 19, 1, 3, 11, 29, 23, 31] expected: [41, 13, 5, 7, 19, 1, 3, 11, 29, 23, 31] missing: [41] @@ -917,7 +899,7 @@ mod colored { assert_eq!( failures, - &["assertion failed: expected subject to contain 21\n \ + &["expected subject to contain 21\n \ but was: [\u{1b}[31m13\u{1b}[0m, \u{1b}[31m5\u{1b}[0m, \u{1b}[31m7\u{1b}[0m, \u{1b}[31m19\u{1b}[0m, \u{1b}[31m1\u{1b}[0m, \u{1b}[31m3\u{1b}[0m, \u{1b}[31m11\u{1b}[0m, \u{1b}[31m29\u{1b}[0m, \u{1b}[31m23\u{1b}[0m, \u{1b}[31m31\u{1b}[0m, \u{1b}[31m37\u{1b}[0m]\n \ expected: \u{1b}[32m21\u{1b}[0m\n\ "] @@ -935,7 +917,7 @@ mod colored { assert_eq!( failures, - &["assertion failed: expected subject to not contain 19\n \ + &["expected subject to not contain 19\n \ but was: [13, 5, 7, \u{1b}[31m19\u{1b}[0m, 1, 3, 11, 29, \u{1b}[31m19\u{1b}[0m, \u{1b}[31m19\u{1b}[0m, 37]\n \ expected: not \u{1b}[32m19\u{1b}[0m\n\ "] @@ -952,7 +934,7 @@ mod colored { .display_failures(); assert_eq!(failures, &[ - "assertion failed: expected subject to contain exactly in any order [1, 2, 3, 13, 8, 7, 12, 15, 31, 19, 20, 11, 31]\n \ + "expected subject to contain exactly in any order [1, 2, 3, 13, 8, 7, 12, 15, 31, 19, 20, 11, 31]\n \ but was: [13, \u{1b}[31m5\u{1b}[0m, 7, 19, 1, 3, 11, \u{1b}[31m29\u{1b}[0m, \u{1b}[31m23\u{1b}[0m, 31, \u{1b}[31m37\u{1b}[0m]\n \ expected: [1, \u{1b}[34m2\u{1b}[0m, 3, 13, \u{1b}[34m8\u{1b}[0m, 7, \u{1b}[34m12\u{1b}[0m, \u{1b}[34m15\u{1b}[0m, 31, 19, \u{1b}[34m20\u{1b}[0m, 11, \u{1b}[34m31\u{1b}[0m]\n \ missing: [2, 8, 12, 15, 20, 31]\n \ @@ -971,7 +953,7 @@ mod colored { .display_failures(); assert_eq!(failures, &[ - "assertion failed: expected subject to contain any of [2, 4, 6, 8, 9, 10, 12, 15, 32, 20, 18]\n \ + "expected subject to contain any of [2, 4, 6, 8, 9, 10, 12, 15, 32, 20, 18]\n \ but was: [\u{1b}[31m13\u{1b}[0m, \u{1b}[31m5\u{1b}[0m, \u{1b}[31m7\u{1b}[0m, \u{1b}[31m19\u{1b}[0m, \u{1b}[31m1\u{1b}[0m, \u{1b}[31m3\u{1b}[0m, \u{1b}[31m11\u{1b}[0m, \u{1b}[31m29\u{1b}[0m, \u{1b}[31m23\u{1b}[0m, \u{1b}[31m31\u{1b}[0m, \u{1b}[31m37\u{1b}[0m]\n \ expected: [\u{1b}[34m2\u{1b}[0m, \u{1b}[34m4\u{1b}[0m, \u{1b}[34m6\u{1b}[0m, \u{1b}[34m8\u{1b}[0m, \u{1b}[34m9\u{1b}[0m, \u{1b}[34m10\u{1b}[0m, \u{1b}[34m12\u{1b}[0m, \u{1b}[34m15\u{1b}[0m, \u{1b}[34m32\u{1b}[0m, \u{1b}[34m20\u{1b}[0m, \u{1b}[34m18\u{1b}[0m]\n\ " @@ -988,7 +970,7 @@ mod colored { .display_failures(); assert_eq!(failures, &[ - "assertion failed: expected subject to not contain any of [2, 4, 6, 8, 9, 10, 11, 15, 32, 20, 18]\n \ + "expected subject to not contain any of [2, 4, 6, 8, 9, 10, 11, 15, 32, 20, 18]\n \ but was: [13, 5, 7, 19, \u{1b}[31m11\u{1b}[0m, \u{1b}[31m11\u{1b}[0m, 3, \u{1b}[31m11\u{1b}[0m, 29, 23, 31, 37]\n \ expected: not [2, 4, 6, 8, 9, 10, \u{1b}[34m11\u{1b}[0m, 15, 32, 20, 18]\n\ " @@ -1005,7 +987,7 @@ mod colored { .display_failures(); assert_eq!(failures, &[ - "assertion failed: expected subject to contain all of [2, 3, 5, 20, 11, 13, 19, 37, 22]\n \ + "expected subject to contain all of [2, 3, 5, 20, 11, 13, 19, 37, 22]\n \ but was: [13, 5, \u{1b}[31m7\u{1b}[0m, 19, \u{1b}[31m1\u{1b}[0m, 3, 11, \u{1b}[31m29\u{1b}[0m, \u{1b}[31m23\u{1b}[0m, \u{1b}[31m31\u{1b}[0m, 37]\n \ expected: [\u{1b}[34m2\u{1b}[0m, 3, 5, \u{1b}[34m20\u{1b}[0m, 11, 13, 19, 37, \u{1b}[34m22\u{1b}[0m]\n \ missing: [2, 20, 22]\n\ @@ -1023,7 +1005,7 @@ mod colored { .display_failures(); assert_eq!(failures, &[ - "assertion failed: expected subject to contain only [13, 3, 5, 20, 11, 13, 19, 37, 22]\n \ + "expected subject to contain only [13, 3, 5, 20, 11, 13, 19, 37, 22]\n \ but was: [13, 5, \u{1b}[31m7\u{1b}[0m, 19, \u{1b}[31m1\u{1b}[0m, 3, 11, \u{1b}[31m29\u{1b}[0m, \u{1b}[31m23\u{1b}[0m, \u{1b}[31m31\u{1b}[0m, 37]\n \ expected: [13, 3, 5, \u{1b}[34m20\u{1b}[0m, 11, 13, 19, 37, \u{1b}[34m22\u{1b}[0m]\n \ extra: [7, 1, 29, 23, 31]\n\ @@ -1043,7 +1025,7 @@ mod colored { assert_eq!( failures, &[ - "assertion failed: expected subject to contain only once [1, 3, 7, 11, 19]\n \ + "expected subject to contain only once [1, 3, 7, 11, 19]\n \ but was: [\u{1b}[31m5\u{1b}[0m, \u{1b}[31m11\u{1b}[0m, 1, \u{1b}[31m3\u{1b}[0m, \u{1b}[31m3\u{1b}[0m, 19, \u{1b}[31m17\u{1b}[0m, \u{1b}[31m11\u{1b}[0m, \u{1b}[31m3\u{1b}[0m, \u{1b}[31m43\u{1b}[0m]\n \ expected: [1, \u{1b}[34m3\u{1b}[0m, \u{1b}[34m7\u{1b}[0m, \u{1b}[34m11\u{1b}[0m, 19]\n \ extra: [5, 17, 43]\n \ @@ -1063,7 +1045,7 @@ mod colored { .display_failures(); assert_eq!(failures, &[ - "assertion failed: expected subject to contain exactly in order [13, 20, 5, 19, 11, 29, 8, 1, 23, 31, 41]\n \ + "expected subject to contain exactly in order [13, 20, 5, 19, 11, 29, 8, 1, 23, 31, 41]\n \ but was: [13, \u{1b}[31m5\u{1b}[0m, \u{1b}[31m7\u{1b}[0m, 19, \u{1b}[31m1\u{1b}[0m, \u{1b}[31m3\u{1b}[0m, \u{1b}[31m11\u{1b}[0m, \u{1b}[31m29\u{1b}[0m, 23, 31, \u{1b}[31m37\u{1b}[0m]\n \ expected: [13, \u{1b}[33m20\u{1b}[0m, \u{1b}[33m5\u{1b}[0m, 19, \u{1b}[33m11\u{1b}[0m, \u{1b}[33m29\u{1b}[0m, \u{1b}[33m8\u{1b}[0m, \u{1b}[33m1\u{1b}[0m, 23, 31, \u{1b}[33m41\u{1b}[0m]\n \ missing: [20, 8, 41]\n \ @@ -1085,7 +1067,7 @@ mod colored { assert_eq!( failures, &[ - "assertion failed: expected subject to contain the sequence [19, 3, 7, 11, 29]\n \ + "expected subject to contain the sequence [19, 3, 7, 11, 29]\n \ but was: [13, 5, 7, 19, \u{1b}[31m1\u{1b}[0m, \u{1b}[31m3\u{1b}[0m, 11, 29, 23, 31, 37]\n \ expected: [19, \u{1b}[33m3\u{1b}[0m, \u{1b}[33m7\u{1b}[0m, 11, 29]\n \ missing: [3, 7]\n \ @@ -1107,7 +1089,7 @@ mod colored { assert_eq!( failures, &[ - "assertion failed: expected subject to contain all of [13, 3, 7, 22, 11, 20, 29, 37] in order\n \ + "expected subject to contain all of [13, 3, 7, 22, 11, 20, 29, 37] in order\n \ but was: [13, 5, 7, 19, 1, 3, 11, 29, 23, 31, 37]\n \ expected: [13, 3, \u{1b}[33m7\u{1b}[0m, \u{1b}[33m22\u{1b}[0m, 11, \u{1b}[33m20\u{1b}[0m, 29, 37]\n \ missing: [7, 22, 20]\n\ @@ -1128,7 +1110,7 @@ mod colored { assert_eq!( failures, &[ - "assertion failed: expected subject to start with [13, 5, 8, 19, 4]\n \ + "expected subject to start with [13, 5, 8, 19, 4]\n \ but was: [13, 5, \u{1b}[31m7\u{1b}[0m, 19, \u{1b}[31m1\u{1b}[0m, 3, 11, 29, 23, 31, 37]\n \ expected: [13, 5, \u{1b}[33m8\u{1b}[0m, 19, \u{1b}[33m4\u{1b}[0m]\n \ missing: [8, 4]\n \ @@ -1150,7 +1132,7 @@ mod colored { assert_eq!( failures, &[ - "assertion failed: expected subject to end with [3, 11, 28, 29, 30, 37]\n \ + "expected subject to end with [3, 11, 28, 29, 30, 37]\n \ but was: [13, 5, 7, 19, 1, 3, 11, \u{1b}[31m29\u{1b}[0m, \u{1b}[31m23\u{1b}[0m, \u{1b}[31m31\u{1b}[0m, 37]\n \ expected: [3, 11, \u{1b}[33m28\u{1b}[0m, \u{1b}[33m29\u{1b}[0m, \u{1b}[33m30\u{1b}[0m, 37]\n \ missing: [28, 29, 30]\n \ diff --git a/src/spec/mod.rs b/src/spec/mod.rs index 8a74593..0f7f0a1 100644 --- a/src/spec/mod.rs +++ b/src/spec/mod.rs @@ -173,7 +173,7 @@ macro_rules! assert_that_code { /// .display_failures(); /// /// assert_that!(failures).contains_exactly([ -/// r#"assertion failed: expected || { divide(7, 0); } to not panic, but did panic +/// r#"expected || { divide(7, 0); } to not panic, but did panic /// with message: "attempt to divide by zero" /// "# /// ]); @@ -183,7 +183,7 @@ macro_rules! assert_that_code { /// .display_failures(); /// /// assert_that!(failures).contains_exactly([ -/// r#"assertion failed: expected || { divide(7, 0); } to panic with message "division by zero" +/// r#"expected || { divide(7, 0); } to panic with message "division by zero" /// but was: "attempt to divide by zero" /// expected: "division by zero" /// "# @@ -296,11 +296,11 @@ pub fn assert_that<'a, S>(subject: S) -> Spec<'a, S, PanicOnFail> { /// .display_failures(); /// /// assert_that!(failures).contains_exactly([ -/// r#"assertion failed: expected my_thing to start with "nibh" +/// r#"expected my_thing to start with "nibh" /// but was: "vel tempor augue delenit" /// expected: "nibh" /// "#, -/// r#"assertion failed: expected my_thing to end with "magna" +/// r#"expected my_thing to end with "magna" /// but was: "vel tempor augue delenit" /// expected: "magna" /// "#, @@ -393,7 +393,7 @@ where /// .display_failures(); /// /// assert_that!(failures).contains_exactly([ -/// r#"assertion failed: expected the closure to not panic, but did panic +/// r#"expected the closure to not panic, but did panic /// with message: "attempt to divide by zero" /// "# /// ]); @@ -403,7 +403,7 @@ where /// .display_failures(); /// /// assert_that!(failures).contains_exactly([ -/// r#"assertion failed: expected the closure to panic with message "division by zero" +/// r#"expected the closure to panic with message "division by zero" /// but was: "attempt to divide by zero" /// expected: "division by zero" /// "# @@ -910,7 +910,7 @@ where /// let failures = verify_that!(22).satisfies(is_odd).display_failures(); /// /// assert_that!(failures).contains_exactly([ - /// "assertion failed: expected 22 to satisfy the given predicate, but returned false\n" + /// "expected 22 to satisfy the given predicate, but returned false\n" /// ]); /// ``` /// @@ -952,7 +952,7 @@ where /// .display_failures(); /// /// assert_that!(failures).contains_exactly([ - /// "assertion failed: expected my number to be odd\n" + /// "expected my number to be odd\n" /// ]); /// ``` /// @@ -1016,11 +1016,11 @@ impl Spec<'_, S, CollectFailures> { /// assertions in the panic message: /// /// ```console - /// assertion failed: expected subject to contain "unimportant" + /// expected subject to contain "unimportant" /// but was: "the answer to all important questions is 42" /// expected: "unimportant" /// - /// assertion failed: expected subject to have at most a length of 41 + /// expected subject to have at most a length of 41 /// but was: 43 /// expected: <= 41 /// ``` @@ -1079,15 +1079,15 @@ impl<'a, I, R> Spec<'a, I, R> { /// will print: /// /// ```console - /// assertion failed: expected numbers 1. item to be greater than 2 + /// expected numbers 1. item to be greater than 2 /// but was: 2 /// expected: > 2 /// - /// assertion failed: expected numbers 4. item to be at most 7 + /// expected numbers 4. item to be at most 7 /// but was: 8 /// expected: <= 7 /// - /// assertion failed: expected numbers 5. item to be at most 7 + /// expected numbers 5. item to be at most 7 /// but was: 10 /// expected: <= 7 /// ``` @@ -1145,10 +1145,10 @@ impl Display for AssertFailure { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match &self.description { None => { - writeln!(f, "assertion failed: {}", &self.message)?; + writeln!(f, "{}", &self.message)?; }, Some(description) => { - writeln!(f, "assertion failed: {description}\n{}", &self.message)?; + writeln!(f, "{description}\n{}", &self.message)?; }, } Ok(()) diff --git a/src/spec/tests.rs b/src/spec/tests.rs index 3abbbe1..4270f67 100644 --- a/src/spec/tests.rs +++ b/src/spec/tests.rs @@ -57,8 +57,9 @@ fn assert_failure_display_format() { location: Some(OwnedLocation::new("src/thing_module/thing_test.rs", 54, 13)), }; - assert_that!(format!("{}", failure)) - .is_equal_to("assertion failed: this thing is the best\nbut this thing is the worst\ninstead it should be the best\n"); + assert_that!(format!("{}", failure)).is_equal_to( + "this thing is the best\nbut this thing is the worst\ninstead it should be the best\n", + ); } #[test] @@ -120,7 +121,7 @@ fn assert_that_macro_with_borrowed_str_subject() { #[test] #[should_panic( - expected = "assertion failed: expected ultimate_answer to be equal to 42\n but was: 51\n expected: 42\n" + expected = "expected ultimate_answer to be equal to 42\n but was: 51\n expected: 42\n" )] fn assert_that_macro_is_equal_to_with_integers_fails() { let ultimate_answer = 51; @@ -149,11 +150,11 @@ fn verify_that_option_is_some_chained_with_has_value_fails_as_none() { assert_eq!( failures, &[ - r"assertion failed: expected my_variable to be Some(_) + r"expected my_variable to be Some(_) but was: None expected: Some(_) ", - r"assertion failed: expected my_variable to be some containing 42 + r"expected my_variable to be some containing 42 but was: None expected: Some(42) ", @@ -172,13 +173,11 @@ fn verify_that_a_subject_with_custom_description_is_equal_to_fails() { assert_eq!( failures, - &[ - r"assertion failed: the answer to all important questions is 42 + &[r"the answer to all important questions is 42 expected subject to be equal to 42 but was: 51 expected: 42 -" - ] +"] ); } @@ -194,13 +193,11 @@ fn verify_that_a_subject_with_custom_name_and_custom_description_is_equal_to_fai assert_eq!( failures, - &[ - r"assertion failed: the answer to all important questions is 42 + &[r"the answer to all important questions is 42 expected answer to be equal to 42 but was: 51 expected: 42 -" - ] +"] ); } @@ -215,11 +212,11 @@ fn soft_assertions_with_chained_assertion_methods() { } #[test] -#[should_panic = "assertion failed: expected subject to contain \"unimportant\"\n \ +#[should_panic = "expected subject to contain \"unimportant\"\n \ but was: \"the answer to all important questions is 42\"\n \ expected: \"unimportant\"\n\ \n\ - assertion failed: expected subject to have at most a length of 41\n \ + expected subject to have at most a length of 41\n \ but was: 43\n \ expected: <= 41\n\ "] @@ -251,7 +248,7 @@ fn assert_each_item_of_a_borrowed_iterator() { } #[test] -#[should_panic = "assertion failed: expected numbers 2. item to be not equal to 4\n but was: 4\n expected: not 4\n"] +#[should_panic = "expected numbers 2. item to be not equal to 4\n but was: 4\n expected: not 4\n"] fn assert_each_item_of_an_iterator_panics_if_one_assertion_fails() { let subject = [2, 4, 6, 8, 10]; @@ -273,15 +270,15 @@ fn verify_assert_each_item_of_an_iterator_fails() { assert_eq!( failures, &[ - r"assertion failed: expected numbers 1. item to be greater than 2 + r"expected numbers 1. item to be greater than 2 but was: 2 expected: > 2 ", - r"assertion failed: expected numbers 4. item to be at most 7 + r"expected numbers 4. item to be at most 7 but was: 8 expected: <= 7 ", - r"assertion failed: expected numbers 5. item to be at most 7 + r"expected numbers 5. item to be at most 7 but was: 10 expected: <= 7 ", @@ -294,11 +291,11 @@ mod colored { use crate::prelude::*; #[test] - #[should_panic = "assertion failed: expected subject to contain \"unimportant\"\n \ + #[should_panic = "expected subject to contain \"unimportant\"\n \ but was: \"\u{1b}[31mthe answer to all important questions is 42\u{1b}[0m\"\n \ expected: \"\u{1b}[32munimportant\u{1b}[0m\"\n\ \n\ - assertion failed: expected subject to have at most a length of 41\n \ + expected subject to have at most a length of 41\n \ but was: \u{1b}[31m43\u{1b}[0m\n \ expected: <= \u{1b}[32m41\u{1b}[0m\n\ "] diff --git a/src/string/tests.rs b/src/string/tests.rs index d173450..e69e602 100644 --- a/src/string/tests.rs +++ b/src/string/tests.rs @@ -83,7 +83,7 @@ fn verify_string_is_equal_to_str_fails() { assert_eq!( failures, &[ - r#"assertion failed: expected my_thing to be equal to "aute duis eleifend molestie" + r#"expected my_thing to be equal to "aute duis eleifend molestie" but was: "" expected: "aute duis eleifend molestie" "# @@ -144,7 +144,7 @@ fn verify_str_is_empty_fails() { assert_eq!( failures, - &[r#"assertion failed: expected my_thing to be empty + &[r#"expected my_thing to be empty but was: "ABC" expected: "#] @@ -162,7 +162,7 @@ fn verify_string_is_not_empty_fails() { assert_eq!( failures, - &[r#"assertion failed: expected my_thing to be not empty + &[r#"expected my_thing to be not empty but was: "" expected: "#] @@ -201,7 +201,7 @@ fn verify_str_has_length_fails() { assert_eq!( failures, - &[r"assertion failed: expected my_thing to have a length of 29 + &[r"expected my_thing to have a length of 29 but was: 28 expected: 29 "] @@ -226,12 +226,10 @@ fn verify_has_length_in_range_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to have a length within range 1..25 + &[r"expected my_thing to have a length within range 1..25 but was: 25 expected: 1..25 -" - ] +"] ); } @@ -253,12 +251,10 @@ fn verify_has_length_in_inclusive_range_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to have a length within range 1..=24 + &[r"expected my_thing to have a length within range 1..=24 but was: 25 expected: 1..=24 -" - ] +"] ); } @@ -280,12 +276,10 @@ fn verify_string_has_length_less_than_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to have a length less than 25 + &[r"expected my_thing to have a length less than 25 but was: 25 expected: < 25 -" - ] +"] ); } @@ -307,12 +301,10 @@ fn verify_string_has_length_greater_than_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to have a length greater than 28 + &[r"expected my_thing to have a length greater than 28 but was: 28 expected: > 28 -" - ] +"] ); } @@ -335,12 +327,10 @@ fn verify_string_has_at_most_length_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to have at most a length of 29 + &[r"expected my_thing to have at most a length of 29 but was: 30 expected: <= 29 -" - ] +"] ); } @@ -363,12 +353,10 @@ fn verify_string_has_at_least_length_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to have at least a length of 22 + &[r"expected my_thing to have at least a length of 22 but was: 21 expected: >= 22 -" - ] +"] ); } @@ -415,12 +403,10 @@ fn verify_str_has_char_count_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to have a char count of 7 + &[r"expected my_thing to have a char count of 7 but was: 5 expected: 7 -" - ] +"] ); } @@ -463,12 +449,10 @@ fn verify_str_has_char_count_in_range_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to have a char count within 6..12 + &[r"expected my_thing to have a char count within 6..12 but was: 5 expected: 6..12 -" - ] +"] ); } @@ -490,12 +474,10 @@ fn verify_str_has_char_count_in_inclusive_range_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to have a char count within 6..=12 + &[r"expected my_thing to have a char count within 6..=12 but was: 5 expected: 6..=12 -" - ] +"] ); } @@ -517,12 +499,10 @@ fn verify_string_has_char_count_less_than_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to have a char count less than 7 + &[r"expected my_thing to have a char count less than 7 but was: 7 expected: < 7 -" - ] +"] ); } @@ -544,12 +524,10 @@ fn verify_string_has_char_count_greater_than_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to have a char count greater than 7 + &[r"expected my_thing to have a char count greater than 7 but was: 7 expected: > 7 -" - ] +"] ); } @@ -572,12 +550,10 @@ fn verify_string_has_at_most_char_count_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to have at most a char count of 6 + &[r"expected my_thing to have at most a char count of 6 but was: 7 expected: <= 6 -" - ] +"] ); } @@ -600,12 +576,10 @@ fn verify_string_has_at_least_char_count_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to have at least a char count of 8 + &[r"expected my_thing to have at least a char count of 8 but was: 7 expected: >= 8 -" - ] +"] ); } @@ -655,12 +629,10 @@ fn verify_string_contains_other_str_fails() { assert_eq!( failures, - &[ - r#"assertion failed: expected my_thing to contain "not a substring" + &[r#"expected my_thing to contain "not a substring" but was: "invidunt eos hendrerit commodo" expected: "not a substring" -"# - ] +"#] ); } @@ -675,12 +647,10 @@ fn verify_string_contains_other_string_fails() { assert_eq!( failures, - &[ - r#"assertion failed: expected my_thing to contain "not a substring" + &[r#"expected my_thing to contain "not a substring" but was: "invidunt eos hendrerit commodo" expected: "not a substring" -"# - ] +"#] ); } @@ -695,7 +665,7 @@ fn verify_string_contains_char_fails() { assert_eq!( failures, - &[r#"assertion failed: expected my_thing to contain 'Q' + &[r#"expected my_thing to contain 'Q' but was: "consectetur ex hendrerit officia" expected: 'Q' "#] @@ -734,12 +704,10 @@ fn verify_str_contains_any_char_of_a_slice_of_chars_fails() { assert_eq!( failures, - &[ - r#"assertion failed: expected my_thing to contain any of ['x', 'y', 'z'] + &[r#"expected my_thing to contain any of ['x', 'y', 'z'] but was: "luptatum in nihil laoreet" expected: ['x', 'y', 'z'] -"# - ] +"#] ); } @@ -754,12 +722,10 @@ fn verify_string_contains_any_char_of_an_array_of_chars_fails() { assert_eq!( failures, - &[ - r#"assertion failed: expected my_thing to contain any of ['x', 'y', 'z'] + &[r#"expected my_thing to contain any of ['x', 'y', 'z'] but was: "luptatum in nihil laoreet" expected: ['x', 'y', 'z'] -"# - ] +"#] ); } @@ -774,12 +740,10 @@ fn verify_str_contains_any_char_of_a_borrowed_array_of_chars_fails() { assert_eq!( failures, - &[ - r#"assertion failed: expected my_thing to contain any of ['x', 'y', 'z'] + &[r#"expected my_thing to contain any of ['x', 'y', 'z'] but was: "luptatum in nihil laoreet" expected: ['x', 'y', 'z'] -"# - ] +"#] ); } @@ -829,12 +793,10 @@ fn verify_string_does_not_contain_other_str_fails() { assert_eq!( failures, - &[ - r#"assertion failed: expected my_thing to not contain " eos " + &[r#"expected my_thing to not contain " eos " but was: "invidunt eos hendrerit commodo" expected: not " eos " -"# - ] +"#] ); } @@ -849,12 +811,10 @@ fn verify_string_does_not_contain_other_string_fails() { assert_eq!( failures, - &[ - r#"assertion failed: expected my_thing to not contain "eos hend" + &[r#"expected my_thing to not contain "eos hend" but was: "invidunt eos hendrerit commodo" expected: not "eos hend" -"# - ] +"#] ); } @@ -869,7 +829,7 @@ fn verify_string_does_not_contain_char_fails() { assert_eq!( failures, - &[r#"assertion failed: expected my_thing to not contain 'x' + &[r#"expected my_thing to not contain 'x' but was: "consectetur ex hendrerit officia" expected: not 'x' "#] @@ -908,12 +868,10 @@ fn verify_str_does_not_contain_any_char_of_a_slice_of_chars_fails() { assert_eq!( failures, - &[ - r#"assertion failed: expected my_thing to not contain any of ['x', 'n', 'z'] + &[r#"expected my_thing to not contain any of ['x', 'n', 'z'] but was: "luptatum in nihil laoreet" expected: not ['x', 'n', 'z'] -"# - ] +"#] ); } @@ -928,12 +886,10 @@ fn verify_string_does_not_contain_any_char_of_an_array_of_chars_fails() { assert_eq!( failures, - &[ - r#"assertion failed: expected my_thing to not contain any of ['d', 'k', 'n'] + &[r#"expected my_thing to not contain any of ['d', 'k', 'n'] but was: "luptatum in nihil laoreet" expected: not ['d', 'k', 'n'] -"# - ] +"#] ); } @@ -948,12 +904,10 @@ fn verify_str_does_not_contain_any_char_of_a_borrowed_array_of_chars_fails() { assert_eq!( failures, - &[ - r#"assertion failed: expected my_thing to not contain any of ['u', 'a', 'l'] + &[r#"expected my_thing to not contain any of ['u', 'a', 'l'] but was: "luptatum in nihil laoreet" expected: not ['u', 'a', 'l'] -"# - ] +"#] ); } @@ -1010,12 +964,10 @@ fn verify_string_starts_with_str_fails() { assert_eq!( failures, - &[ - r#"assertion failed: expected my_thing to start with "false start" + &[r#"expected my_thing to start with "false start" but was: "possim deserunt obcaecat hendrerit" expected: "false start" -"# - ] +"#] ); } @@ -1030,12 +982,10 @@ fn verify_string_starts_with_string_fails() { assert_eq!( failures, - &[ - r#"assertion failed: expected my_thing to start with "false start" + &[r#"expected my_thing to start with "false start" but was: "possim deserunt obcaecat hendrerit" expected: "false start" -"# - ] +"#] ); } @@ -1050,7 +1000,7 @@ fn verify_string_starts_with_char_fails() { assert_eq!( failures, - &[r#"assertion failed: expected my_thing to start with 'X' + &[r#"expected my_thing to start with 'X' but was: "possim deserunt obcaecat hendrerit" expected: 'X' "#] @@ -1110,12 +1060,10 @@ fn verify_string_ends_with_str_fails() { assert_eq!( failures, - &[ - r#"assertion failed: expected my_thing to end with "abrupt end" + &[r#"expected my_thing to end with "abrupt end" but was: "possim deserunt obcaecat hendrerit" expected: "abrupt end" -"# - ] +"#] ); } @@ -1130,12 +1078,10 @@ fn verify_string_ends_with_string_fails() { assert_eq!( failures, - &[ - r#"assertion failed: expected my_thing to end with "abrupt end" + &[r#"expected my_thing to end with "abrupt end" but was: "possim deserunt obcaecat hendrerit" expected: "abrupt end" -"# - ] +"#] ); } @@ -1150,7 +1096,7 @@ fn verify_string_ends_with_char_fails() { assert_eq!( failures, - &[r#"assertion failed: expected my_thing to end with 'Z' + &[r#"expected my_thing to end with 'Z' but was: "possim deserunt obcaecat hendrerit" expected: 'Z' "#] @@ -1210,12 +1156,10 @@ fn verify_string_does_not_start_with_str_fails() { assert_eq!( failures, - &[ - r#"assertion failed: expected my_thing to not start with "possim des" + &[r#"expected my_thing to not start with "possim des" but was: "possim deserunt obcaecat hendrerit" expected: not "possim des" -"# - ] +"#] ); } @@ -1230,12 +1174,10 @@ fn verify_string_does_not_start_with_string_fails() { assert_eq!( failures, - &[ - r#"assertion failed: expected my_thing to not start with "poss" + &[r#"expected my_thing to not start with "poss" but was: "possim deserunt obcaecat hendrerit" expected: not "poss" -"# - ] +"#] ); } @@ -1250,7 +1192,7 @@ fn verify_string_does_not_start_with_char_fails() { assert_eq!( failures, - &[r#"assertion failed: expected my_thing to not start with 'p' + &[r#"expected my_thing to not start with 'p' but was: "possim deserunt obcaecat hendrerit" expected: not 'p' "#] @@ -1310,12 +1252,10 @@ fn verify_string_does_not_end_with_str_fails() { assert_eq!( failures, - &[ - r#"assertion failed: expected my_thing to not end with "rerit" + &[r#"expected my_thing to not end with "rerit" but was: "possim deserunt obcaecat hendrerit" expected: not "rerit" -"# - ] +"#] ); } @@ -1330,12 +1270,10 @@ fn verify_string_does_not_end_with_string_fails() { assert_eq!( failures, - &[ - r#"assertion failed: expected my_thing to not end with "caecat hendrerit" + &[r#"expected my_thing to not end with "caecat hendrerit" but was: "possim deserunt obcaecat hendrerit" expected: not "caecat hendrerit" -"# - ] +"#] ); } @@ -1350,7 +1288,7 @@ fn verify_string_does_not_end_with_char_fails() { assert_eq!( failures, - &[r#"assertion failed: expected my_thing to not end with 't' + &[r#"expected my_thing to not end with 't' but was: "possim deserunt obcaecat hendrerit" expected: not 't' "#] @@ -1379,12 +1317,10 @@ mod regex { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to match the regex \b\w{12}\b + &[r"expected my_thing to match the regex \b\w{12}\b but was: volutpat lobortis aliquam diam does not match regex: \b\w{12}\b -" - ] +"] ); } @@ -1407,7 +1343,7 @@ mod regex { assert_eq!( failures, &[ - r"assertion failed: expected my_thing to not match the regex ^[a-zA-Z0-9 ]{8,32}$ + r"expected my_thing to not match the regex ^[a-zA-Z0-9 ]{8,32}$ but was: volutpat lobortis aliquam diam does match regex: ^[a-zA-Z0-9 ]{8,32}$ " @@ -1455,7 +1391,7 @@ mod colored { assert_eq!( failures, &[ - "assertion failed: expected subject to be equal to \"invi wisi exercitation anim placerat\"\n \ + "expected subject to be equal to \"invi wisi exercitation anim placerat\"\n \ but was: \"invi\u{1b}[31mdunt\u{1b}[0m wisi \u{1b}[31mfacilisis \u{1b}[0mexercitation\"\n \ expected: \"invi wisi exercitation\u{1b}[34m anim placerat\u{1b}[0m\"\n\ " @@ -1472,10 +1408,12 @@ mod colored { assert_eq!( failures, - &["assertion failed: expected subject to be not equal to \"aute aliquip culpa blandit\"\n \ + &[ + "expected subject to be not equal to \"aute aliquip culpa blandit\"\n \ but was: \"aute aliquip culpa blandit\"\n \ expected: not \"aute aliquip culpa blandit\"\n\ - "] + " + ] ); } @@ -1490,7 +1428,7 @@ mod colored { assert_eq!( failures, - &["assertion failed: expected subject to be empty\n \ + &["expected subject to be empty\n \ but was: \u{1b}[31m\"voluptua quod quis dignissim\"\u{1b}[0m\n \ expected: \n\ "] @@ -1508,7 +1446,7 @@ mod colored { assert_eq!( failures, - &["assertion failed: expected subject to be not empty\n \ + &["expected subject to be not empty\n \ but was: \u{1b}[31m\"\"\u{1b}[0m\n \ expected: \n\ "] @@ -1526,12 +1464,10 @@ mod colored { assert_eq!( failures, - &[ - "assertion failed: expected subject to have a length of 29\n \ + &["expected subject to have a length of 29\n \ but was: \u{1b}[31m23\u{1b}[0m\n \ expected: \u{1b}[32m29\u{1b}[0m\n\ - " - ] + "] ); } @@ -1546,12 +1482,10 @@ mod colored { assert_eq!( failures, - &[ - "assertion failed: expected subject to have a length within range 8..=20\n \ + &["expected subject to have a length within range 8..=20\n \ but was: \u{1b}[31m26\u{1b}[0m\n \ expected: \u{1b}[32m8..=20\u{1b}[0m\n\ - " - ] + "] ); } @@ -1566,12 +1500,10 @@ mod colored { assert_eq!( failures, - &[ - "assertion failed: expected subject to contain \"status\"\n \ + &["expected subject to contain \"status\"\n \ but was: \"\u{1b}[31msanctus stet eiusmod odio\u{1b}[0m\"\n \ expected: \"\u{1b}[33mstatus\u{1b}[0m\"\n\ - " - ] + "] ); } @@ -1586,12 +1518,10 @@ mod colored { assert_eq!( failures, - &[ - "assertion failed: expected subject to contain \"status\"\n \ + &["expected subject to contain \"status\"\n \ but was: \"\u{1b}[31msanctus stet eiusmod odio\u{1b}[0m\"\n \ expected: \"\u{1b}[33mstatus\u{1b}[0m\"\n\ - " - ] + "] ); } @@ -1606,7 +1536,7 @@ mod colored { assert_eq!( failures, - &["assertion failed: expected subject to contain 'E'\n \ + &["expected subject to contain 'E'\n \ but was: \"\u{1b}[31msanctus stet eiusmod odio\u{1b}[0m\"\n \ expected: '\u{1b}[33mE\u{1b}[0m'\n\ "] @@ -1624,12 +1554,10 @@ mod colored { assert_eq!( failures, - &[ - "assertion failed: expected subject to not contain \"stet eius\"\n \ + &["expected subject to not contain \"stet eius\"\n \ but was: \"sanctus \u{1b}[31mstet eius\u{1b}[0mmod odio\"\n \ expected: not \"\u{1b}[33mstet eius\u{1b}[0m\"\n\ - " - ] + "] ); } @@ -1644,12 +1572,10 @@ mod colored { assert_eq!( failures, - &[ - "assertion failed: expected subject to not contain \"stet eius\"\n \ + &["expected subject to not contain \"stet eius\"\n \ but was: \"sanctus \u{1b}[31mstet eius\u{1b}[0mmod odio\"\n \ expected: not \"\u{1b}[33mstet eius\u{1b}[0m\"\n\ - " - ] + "] ); } @@ -1664,7 +1590,7 @@ mod colored { assert_eq!( failures, - &["assertion failed: expected subject to not contain 't'\n \ + &["expected subject to not contain 't'\n \ but was: \"sanc\u{1b}[31mt\u{1b}[0mus s\u{1b}[31mt\u{1b}[0me\u{1b}[31mtt\u{1b}[0m eiusmod odio\"\n \ expected: not '\u{1b}[33mt\u{1b}[0m'\n\ "] @@ -1682,12 +1608,10 @@ mod colored { assert_eq!( failures, - &[ - "assertion failed: expected subject to start with \"una\"\n \ + &["expected subject to start with \"una\"\n \ but was: \"\u{1b}[31mnul\u{1b}[0mla feugiat illum culpa\"\n \ expected: \"\u{1b}[32muna\u{1b}[0m\"\n\ - " - ] + "] ); } @@ -1702,12 +1626,10 @@ mod colored { assert_eq!( failures, - &[ - "assertion failed: expected subject to start with \"una\"\n \ + &["expected subject to start with \"una\"\n \ but was: \"\u{1b}[31mnul\u{1b}[0mla feugiat illum culpa\"\n \ expected: \"\u{1b}[32muna\u{1b}[0m\"\n\ - " - ] + "] ); } @@ -1722,12 +1644,10 @@ mod colored { assert_eq!( failures, - &[ - "assertion failed: expected subject to not start with \"null\"\n \ + &["expected subject to not start with \"null\"\n \ but was: \"\u{1b}[31mnull\u{1b}[0ma feugiat illum culpa\"\n \ expected: not \"\u{1b}[32mnull\u{1b}[0m\"\n\ - " - ] + "] ); } @@ -1742,12 +1662,10 @@ mod colored { assert_eq!( failures, - &[ - "assertion failed: expected subject to not start with \"null\"\n \ + &["expected subject to not start with \"null\"\n \ but was: \"\u{1b}[31mnull\u{1b}[0ma feugiat illum culpa\"\n \ expected: not \"\u{1b}[32mnull\u{1b}[0m\"\n\ - " - ] + "] ); } @@ -1762,7 +1680,7 @@ mod colored { assert_eq!( failures, - &["assertion failed: expected subject to start with 'o'\n \ + &["expected subject to start with 'o'\n \ but was: \"\u{1b}[31mc\u{1b}[0mommodo sadipscing id imperdiet\"\n \ expected: '\u{1b}[32mo\u{1b}[0m'\n\ "] @@ -1780,12 +1698,10 @@ mod colored { assert_eq!( failures, - &[ - "assertion failed: expected subject to not start with 'c'\n \ + &["expected subject to not start with 'c'\n \ but was: \"\u{1b}[31mc\u{1b}[0mommodo sadipscing id imperdiet\"\n \ expected: not '\u{1b}[32mc\u{1b}[0m'\n\ - " - ] + "] ); } @@ -1800,12 +1716,10 @@ mod colored { assert_eq!( failures, - &[ - "assertion failed: expected subject to end with \"innocence\"\n \ + &["expected subject to end with \"innocence\"\n \ but was: \"nulla feugiat il\u{1b}[31mlum culpa\u{1b}[0m\"\n \ expected: \"\u{1b}[32minnocence\u{1b}[0m\"\n\ - " - ] + "] ); } @@ -1820,12 +1734,10 @@ mod colored { assert_eq!( failures, - &[ - "assertion failed: expected subject to end with \"innocence\"\n \ + &["expected subject to end with \"innocence\"\n \ but was: \"nulla feugiat il\u{1b}[31mlum culpa\u{1b}[0m\"\n \ expected: \"\u{1b}[32minnocence\u{1b}[0m\"\n\ - " - ] + "] ); } @@ -1840,12 +1752,10 @@ mod colored { assert_eq!( failures, - &[ - "assertion failed: expected subject to not end with \"um culpa\"\n \ + &["expected subject to not end with \"um culpa\"\n \ but was: \"nulla feugiat ill\u{1b}[31mum culpa\u{1b}[0m\"\n \ expected: not \"\u{1b}[32mum culpa\u{1b}[0m\"\n\ - " - ] + "] ); } @@ -1860,12 +1770,10 @@ mod colored { assert_eq!( failures, - &[ - "assertion failed: expected subject to not end with \"lpa\"\n \ + &["expected subject to not end with \"lpa\"\n \ but was: \"nulla feugiat illum cu\u{1b}[31mlpa\u{1b}[0m\"\n \ expected: not \"\u{1b}[32mlpa\u{1b}[0m\"\n\ - " - ] + "] ); } @@ -1880,7 +1788,7 @@ mod colored { assert_eq!( failures, - &["assertion failed: expected subject to end with 'e'\n \ + &["expected subject to end with 'e'\n \ but was: \"commodo sadipscing id imperdie\u{1b}[31mt\u{1b}[0m\"\n \ expected: '\u{1b}[32me\u{1b}[0m'\n\ "] @@ -1898,12 +1806,10 @@ mod colored { assert_eq!( failures, - &[ - "assertion failed: expected subject to not end with 't'\n \ + &["expected subject to not end with 't'\n \ but was: \"commodo sadipscing id imperdie\u{1b}[31mt\u{1b}[0m\"\n \ expected: not '\u{1b}[32mt\u{1b}[0m'\n\ - " - ] + "] ); } @@ -1918,12 +1824,10 @@ mod colored { assert_eq!( failures, - &[ - "assertion failed: expected subject to contain any of ['a', 'b', 'c']\n \ + &["expected subject to contain any of ['a', 'b', 'c']\n \ but was: \"\u{1b}[31mproident tempor est sed\u{1b}[0m\"\n \ expected: \u{1b}[34m['a', 'b', 'c']\u{1b}[0m\n\ - " - ] + "] ); } @@ -1938,12 +1842,10 @@ mod colored { assert_eq!( failures, - &[ - "assertion failed: expected subject to contain any of ['a', 'b', 'c']\n \ + &["expected subject to contain any of ['a', 'b', 'c']\n \ but was: \"\u{1b}[31mproident tempor est sed\u{1b}[0m\"\n \ expected: \u{1b}[34m['a', 'b', 'c']\u{1b}[0m\n\ - " - ] + "] ); } @@ -1958,12 +1860,10 @@ mod colored { assert_eq!( failures, - &[ - "assertion failed: expected subject to contain any of ['a', 'b', 'c']\n \ + &["expected subject to contain any of ['a', 'b', 'c']\n \ but was: \"\u{1b}[31mproident tempor est sed\u{1b}[0m\"\n \ expected: \u{1b}[34m['a', 'b', 'c']\u{1b}[0m\n\ - " - ] + "] ); } @@ -1979,7 +1879,7 @@ mod colored { assert_eq!( failures, &[ - "assertion failed: expected subject to not contain any of ['r', 'b', 'c']\n \ + "expected subject to not contain any of ['r', 'b', 'c']\n \ but was: \"p\u{1b}[31mr\u{1b}[0moident tempo\u{1b}[31mr\u{1b}[0m est sed\"\n \ expected: not [\u{1b}[34m'r'\u{1b}[0m, 'b', 'c']\n\ " @@ -1999,7 +1899,7 @@ mod colored { assert_eq!( failures, &[ - "assertion failed: expected subject to not contain any of ['a', 's', 'e']\n \ + "expected subject to not contain any of ['a', 's', 'e']\n \ but was: \"proid\u{1b}[31me\u{1b}[0mnt t\u{1b}[31me\u{1b}[0mmpor \u{1b}[31mes\u{1b}[0mt \u{1b}[31mse\u{1b}[0md\"\n \ expected: not ['a', \u{1b}[34m's'\u{1b}[0m, \u{1b}[34m'e'\u{1b}[0m]\n\ " @@ -2019,7 +1919,7 @@ mod colored { assert_eq!( failures, &[ - "assertion failed: expected subject to not contain any of ['p', 'o', 'r']\n \ + "expected subject to not contain any of ['p', 'o', 'r']\n \ but was: \"\u{1b}[31mpro\u{1b}[0mident tem\u{1b}[31mpor\u{1b}[0m est sed\"\n \ expected: not [\u{1b}[34m'p'\u{1b}[0m, \u{1b}[34m'o'\u{1b}[0m, \u{1b}[34m'r'\u{1b}[0m]\n\ " @@ -2046,7 +1946,7 @@ mod colored_regex { assert_eq!( failures, &[ - "assertion failed: expected my_thing to match the regex \\b\\w{12}\\b\n \ + "expected my_thing to match the regex \\b\\w{12}\\b\n \ but was: \u{1b}[31mvolutpat lobortis aliquam diam\u{1b}[0m\n \ does not match regex: \u{1b}[32m\\b\\w{12}\\b\u{1b}[0m\n\ " @@ -2067,7 +1967,7 @@ mod colored_regex { assert_eq!( failures, &[ - "assertion failed: expected my_thing to not match the regex ^[a-zA-Z0-9 ]{8,32}$\n \ + "expected my_thing to not match the regex ^[a-zA-Z0-9 ]{8,32}$\n \ but was: \u{1b}[31mvolutpat lobortis aliquam diam\u{1b}[0m\n \ does match regex: \u{1b}[33m^[a-zA-Z0-9 ]{8,32}$\u{1b}[0m\n\ " diff --git a/src/vec/tests.rs b/src/vec/tests.rs index 385a826..5eda38b 100644 --- a/src/vec/tests.rs +++ b/src/vec/tests.rs @@ -30,12 +30,10 @@ fn verify_vec_is_equal_to_another_vec_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to be equal to [1, 3, 5, 7] + &[r"expected my_thing to be equal to [1, 3, 5, 7] but was: [2, 4, 6, 8] expected: [1, 3, 5, 7] -" - ] +"] ); } @@ -85,7 +83,7 @@ fn verify_vec_contains_fails() { assert_eq!( failures, - &[r"assertion failed: expected my_thing to contain 42 + &[r"expected my_thing to contain 42 but was: [1, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43] expected: 42 "] @@ -113,7 +111,7 @@ fn verify_vec_does_not_contain_fails() { assert_eq!( failures, - &[r"assertion failed: expected my_thing to not contain 19 + &[r"expected my_thing to not contain 19 but was: [1, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43] expected: not 19 "] @@ -141,7 +139,7 @@ fn verify_vec_contains_exactly_in_any_order_fails() { assert_eq!( failures, &[ - r"assertion failed: expected my_thing to contain exactly in any order [0, 1, 3, 5, 7, 11, 11, 13, 17, 19, 23, 29, 31, 37, 41] + r"expected my_thing to contain exactly in any order [0, 1, 3, 5, 7, 11, 11, 13, 17, 19, 23, 29, 31, 37, 41] but was: [5, 7, 11, 13, 1, 11, 3, 17, 23, 23, 29, 31, 41, 37, 43] expected: [0, 1, 3, 5, 7, 11, 11, 13, 17, 19, 23, 29, 31, 37, 41] missing: [0, 19] @@ -170,7 +168,7 @@ fn verify_vec_contains_any_of_fails() { assert_eq!( failures, &[ - r"assertion failed: expected my_thing to contain any of [0, 2, 4, 8, 16, 32, 64] + r"expected my_thing to contain any of [0, 2, 4, 8, 16, 32, 64] but was: [5, 7, 11, 13, 1, 11, 3, 17, 23, 23, 29, 31, 41, 37, 43] expected: [0, 2, 4, 8, 16, 32, 64] " @@ -197,7 +195,7 @@ fn verify_vec_does_not_contain_any_of_fails() { assert_eq!( failures, &[ - r"assertion failed: expected my_thing to not contain any of [2, 20, 4, 40, 8, 80] + r"expected my_thing to not contain any of [2, 20, 4, 40, 8, 80] but was: [5, 7, 20, 1, 17, 23, 23, 40, 20, 20, 41, 37, 43] expected: not [2, 20, 4, 40, 8, 80] " @@ -224,7 +222,7 @@ fn verify_vec_contains_all_of_fails() { assert_eq!( failures, &[ - r"assertion failed: expected my_thing to contain all of [5, 18, 3, 17, 45, 1, 1, 29, 0] + r"expected my_thing to contain all of [5, 18, 3, 17, 45, 1, 1, 29, 0] but was: [5, 7, 11, 13, 1, 11, 3, 17, 23, 23, 29, 31, 41, 37, 43] expected: [5, 18, 3, 17, 45, 1, 1, 29, 0] missing: [18, 45, 0] @@ -251,13 +249,11 @@ fn verify_vec_contains_only_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to contain only [1, 3, 7, 11, 19] + &[r"expected my_thing to contain only [1, 3, 7, 11, 19] but was: [5, 11, 1, 3, 19, 17, 11, 43] expected: [1, 3, 7, 11, 19] extra: [5, 17, 43] -" - ] +"] ); } @@ -279,14 +275,12 @@ fn verify_vec_contains_only_once_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to contain only once [1, 3, 7, 11, 19] + &[r"expected my_thing to contain only once [1, 3, 7, 11, 19] but was: [5, 11, 1, 3, 19, 17, 11, 43] expected: [1, 3, 7, 11, 19] extra: [5, 17, 43] duplicates: [11, 11] -" - ] +"] ); } @@ -337,7 +331,7 @@ fn verify_vec_contains_exactly_fails_out_of_order() { assert_eq!( failures, &[ - r#"assertion failed: expected my_thing to contain exactly in order ["two", "two", "one", "three", "four", "five", "six", "seven", "four", "eight", "nine"] + r#"expected my_thing to contain exactly in order ["two", "two", "one", "three", "four", "five", "six", "seven", "four", "eight", "nine"] but was: ["one", "two", "two", "three", "four", "five", "six", "four", "seven", "eight", "nine"] expected: ["two", "two", "one", "three", "four", "five", "six", "seven", "four", "eight", "nine"] missing: [] @@ -377,7 +371,7 @@ fn verify_vec_contains_exactly_fails_missing_and_extra() { assert_eq!( failures, &[ - r#"assertion failed: expected my_thing to contain exactly in order ["one", "two", "two", "three", "four", "five", "six", "six", "seven", "four", "eight", "nine"] + r#"expected my_thing to contain exactly in order ["one", "two", "two", "three", "four", "five", "six", "six", "seven", "four", "eight", "nine"] but was: ["one", "two", "six", "three", "four", "five", "six", "six", "seven", "eleven", "eight", "nine", "ten"] expected: ["one", "two", "two", "three", "four", "five", "six", "six", "seven", "four", "eight", "nine"] missing: ["two", "four"] @@ -415,7 +409,7 @@ fn verify_vec_contains_exactly_fails_expected_longer_than_vec() { assert_eq!( failures, &[ - r#"assertion failed: expected my_thing to contain exactly in order ["one", "two", "two", "three", "four", "five", "six", "four", "seven", "eight", "nine", "ten"] + r#"expected my_thing to contain exactly in order ["one", "two", "two", "three", "four", "five", "six", "four", "seven", "eight", "nine", "ten"] but was: ["one", "two", "two", "three", "four", "five", "six", "four", "seven", "eight", "nine"] expected: ["one", "two", "two", "three", "four", "five", "six", "four", "seven", "eight", "nine", "ten"] missing: ["ten"] @@ -478,7 +472,7 @@ fn verify_vec_contains_sequence_fails() { assert_eq!( failures, &[ - r#"assertion failed: expected my_thing to contain the sequence ["two", "three", "four", "five", "six", "six", "four"] + r#"expected my_thing to contain the sequence ["two", "three", "four", "five", "six", "six", "four"] but was: ["one", "two", "two", "three", "four", "five", "six", "four", "two", "seven", "two", "three", "five", "four", "six", "four", "eight", "nine", "ten"] expected: ["two", "three", "four", "five", "six", "six", "four"] missing: ["six", "four"] @@ -507,7 +501,7 @@ fn verify_vec_contains_sequence_fails_expected_longer_than_vec() { assert_eq!( failures, &[ - r#"assertion failed: expected my_thing to contain the sequence ["one", "two", "three", "four", "five", "six", "seven"] + r#"expected my_thing to contain the sequence ["one", "two", "three", "four", "five", "six", "seven"] but was: ["one", "two", "three", "four", "five", "six"] expected: ["one", "two", "three", "four", "five", "six", "seven"] missing: ["seven"] @@ -572,7 +566,7 @@ fn verify_vec_contains_all_in_order_fails() { assert_eq!( failures, &[ - r#"assertion failed: expected my_thing to contain all of ["one", "two", "two", "seven", "two", "three", "six", "six", "ten"] in order + r#"expected my_thing to contain all of ["one", "two", "two", "seven", "two", "three", "six", "six", "ten"] in order but was: ["one", "two", "two", "three", "four", "five", "six", "four", "two", "seven", "two", "three", "five", "four", "six", "four", "eight", "nine", "ten"] expected: ["one", "two", "two", "seven", "two", "three", "six", "six", "ten"] missing: ["six"] @@ -620,14 +614,12 @@ fn verify_vec_starts_with_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to start with [13, 5, 7, 1, 19] + &[r"expected my_thing to start with [13, 5, 7, 1, 19] but was: [13, 5, 7, 19, 1, 3, 11, 29, 23, 31, 37] expected: [13, 5, 7, 1, 19] missing: [1, 19] extra: [19, 1] -" - ] +"] ); } @@ -643,7 +635,7 @@ fn verify_empty_vec_starts_with_expected_sequence_longer_than_vec_fails() { assert_eq!( failures, &[ - r"assertion failed: expected my_thing to start with [13, 5, 7, 19, 1, 3, 11, 29, 23, 31, 37] + r"expected my_thing to start with [13, 5, 7, 19, 1, 3, 11, 29, 23, 31, 37] but was: [13, 5, 7, 19, 1, 3, 11, 29, 23, 31] expected: [13, 5, 7, 19, 1, 3, 11, 29, 23, 31, 37] missing: [37] @@ -692,14 +684,12 @@ fn verify_vec_ends_with_fails() { assert_eq!( failures, - &[ - r"assertion failed: expected my_thing to end with [11, 23, 23, 31, 73] + &[r"expected my_thing to end with [11, 23, 23, 31, 73] but was: [13, 5, 7, 19, 1, 3, 11, 29, 23, 31, 37] expected: [11, 23, 23, 31, 73] missing: [23, 73] extra: [29, 37] -" - ] +"] ); } @@ -715,7 +705,7 @@ fn verify_empty_vec_ends_with_expected_sequence_longer_than_vec_fails() { assert_eq!( failures, &[ - r"assertion failed: expected my_thing to end with [41, 13, 5, 7, 19, 1, 3, 11, 29, 23, 31] + r"expected my_thing to end with [41, 13, 5, 7, 19, 1, 3, 11, 29, 23, 31] but was: [13, 5, 7, 19, 1, 3, 11, 29, 23, 31] expected: [41, 13, 5, 7, 19, 1, 3, 11, 29, 23, 31] missing: [41] @@ -740,7 +730,7 @@ mod colored { .display_failures(); assert_eq!(failures, &[ - "assertion failed: expected subject to be equal to [1, 3, 5, 7, 11, 13, 19, 23, 29, 31, 37]\n \ + "expected subject to be equal to [1, 3, 5, 7, 11, 13, 19, 23, 29, 31, 37]\n \ but was: [\u{1b}[31m13\u{1b}[0m, 5, 7, \u{1b}[31m19\u{1b}[0m, \u{1b}[31m1\u{1b}[0m, \u{1b}[31m3\u{1b}[0m, 11, \u{1b}[31m29\u{1b}[0m, 23, 31, 37] expected: [\u{1b}[34m1\u{1b}[0m, \u{1b}[34m3\u{1b}[0m, 5, 7, 11, \u{1b}[34m13\u{1b}[0m, \u{1b}[34m19\u{1b}[0m, 23, \u{1b}[34m29\u{1b}[0m, 31, 37] "