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 RustCore FileScanner calls 1 called by 10

Entity Profile

Dependency Diagram

graph TD
  259c9079_e6e4_38be_be7c_c860a61e0b2f["test()"]
  150fa9e2_8f67_dc82_a1d2_eef47d3aa350["it_should_keep_globs_that_start_with_file_wildcards_as_is()"]
  150fa9e2_8f67_dc82_a1d2_eef47d3aa350 -->|calls| 259c9079_e6e4_38be_be7c_c860a61e0b2f
  43710e7b_a643_dffa_82b2_e4b1af6f73aa["it_should_keep_globs_that_start_with_folder_wildcards_as_is()"]
  43710e7b_a643_dffa_82b2_e4b1af6f73aa -->|calls| 259c9079_e6e4_38be_be7c_c860a61e0b2f
  7ba7da91_9b5a_1154_92ba_37a632534483["it_should_move_the_starting_folder_to_the_path()"]
  7ba7da91_9b5a_1154_92ba_37a632534483 -->|calls| 259c9079_e6e4_38be_be7c_c860a61e0b2f
  40cea23c_7632_46a0_94b4_7724d0beea7a["it_should_move_the_starting_folders_to_the_path()"]
  40cea23c_7632_46a0_94b4_7724d0beea7a -->|calls| 259c9079_e6e4_38be_be7c_c860a61e0b2f
  e08a4f18_5472_a233_465a_965af187c192["it_should_branch_expandable_folders()"]
  e08a4f18_5472_a233_465a_965af187c192 -->|calls| 259c9079_e6e4_38be_be7c_c860a61e0b2f
  7e11a91a_c7d6_dd68_faa6_be90c2f0b475["it_should_expand_multiple_expansions_in_the_same_folder()"]
  7e11a91a_c7d6_dd68_faa6_be90c2f0b475 -->|calls| 259c9079_e6e4_38be_be7c_c860a61e0b2f
  deea2001_04ca_f45b_aa77_50167b4a1044["multiple_expansions_per_folder_starting_at_the_root()"]
  deea2001_04ca_f45b_aa77_50167b4a1044 -->|calls| 259c9079_e6e4_38be_be7c_c860a61e0b2f
  650f57b2_ba40_0637_2b17_cd47af9210b0["it_should_stop_expanding_once_we_hit_a_wildcard()"]
  650f57b2_ba40_0637_2b17_cd47af9210b0 -->|calls| 259c9079_e6e4_38be_be7c_c860a61e0b2f
  77dd3a20_cd9a_0896_bac8_f4035efd2362["it_should_keep_the_negation_symbol_for_all_new_patterns()"]
  77dd3a20_cd9a_0896_bac8_f4035efd2362 -->|calls| 259c9079_e6e4_38be_be7c_c860a61e0b2f
  5cc13c0c_f925_6d05_8365_d0d4b20ef85c["it_should_expand_a_complex_example()"]
  5cc13c0c_f925_6d05_8365_d0d4b20ef85c -->|calls| 259c9079_e6e4_38be_be7c_c860a61e0b2f
  acf2f0a7_f6d0_3770_148f_551b6caf03fc["optimize_patterns()"]
  259c9079_e6e4_38be_be7c_c860a61e0b2f -->|calls| acf2f0a7_f6d0_3770_148f_551b6caf03fc
  style 259c9079_e6e4_38be_be7c_c860a61e0b2f 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