Skip to content
Myr

Add tests for --no-ignore-parent

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by William Correia · committed by William Correia · parent f8ae334 · Browse files · 1 file+72 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+72 added−0 removed

  • tests:+72 added−0 removed

1 file+72 added−0 removed

modified:tests/tests.rs+72 added
495 unmodified lines
496 ignored-by-both",497 );498}499500/// Ignore parent ignore files (--no-ignore-parent)501#[test]502fn test_no_ignore_parent() {503 let dirs = &["inner"];504 let files = &[505 "inner/parent-ignored",506 "inner/child-ignored",507 "inner/not-ignored",508 ];509 let te = TestEnv::new(dirs, files);510511 // Ignore 'parent-ignored' in root512 fs::File::create(te.test_root().join(".gitignore"))513 .unwrap()514 .write_all(b"parent-ignored")515 .unwrap();516 // Ignore 'child-ignored' in inner517 fs::File::create(te.test_root().join("inner/.gitignore"))518 .unwrap()519 .write_all(b"child-ignored")520 .unwrap();521522 te.assert_output_subdirectory("inner", &[], "not-ignored");523524 te.assert_output_subdirectory(525 "inner",526 &["--no-ignore-parent"],527 "parent-ignored528 not-ignored",529 );530}531532/// Ignore parent ignore files (--no-ignore-parent) with an inner git repo533#[test]534fn test_no_ignore_parent_inner_git() {535 let dirs = &["inner"];536 let files = &[537 "inner/parent-ignored",538 "inner/child-ignored",539 "inner/not-ignored",540 ];541 let te = TestEnv::new(dirs, files);542543 // Make the inner folder also appear as a git repo544 fs::create_dir_all(te.test_root().join("inner/.git")).unwrap();545546 // Ignore 'parent-ignored' in root547 fs::File::create(te.test_root().join(".gitignore"))548 .unwrap()549 .write_all(b"parent-ignored")550 .unwrap();551 // Ignore 'child-ignored' in inner552 fs::File::create(te.test_root().join("inner/.gitignore"))553 .unwrap()554 .write_all(b"child-ignored")555 .unwrap();556557 te.assert_output_subdirectory(558 "inner",559 &[],560 "not-ignored561 parent-ignored",562 );563564 te.assert_output_subdirectory(565 "inner",566 &["--no-ignore-parent"],567 "not-ignored568 parent-ignored",569 );570}571572/// Precedence of .fdignore files573#[test]574fn test_custom_ignore_precedence() {575 let dirs = &["inner"];
1300 unmodified lines