Home / Function/ test_arbitrary_variable_extraction() — tailwindcss Function Reference

test_arbitrary_variable_extraction() — tailwindcss Function Reference

Architecture documentation for the test_arbitrary_variable_extraction() function in arbitrary_variable_machine.rs from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  14722417_c856_3951_c844_d425b3423252["test_arbitrary_variable_extraction()"]
  7a494844_a376_e466_6245_0c9d5be3b787["arbitrary_variable_machine.rs"]
  14722417_c856_3951_c844_d425b3423252 -->|defined in| 7a494844_a376_e466_6245_0c9d5be3b787
  style 14722417_c856_3951_c844_d425b3423252 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

crates/oxide/src/extractor/arbitrary_variable_machine.rs lines 353–391

    fn test_arbitrary_variable_extraction() {
        for (input, expected) in [
            // Simple utility
            ("(--foo)", vec!["(--foo)"]),
            // With dashes
            ("(--my-color)", vec!["(--my-color)"]),
            // With a fallback
            ("(--my-color,red,blue)", vec!["(--my-color,red,blue)"]),
            // With a fallback containing a string with unbalanced brackets
            (
                "(--my-img,url('https://example.com?q=(][)'))",
                vec!["(--my-img,url('https://example.com?q=(][)'))"],
            ),
            // With a type hint
            ("(length:--my-length)", vec!["(length:--my-length)"]),
            // --------------------------------------------------------

            // Exceptions:
            // Arbitrary variable must start with a CSS variable
            (r"(bar)", vec![]),
            // Arbitrary variables must be valid CSS variables
            (r"(--my-\ color)", vec![]),
            (r"(--my#color)", vec![]),
            // Fallbacks cannot have spaces
            (r"(--my-color, red)", vec![]),
            // Fallbacks cannot have escaped spaces
            (r"(--my-color,\ red)", vec![]),
            // Variables must have at least one character after the `--`
            (r"(--)", vec![]),
            (r"(--,red)", vec![]),
            (r"(-)", vec![]),
            (r"(-my-color)", vec![]),
        ] {
            assert_eq!(
                ArbitraryVariableMachine::<IdleState>::test_extract_all(input),
                expected
            );
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does test_arbitrary_variable_extraction() do?
test_arbitrary_variable_extraction() is a function in the tailwindcss codebase, defined in crates/oxide/src/extractor/arbitrary_variable_machine.rs.
Where is test_arbitrary_variable_extraction() defined?
test_arbitrary_variable_extraction() is defined in crates/oxide/src/extractor/arbitrary_variable_machine.rs at line 353.

Analyze Your Own Codebase

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

Try Supermodel Free