Home / Function/ test() — tailwindcss Function Reference

test() — tailwindcss Function Reference

Architecture documentation for the test() function in glob.rs from the tailwindcss codebase.

Function rust OxideCore PreProcessors calls 1 called by 10

Entity Profile

Dependency Diagram

graph TD
  3ae15a03_28aa_2117_2ea0_09d75795dc8b["test()"]
  feee3bfc_c98f_77d0_353c_806b9f7bbd95["it_should_keep_globs_that_start_with_file_wildcards_as_is()"]
  feee3bfc_c98f_77d0_353c_806b9f7bbd95 -->|calls| 3ae15a03_28aa_2117_2ea0_09d75795dc8b
  ebe42402_27a6_1427_7253_6baf54466298["it_should_keep_globs_that_start_with_folder_wildcards_as_is()"]
  ebe42402_27a6_1427_7253_6baf54466298 -->|calls| 3ae15a03_28aa_2117_2ea0_09d75795dc8b
  a3600464_7847_afa0_ead1_63a487119929["it_should_move_the_starting_folder_to_the_path()"]
  a3600464_7847_afa0_ead1_63a487119929 -->|calls| 3ae15a03_28aa_2117_2ea0_09d75795dc8b
  76531907_720d_0933_45f4_3cfd5081bb66["it_should_move_the_starting_folders_to_the_path()"]
  76531907_720d_0933_45f4_3cfd5081bb66 -->|calls| 3ae15a03_28aa_2117_2ea0_09d75795dc8b
  78ecb553_394f_b972_4184_14ac9671a46c["it_should_branch_expandable_folders()"]
  78ecb553_394f_b972_4184_14ac9671a46c -->|calls| 3ae15a03_28aa_2117_2ea0_09d75795dc8b
  8297bf34_44cf_0228_08f9_9b97a851e875["it_should_expand_multiple_expansions_in_the_same_folder()"]
  8297bf34_44cf_0228_08f9_9b97a851e875 -->|calls| 3ae15a03_28aa_2117_2ea0_09d75795dc8b
  05a5b555_f083_1220_7f69_fd64d850259f["multiple_expansions_per_folder_starting_at_the_root()"]
  05a5b555_f083_1220_7f69_fd64d850259f -->|calls| 3ae15a03_28aa_2117_2ea0_09d75795dc8b
  4700dbfd_afbd_a2ff_9f74_914812bc3b86["it_should_stop_expanding_once_we_hit_a_wildcard()"]
  4700dbfd_afbd_a2ff_9f74_914812bc3b86 -->|calls| 3ae15a03_28aa_2117_2ea0_09d75795dc8b
  0f4651b8_523e_72aa_cd8b_ada8c1e8da50["it_should_keep_the_negation_symbol_for_all_new_patterns()"]
  0f4651b8_523e_72aa_cd8b_ada8c1e8da50 -->|calls| 3ae15a03_28aa_2117_2ea0_09d75795dc8b
  4e52ae77_9cb3_eeda_0f41_4a06f80cd14a["it_should_expand_a_complex_example()"]
  4e52ae77_9cb3_eeda_0f41_4a06f80cd14a -->|calls| 3ae15a03_28aa_2117_2ea0_09d75795dc8b
  f569f1f4_b5a2_4b65_df8e_64243846541d["optimize_patterns()"]
  3ae15a03_28aa_2117_2ea0_09d75795dc8b -->|calls| f569f1f4_b5a2_4b65_df8e_64243846541d
  style 3ae15a03_28aa_2117_2ea0_09d75795dc8b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

crates/oxide/src/glob.rs lines 223–269

    fn test(base: &str, sources: &[GlobEntry]) -> Vec<GlobEntry> {
        // Resolve all content paths for the (temporary) current working directory
        let sources: Vec<GlobEntry> = sources
            .iter()
            .map(|x| GlobEntry {
                base: format!("{}{}", base, x.base),
                pattern: x.pattern.clone(),
            })
            .collect();

        // Expand glob patterns into multiple `GlobEntry`s.
        let sources = sources
            .iter()
            .flat_map(|source| {
                let expression: Result<Expression, _> = source.pattern[..].try_into();
                let Ok(expression) = expression else {
                    return vec![source.clone()];
                };

                expression
                    .into_iter()
                    .filter_map(Result::ok)
                    .map(move |pattern| GlobEntry {
                        base: source.base.clone(),
                        pattern: pattern.into(),
                    })
                    .collect::<Vec<_>>()
            })
            .collect::<Vec<_>>();

        let optimized_sources = optimize_patterns(&sources);

        let parent_dir =
            format!("{}{}", dunce::canonicalize(base).unwrap().display(), "/").replace('\\', "/");

        // Remove the temporary directory from the base
        optimized_sources
            .into_iter()
            .map(|source| {
                GlobEntry {
                    // Normalize paths to use unix style separators
                    base: source.base.replace('\\', "/").replace(&parent_dir, "/"),
                    pattern: source.pattern,
                }
            })
            .collect()
    }

Domain

Subdomains

Frequently Asked Questions

What does test() do?
test() is a function in the tailwindcss codebase.
What does test() call?
test() calls 1 function(s): optimize_patterns.
What calls test()?
test() is called by 10 function(s): it_should_branch_expandable_folders, it_should_expand_a_complex_example, it_should_expand_multiple_expansions_in_the_same_folder, it_should_keep_globs_that_start_with_file_wildcards_as_is, it_should_keep_globs_that_start_with_folder_wildcards_as_is, it_should_keep_the_negation_symbol_for_all_new_patterns, it_should_move_the_starting_folder_to_the_path, it_should_move_the_starting_folders_to_the_path, and 2 more.

Analyze Your Own Codebase

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

Try Supermodel Free