Showing the changes to git-pathspec (1 of 100 files). Show all
Unified · Split
| @@ -266,11 +266,7 @@ mod parse { · 265 unmodified lines | |||
| 266 | fn empty_input() { | 266 | fn empty_input() { |
| 267 | let input = ""; | 267 | let input = ""; |
| 268 | 268 | ||
| 269 | assert!( | 269 | assert!(!check_against_baseline(input), "This pathspec is valid in git: {input}"); |
| 270 | !check_against_baseline(input), | ||
| 271 | "This pathspec is valid in git: {}", | ||
| 272 | input | ||
| 273 | ); | ||
| 274 | 270 | ||
| 275 | let output = git_pathspec::parse(input.as_bytes()); | 271 | let output = git_pathspec::parse(input.as_bytes()); |
| 276 | assert!(output.is_err()); | 272 | assert!(output.is_err()); |
| @@ -285,11 +281,7 @@ mod parse { · 8 unmodified lines | |||
| 285 | ]; | 281 | ]; |
| 286 | 282 | ||
| 287 | for input in inputs.into_iter() { | 283 | for input in inputs.into_iter() { |
| 288 | assert!( | 284 | assert!(!check_against_baseline(input), "This pathspec is valid in git: {input}"); |
| 289 | !check_against_baseline(input), | ||
| 290 | "This pathspec is valid in git: {}", | ||
| 291 | input | ||
| 292 | ); | ||
| 293 | 285 | ||
| 294 | let output = git_pathspec::parse(input.as_bytes()); | 286 | let output = git_pathspec::parse(input.as_bytes()); |
| 295 | assert!(output.is_err()); | 287 | assert!(output.is_err()); |
| @@ -307,11 +299,7 @@ mod parse { · 11 unmodified lines | |||
| 307 | ]; | 299 | ]; |
| 308 | 300 | ||
| 309 | for input in inputs.into_iter() { | 301 | for input in inputs.into_iter() { |
| 310 | assert!( | 302 | assert!(!check_against_baseline(input), "This pathspec is valid in git: {input}"); |
| 311 | !check_against_baseline(input), | ||
| 312 | "This pathspec is valid in git: {}", | ||
| 313 | input | ||
| 314 | ); | ||
| 315 | 303 | ||
| 316 | let output = git_pathspec::parse(input.as_bytes()); | 304 | let output = git_pathspec::parse(input.as_bytes()); |
| 317 | assert!(output.is_err()); | 305 | assert!(output.is_err()); |
| @@ -329,14 +317,10 @@ mod parse { · 11 unmodified lines | |||
| 329 | ]; | 317 | ]; |
| 330 | 318 | ||
| 331 | for input in inputs { | 319 | for input in inputs { |
| 332 | assert!( | 320 | assert!(!check_against_baseline(input), "This pathspec is valid in git: {input}"); |
| 333 | !check_against_baseline(input), | ||
| 334 | "This pathspec is valid in git: {}", | ||
| 335 | input | ||
| 336 | ); | ||
| 337 | 321 | ||
| 338 | let output = git_pathspec::parse(input.as_bytes()); | 322 | let output = git_pathspec::parse(input.as_bytes()); |
| 339 | assert!(output.is_err(), "This pathspec did not produce an error {}", input); | 323 | assert!(output.is_err(), "This pathspec did not produce an error {input}"); |
| 340 | assert!(matches!(output.unwrap_err(), Error::InvalidAttribute { .. })); | 324 | assert!(matches!(output.unwrap_err(), Error::InvalidAttribute { .. })); |
| 341 | } | 325 | } |
| 342 | } | 326 | } |
| @@ -355,18 +339,13 @@ mod parse { · 12 unmodified lines | |||
| 355 | ]; | 339 | ]; |
| 356 | 340 | ||
| 357 | for input in inputs { | 341 | for input in inputs { |
| 358 | assert!( | 342 | assert!(!check_against_baseline(input), "This pathspec is valid in git: {input}"); |
| 359 | !check_against_baseline(input), | ||
| 360 | "This pathspec is valid in git: {}", | ||
| 361 | input | ||
| 362 | ); | ||
| 363 | 343 | ||
| 364 | let output = git_pathspec::parse(input.as_bytes()); | 344 | let output = git_pathspec::parse(input.as_bytes()); |
| 365 | assert!(output.is_err(), "This pathspec did not produce an error {}", input); | 345 | assert!(output.is_err(), "This pathspec did not produce an error {input}"); |
| 366 | assert!( | 346 | assert!( |
| 367 | matches!(output.unwrap_err(), Error::InvalidAttributeValue { .. }), | 347 | matches!(output.unwrap_err(), Error::InvalidAttributeValue { .. }), |
| 368 | "Errors did not match for pathspec: {}", | 348 | "Errors did not match for pathspec: {input}" |
| 369 | input | ||
| 370 | ); | 349 | ); |
| 371 | } | 350 | } |
| 372 | } | 351 | } |
| @@ -380,14 +359,10 @@ mod parse { · 7 unmodified lines | |||
| 380 | ]; | 359 | ]; |
| 381 | 360 | ||
| 382 | for input in inputs { | 361 | for input in inputs { |
| 383 | assert!( | 362 | assert!(!check_against_baseline(input), "This pathspec is valid in git: {input}"); |
| 384 | !check_against_baseline(input), | ||
| 385 | "This pathspec is valid in git: {}", | ||
| 386 | input | ||
| 387 | ); | ||
| 388 | 363 | ||
| 389 | let output = git_pathspec::parse(input.as_bytes()); | 364 | let output = git_pathspec::parse(input.as_bytes()); |
| 390 | assert!(output.is_err(), "This pathspec did not produce an error {}", input); | 365 | assert!(output.is_err(), "This pathspec did not produce an error {input}"); |
| 391 | assert!(matches!(output.unwrap_err(), Error::TrailingEscapeCharacter)); | 366 | assert!(matches!(output.unwrap_err(), Error::TrailingEscapeCharacter)); |
| 392 | } | 367 | } |
| 393 | } | 368 | } |
| @@ -396,11 +371,7 @@ mod parse { · 2 unmodified lines | |||
| 396 | fn empty_attribute_specification() { | 371 | fn empty_attribute_specification() { |
| 397 | let input = ":(attr:)"; | 372 | let input = ":(attr:)"; |
| 398 | 373 | ||
| 399 | assert!( | 374 | assert!(!check_against_baseline(input), "This pathspec is valid in git: {input}"); |
| 400 | !check_against_baseline(input), | ||
| 401 | "This pathspec is valid in git: {}", | ||
| 402 | input | ||
| 403 | ); | ||
| 404 | 375 | ||
| 405 | let output = git_pathspec::parse(input.as_bytes()); | 376 | let output = git_pathspec::parse(input.as_bytes()); |
| 406 | assert!(output.is_err()); | 377 | assert!(output.is_err()); |
| @@ -411,11 +382,7 @@ mod parse { · 4 unmodified lines | |||
| 411 | fn multiple_attribute_specifications() { | 382 | fn multiple_attribute_specifications() { |
| 412 | let input = ":(attr:one,attr:two)some/path"; | 383 | let input = ":(attr:one,attr:two)some/path"; |
| 413 | 384 | ||
| 414 | assert!( | 385 | assert!(!check_against_baseline(input), "This pathspec is valid in git: {input}"); |
| 415 | !check_against_baseline(input), | ||
| 416 | "This pathspec is valid in git: {}", | ||
| 417 | input | ||
| 418 | ); | ||
| 419 | 386 | ||
| 420 | let output = git_pathspec::parse(input.as_bytes()); | 387 | let output = git_pathspec::parse(input.as_bytes()); |
| 421 | assert!(output.is_err()); | 388 | assert!(output.is_err()); |
| @@ -426,11 +393,7 @@ mod parse { · 4 unmodified lines | |||
| 426 | fn missing_parentheses() { | 393 | fn missing_parentheses() { |
| 427 | let input = ":(top"; | 394 | let input = ":(top"; |
| 428 | 395 | ||
| 429 | assert!( | 396 | assert!(!check_against_baseline(input), "This pathspec is valid in git: {input}"); |
| 430 | !check_against_baseline(input), | ||
| 431 | "This pathspec is valid in git: {}", | ||
| 432 | input | ||
| 433 | ); | ||
| 434 | 397 | ||
| 435 | let output = git_pathspec::parse(input.as_bytes()); | 398 | let output = git_pathspec::parse(input.as_bytes()); |
| 436 | assert!(output.is_err()); | 399 | assert!(output.is_err()); |
| @@ -441,11 +404,7 @@ mod parse { · 4 unmodified lines | |||
| 441 | fn glob_and_literal_keywords_present() { | 404 | fn glob_and_literal_keywords_present() { |
| 442 | let input = ":(glob,literal)some/path"; | 405 | let input = ":(glob,literal)some/path"; |
| 443 | 406 | ||
| 444 | assert!( | 407 | assert!(!check_against_baseline(input), "This pathspec is valid in git: {input}"); |
| 445 | !check_against_baseline(input), | ||
| 446 | "This pathspec is valid in git: {}", | ||
| 447 | input | ||
| 448 | ); | ||
| 449 | 408 | ||
| 450 | let output = git_pathspec::parse(input.as_bytes()); | 409 | let output = git_pathspec::parse(input.as_bytes()); |
| 451 | assert!(output.is_err()); | 410 | assert!(output.is_err()); |
| @@ -457,14 +416,13 @@ mod parse { · 5 unmodified lines | |||
| 457 | for (input, expected) in inputs.into_iter() { | 416 | for (input, expected) in inputs.into_iter() { |
| 458 | assert!( | 417 | assert!( |
| 459 | check_against_baseline(input), | 418 | check_against_baseline(input), |
| 460 | "This pathspec is invalid in git: {}", | 419 | "This pathspec is invalid in git: {input}" |
| 461 | input | ||
| 462 | ); | 420 | ); |
| 463 | 421 | ||
| 464 | let pattern: PatternForTesting = git_pathspec::parse(input.as_bytes()) | 422 | let pattern: PatternForTesting = git_pathspec::parse(input.as_bytes()) |
| 465 | .unwrap_or_else(|_| panic!("parsing should not fail with pathspec {}", input)) | 423 | .unwrap_or_else(|_| panic!("parsing should not fail with pathspec {input}")) |
| 466 | .into(); | 424 | .into(); |
| 467 | assert_eq!(pattern, expected, "while checking input: \"{}\"", input); | 425 | assert_eq!(pattern, expected, "while checking input: \"{input}\""); |
| 468 | } | 426 | } |
| 469 | } | 427 | } |
| 470 | 428 | ||
| @@ -509,7 +467,7 @@ mod parse { · 38 unmodified lines | |||
| 509 | let key: &BStr = pathspec.into(); | 467 | let key: &BStr = pathspec.into(); |
| 510 | let base = BASELINE | 468 | let base = BASELINE |
| 511 | .get(key) | 469 | .get(key) |
| 512 | .unwrap_or_else(|| panic!("missing baseline for pathspec: {:?}", pathspec)); | 470 | .unwrap_or_else(|| panic!("missing baseline for pathspec: {pathspec:?}")); |
| 513 | *base == 0 | 471 | *base == 0 |
| 514 | } | 472 | } |
| 515 | } | 473 | } |