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 OxideEngine Scanner 2 imports 6 functions

Entity Profile

Dependency Diagram

graph LR
  769ca6bf_ad87_5317_8f93_e86c99cb744d["gitignore_matched_path_or_any_parents_tests.rs"]
  2cad2c90_4399_255c_13ee_4577dbd9ac3a["std::path::Path"]
  769ca6bf_ad87_5317_8f93_e86c99cb744d --> 2cad2c90_4399_255c_13ee_4577dbd9ac3a
  d56faeb8_aaca_322b_e532_947aed8b0050["ignore::gitignore::"]
  769ca6bf_ad87_5317_8f93_e86c99cb744d --> d56faeb8_aaca_322b_e532_947aed8b0050
  style 769ca6bf_ad87_5317_8f93_e86c99cb744d 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 OxideEngine domain, Scanner 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: OxideEngine, subdomain: Scanner, directory: crates/ignore/tests).

Analyze Your Own Codebase

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

Try Supermodel Free