Home / File/ gitignore_matched_path_or_any_parents_tests.rs — tailwindcss Source File

gitignore_matched_path_or_any_parents_tests.rs — tailwindcss Source File

Architecture documentation for gitignore_matched_path_or_any_parents_tests.rs, a rust file in the tailwindcss codebase. 2 imports, 0 dependents.

File rust Oxide PreProcessors 2 imports 6 functions

Entity Profile

Dependency Diagram

graph LR
  933eebe1_03e6_d6b1_a9f3_12b5bf3d7e94["gitignore_matched_path_or_any_parents_tests.rs"]
  a6aeab6e_a19a_3d64_9b92_03c5c0f78918["std::path::Path"]
  933eebe1_03e6_d6b1_a9f3_12b5bf3d7e94 --> a6aeab6e_a19a_3d64_9b92_03c5c0f78918
  9d5b045c_abfa_028c_3886_58b1698ea3dc["ignore::gitignore::"]
  933eebe1_03e6_d6b1_a9f3_12b5bf3d7e94 --> 9d5b045c_abfa_028c_3886_58b1698ea3dc
  style 933eebe1_03e6_d6b1_a9f3_12b5bf3d7e94 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

use std::path::Path;

use ignore::gitignore::{Gitignore, GitignoreBuilder};

const IGNORE_FILE: &'static str = "tests/gitignore_matched_path_or_any_parents_tests.gitignore";

fn get_gitignore() -> Gitignore {
    let mut builder = GitignoreBuilder::new("ROOT");
    let error = builder.add(IGNORE_FILE);
    assert!(error.is_none(), "failed to open gitignore file");
    builder.build().unwrap()
}

#[test]
#[should_panic(expected = "path is expected to be under the root")]
fn test_path_should_be_under_root() {
    let gitignore = get_gitignore();
    let path = "/tmp/some_file";
    gitignore.matched_path_or_any_parents(Path::new(path), false);
    assert!(false);
}

#[test]
fn test_files_in_root() {
    let gitignore = get_gitignore();
    let m = |path: &str| gitignore.matched_path_or_any_parents(Path::new(path), false);

    // 0x
    assert!(m("ROOT/file_root_00").is_ignore());
    assert!(m("ROOT/file_root_01").is_none());
    assert!(m("ROOT/file_root_02").is_none());
    assert!(m("ROOT/file_root_03").is_none());

    // 1x
    assert!(m("ROOT/file_root_10").is_ignore());
    assert!(m("ROOT/file_root_11").is_none());
    assert!(m("ROOT/file_root_12").is_none());
    assert!(m("ROOT/file_root_13").is_none());

    // 2x
    assert!(m("ROOT/file_root_20").is_none());
    assert!(m("ROOT/file_root_21").is_none());
    assert!(m("ROOT/file_root_22").is_none());
    assert!(m("ROOT/file_root_23").is_none());

    // 3x
    assert!(m("ROOT/file_root_30").is_ignore());
    assert!(m("ROOT/file_root_31").is_none());
    assert!(m("ROOT/file_root_32").is_none());
    assert!(m("ROOT/file_root_33").is_none());
}

#[test]
fn test_files_in_deep() {
    let gitignore = get_gitignore();
    let m = |path: &str| gitignore.matched_path_or_any_parents(Path::new(path), false);

    // 0x
    assert!(m("ROOT/parent_dir/file_deep_00").is_ignore());
    assert!(m("ROOT/parent_dir/file_deep_01").is_none());
// ... (232 more lines)

Domain

Subdomains

Dependencies

  • ignore::gitignore::
  • std::path::Path

Frequently Asked Questions

What does gitignore_matched_path_or_any_parents_tests.rs do?
gitignore_matched_path_or_any_parents_tests.rs is a source file in the tailwindcss codebase, written in rust. It belongs to the Oxide domain, PreProcessors subdomain.
What functions are defined in gitignore_matched_path_or_any_parents_tests.rs?
gitignore_matched_path_or_any_parents_tests.rs defines 6 function(s): get_gitignore, test_dirs_in_deep, test_dirs_in_root, test_files_in_deep, test_files_in_root, test_path_should_be_under_root.
What does gitignore_matched_path_or_any_parents_tests.rs depend on?
gitignore_matched_path_or_any_parents_tests.rs imports 2 module(s): ignore::gitignore::, std::path::Path.
Where is gitignore_matched_path_or_any_parents_tests.rs in the architecture?
gitignore_matched_path_or_any_parents_tests.rs is located at crates/ignore/tests/gitignore_matched_path_or_any_parents_tests.rs (domain: Oxide, subdomain: PreProcessors, directory: crates/ignore/tests).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free