|
1 | 1 | use crate::assertions::AssertChar; |
2 | 2 | use crate::colored::{mark_missing_string, mark_unexpected_char}; |
3 | 3 | use crate::expectations::{ |
4 | | - is_alphabetic, is_alphanumeric, is_ascii, is_control_char, is_digit, is_lower_case, |
5 | | - is_upper_case, is_whitespace, IsAlphabetic, IsAlphanumeric, IsAscii, IsControlChar, IsDigit, |
6 | | - IsLowerCase, IsUpperCase, IsWhitespace, |
| 4 | + IsAlphabetic, IsAlphanumeric, IsAscii, IsControlChar, IsDigit, IsLowerCase, IsUpperCase, |
| 5 | + IsWhitespace, is_alphabetic, is_alphanumeric, is_ascii, is_control_char, is_digit, |
| 6 | + is_lower_case, is_upper_case, is_whitespace, |
7 | 7 | }; |
8 | 8 | use crate::spec::{DiffFormat, Expectation, Expression, FailingStrategy, Invertible, Spec}; |
9 | 9 | use crate::std::format; |
@@ -102,7 +102,9 @@ impl Expectation<char> for IsLowerCase { |
102 | 102 | }; |
103 | 103 | let marked_actual = mark_unexpected_char(*actual, format); |
104 | 104 | let marked_expected = mark_missing_string(&expected, format); |
105 | | - format!("expected {expression} to be {not}lowercase\n but was: {marked_actual}\n expected: {marked_expected}") |
| 105 | + format!( |
| 106 | + "expected {expression} to be {not}lowercase\n but was: {marked_actual}\n expected: {marked_expected}" |
| 107 | + ) |
106 | 108 | } |
107 | 109 | } |
108 | 110 |
|
@@ -143,7 +145,9 @@ impl Expectation<char> for IsUpperCase { |
143 | 145 | }; |
144 | 146 | let marked_actual = mark_unexpected_char(*actual, format); |
145 | 147 | let marked_expected = mark_missing_string(&expected, format); |
146 | | - format!("expected {expression} to be {not}uppercase\n but was: {marked_actual}\n expected: {marked_expected}") |
| 148 | + format!( |
| 149 | + "expected {expression} to be {not}uppercase\n but was: {marked_actual}\n expected: {marked_expected}" |
| 150 | + ) |
147 | 151 | } |
148 | 152 | } |
149 | 153 |
|
@@ -179,7 +183,9 @@ impl Expectation<char> for IsAscii { |
179 | 183 | ) -> String { |
180 | 184 | let not = if inverted { "not " } else { "" }; |
181 | 185 | let marked_actual = mark_unexpected_char(*actual, format); |
182 | | - format!("expected {expression} to be {not}an ASCII character\n but was: {marked_actual}\n expected: {not}an ASCII character") |
| 186 | + format!( |
| 187 | + "expected {expression} to be {not}an ASCII character\n but was: {marked_actual}\n expected: {not}an ASCII character" |
| 188 | + ) |
183 | 189 | } |
184 | 190 | } |
185 | 191 |
|
@@ -215,7 +221,9 @@ impl Expectation<char> for IsAlphabetic { |
215 | 221 | ) -> String { |
216 | 222 | let not = if inverted { "not " } else { "" }; |
217 | 223 | let marked_actual = mark_unexpected_char(*actual, format); |
218 | | - format!("expected {expression} to be {not}an alphabetic character\n but was: {marked_actual}\n expected: {not}an alphabetic character") |
| 224 | + format!( |
| 225 | + "expected {expression} to be {not}an alphabetic character\n but was: {marked_actual}\n expected: {not}an alphabetic character" |
| 226 | + ) |
219 | 227 | } |
220 | 228 | } |
221 | 229 |
|
@@ -251,7 +259,9 @@ impl Expectation<char> for IsAlphanumeric { |
251 | 259 | ) -> String { |
252 | 260 | let not = if inverted { "not " } else { "" }; |
253 | 261 | let marked_actual = mark_unexpected_char(*actual, format); |
254 | | - format!("expected {expression} to be {not}an alphanumeric character\n but was: {marked_actual}\n expected: {not}an alphanumeric character") |
| 262 | + format!( |
| 263 | + "expected {expression} to be {not}an alphanumeric character\n but was: {marked_actual}\n expected: {not}an alphanumeric character" |
| 264 | + ) |
255 | 265 | } |
256 | 266 | } |
257 | 267 |
|
@@ -287,7 +297,9 @@ impl Expectation<char> for IsControlChar { |
287 | 297 | ) -> String { |
288 | 298 | let not = if inverted { "not " } else { "" }; |
289 | 299 | let marked_actual = mark_unexpected_char(*actual, format); |
290 | | - format!("expected {expression} to be {not}a control character\n but was: {marked_actual}\n expected: {not}a control character") |
| 300 | + format!( |
| 301 | + "expected {expression} to be {not}a control character\n but was: {marked_actual}\n expected: {not}a control character" |
| 302 | + ) |
291 | 303 | } |
292 | 304 | } |
293 | 305 |
|
@@ -324,7 +336,9 @@ impl Expectation<char> for IsDigit { |
324 | 336 | let not = if inverted { "not " } else { "" }; |
325 | 337 | let radix = self.radix; |
326 | 338 | let marked_actual = mark_unexpected_char(*actual, format); |
327 | | - format!("expected {expression} to be {not}a digit in the radix {radix}\n but was: {marked_actual}\n expected: {not}a digit in the radix {radix}") |
| 339 | + format!( |
| 340 | + "expected {expression} to be {not}a digit in the radix {radix}\n but was: {marked_actual}\n expected: {not}a digit in the radix {radix}" |
| 341 | + ) |
328 | 342 | } |
329 | 343 | } |
330 | 344 |
|
@@ -360,7 +374,9 @@ impl Expectation<char> for IsWhitespace { |
360 | 374 | ) -> String { |
361 | 375 | let not = if inverted { "not " } else { "" }; |
362 | 376 | let marked_actual = mark_unexpected_char(*actual, format); |
363 | | - format!("expected {expression} to be {not}whitespace\n but was: {marked_actual}\n expected: {not}whitespace") |
| 377 | + format!( |
| 378 | + "expected {expression} to be {not}whitespace\n but was: {marked_actual}\n expected: {not}whitespace" |
| 379 | + ) |
364 | 380 | } |
365 | 381 | } |
366 | 382 |
|
|
0 commit comments