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 Oxide PreProcessors calls 1 called by 10

Entity Profile

Dependency Diagram

graph TD
  3b14a9e7_5d43_bc68_e82b_f61c14c46ab9["test()"]
  06f0538c_a174_ca7e_0254_932670828484["glob.rs"]
  3b14a9e7_5d43_bc68_e82b_f61c14c46ab9 -->|defined in| 06f0538c_a174_ca7e_0254_932670828484
  a9fa3e09_b7ac_ea22_ba93_9214ea7e399b["it_should_keep_globs_that_start_with_file_wildcards_as_is()"]
  a9fa3e09_b7ac_ea22_ba93_9214ea7e399b -->|calls| 3b14a9e7_5d43_bc68_e82b_f61c14c46ab9
  5c2d45a5_abc7_c45a_706c_11e25637ec03["it_should_keep_globs_that_start_with_folder_wildcards_as_is()"]
  5c2d45a5_abc7_c45a_706c_11e25637ec03 -->|calls| 3b14a9e7_5d43_bc68_e82b_f61c14c46ab9
  5465714b_387b_decd_01b7_53e7b01dc483["it_should_move_the_starting_folder_to_the_path()"]
  5465714b_387b_decd_01b7_53e7b01dc483 -->|calls| 3b14a9e7_5d43_bc68_e82b_f61c14c46ab9
  847e0586_277e_6a4f_0f8f_ca46e1fe3268["it_should_move_the_starting_folders_to_the_path()"]
  847e0586_277e_6a4f_0f8f_ca46e1fe3268 -->|calls| 3b14a9e7_5d43_bc68_e82b_f61c14c46ab9
  df1eba22_2076_957e_1cdb_e2919d9505cf["it_should_branch_expandable_folders()"]
  df1eba22_2076_957e_1cdb_e2919d9505cf -->|calls| 3b14a9e7_5d43_bc68_e82b_f61c14c46ab9
  ac1117da_7997_9944_8226_d88571a70197["it_should_expand_multiple_expansions_in_the_same_folder()"]
  ac1117da_7997_9944_8226_d88571a70197 -->|calls| 3b14a9e7_5d43_bc68_e82b_f61c14c46ab9
  db6874ed_71c4_ce46_b62a_4c9b75d00d32["multiple_expansions_per_folder_starting_at_the_root()"]
  db6874ed_71c4_ce46_b62a_4c9b75d00d32 -->|calls| 3b14a9e7_5d43_bc68_e82b_f61c14c46ab9
  dfeacf7a_9e24_5a3b_0173_0c401aafd4be["it_should_stop_expanding_once_we_hit_a_wildcard()"]
  dfeacf7a_9e24_5a3b_0173_0c401aafd4be -->|calls| 3b14a9e7_5d43_bc68_e82b_f61c14c46ab9
  af2ab9a8_54d8_5ed0_a264_a364c1856996["it_should_keep_the_negation_symbol_for_all_new_patterns()"]
  af2ab9a8_54d8_5ed0_a264_a364c1856996 -->|calls| 3b14a9e7_5d43_bc68_e82b_f61c14c46ab9
  0be0323b_8cd6_f27b_a8db_ffbfcc66ccff["it_should_expand_a_complex_example()"]
  0be0323b_8cd6_f27b_a8db_ffbfcc66ccff -->|calls| 3b14a9e7_5d43_bc68_e82b_f61c14c46ab9
  43de58ea_7c3b_c3a8_09fb_485a31ec14d6["optimize_patterns()"]
  3b14a9e7_5d43_bc68_e82b_f61c14c46ab9 -->|calls| 43de58ea_7c3b_c3a8_09fb_485a31ec14d6
  style 3b14a9e7_5d43_bc68_e82b_f61c14c46ab9 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, defined in crates/oxide/src/glob.rs.
Where is test() defined?
test() is defined in crates/oxide/src/glob.rs at line 223.
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