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

Entity Profile

Dependency Diagram

graph TD
  fc119bfa_39ba_8a9d_993d_92d6a3386600["test()"]
  d6210432_49e5_7bfc_e9c4_6cebc740bb16["glob.rs"]
  fc119bfa_39ba_8a9d_993d_92d6a3386600 -->|defined in| d6210432_49e5_7bfc_e9c4_6cebc740bb16
  dca18166_149b_54bb_d00f_7e928afbcdf4["it_should_keep_globs_that_start_with_file_wildcards_as_is()"]
  dca18166_149b_54bb_d00f_7e928afbcdf4 -->|calls| fc119bfa_39ba_8a9d_993d_92d6a3386600
  3d745131_d360_a0a8_3982_123b8b90ce60["it_should_keep_globs_that_start_with_folder_wildcards_as_is()"]
  3d745131_d360_a0a8_3982_123b8b90ce60 -->|calls| fc119bfa_39ba_8a9d_993d_92d6a3386600
  a5e488ce_4e4c_3cd4_2568_c411cd598e60["it_should_move_the_starting_folder_to_the_path()"]
  a5e488ce_4e4c_3cd4_2568_c411cd598e60 -->|calls| fc119bfa_39ba_8a9d_993d_92d6a3386600
  0f3b48c5_b4aa_a1f5_9293_6cfdb7f1baee["it_should_move_the_starting_folders_to_the_path()"]
  0f3b48c5_b4aa_a1f5_9293_6cfdb7f1baee -->|calls| fc119bfa_39ba_8a9d_993d_92d6a3386600
  b8a8b78a_9bf5_a406_87c6_0bafa0786729["it_should_branch_expandable_folders()"]
  b8a8b78a_9bf5_a406_87c6_0bafa0786729 -->|calls| fc119bfa_39ba_8a9d_993d_92d6a3386600
  3a4a73cc_34d9_4751_b93c_030229a10901["it_should_expand_multiple_expansions_in_the_same_folder()"]
  3a4a73cc_34d9_4751_b93c_030229a10901 -->|calls| fc119bfa_39ba_8a9d_993d_92d6a3386600
  d0025a09_3db8_bbd6_204f_24c856166046["multiple_expansions_per_folder_starting_at_the_root()"]
  d0025a09_3db8_bbd6_204f_24c856166046 -->|calls| fc119bfa_39ba_8a9d_993d_92d6a3386600
  31336d39_6a8f_9b2e_6b67_dc85b37e2751["it_should_stop_expanding_once_we_hit_a_wildcard()"]
  31336d39_6a8f_9b2e_6b67_dc85b37e2751 -->|calls| fc119bfa_39ba_8a9d_993d_92d6a3386600
  9259113f_5ca3_7abe_937e_e0bbde50c264["it_should_keep_the_negation_symbol_for_all_new_patterns()"]
  9259113f_5ca3_7abe_937e_e0bbde50c264 -->|calls| fc119bfa_39ba_8a9d_993d_92d6a3386600
  2159ccdd_43fb_39e9_fdaa_0b4cefcfadd8["it_should_expand_a_complex_example()"]
  2159ccdd_43fb_39e9_fdaa_0b4cefcfadd8 -->|calls| fc119bfa_39ba_8a9d_993d_92d6a3386600
  77e32ec4_3bad_9b11_3527_863215f783cf["optimize_patterns()"]
  fc119bfa_39ba_8a9d_993d_92d6a3386600 -->|calls| 77e32ec4_3bad_9b11_3527_863215f783cf
  style fc119bfa_39ba_8a9d_993d_92d6a3386600 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