Home / Function/ test_manually_scanning_files_should_follow_all_rules() — tailwindcss Function Reference

test_manually_scanning_files_should_follow_all_rules() — tailwindcss Function Reference

Architecture documentation for the test_manually_scanning_files_should_follow_all_rules() function in scanner.rs from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  c9dca851_9ce9_eefe_8ed9_0060622a787f["test_manually_scanning_files_should_follow_all_rules()"]
  340ddba0_15e4_a309_9dea_cf6d6e73381d["scanner.rs"]
  c9dca851_9ce9_eefe_8ed9_0060622a787f -->|defined in| 340ddba0_15e4_a309_9dea_cf6d6e73381d
  a055cb70_8b14_31db_b201_57369f5fda5a["create_files_in()"]
  c9dca851_9ce9_eefe_8ed9_0060622a787f -->|calls| a055cb70_8b14_31db_b201_57369f5fda5a
  773530fa_5b76_d390_68d3_405d48fbecf7["public_source_entry_from_pattern()"]
  c9dca851_9ce9_eefe_8ed9_0060622a787f -->|calls| 773530fa_5b76_d390_68d3_405d48fbecf7
  2f3305c3_ad36_6002_daa9_52b16e0424fd["scan()"]
  c9dca851_9ce9_eefe_8ed9_0060622a787f -->|calls| 2f3305c3_ad36_6002_daa9_52b16e0424fd
  style c9dca851_9ce9_eefe_8ed9_0060622a787f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

crates/oxide/tests/scanner.rs lines 1541–1623

    fn test_manually_scanning_files_should_follow_all_rules() {
        // Create a temporary working directory
        let dir = tempdir().unwrap().into_path();

        // Create files
        create_files_in(
            &dir,
            &[
                // Ignore all `.jsx` files, and all `generated` folders
                (".gitignore", "*.jsx\ngenerated/"),
                // .tsx files are allowed
                (
                    "src/components/button.tsx",
                    "content-['src/components/button.tsx']",
                ),
                // .jsx files are not allowed
                (
                    "src/components/button.jsx",
                    "content-['src/components/button.jsx']",
                ),
            ],
        );

        let mut scanner = Scanner::new(vec![public_source_entry_from_pattern(
            dir.clone(),
            "@source '**/*'",
        )]);

        let candidates = scanner.scan();
        assert_eq!(candidates, vec!["content-['src/components/button.tsx']"]);

        // Create 2 new files, one "good" and one "bad" file, and manually scan them. This should
        // only return the "good" file because the "bad" one is ignored by a `.gitignore` file.
        create_files_in(
            &dir,
            &[
                (
                    "src/components/good.tsx",
                    "content-['src/components/good.tsx']",
                ),
                (
                    "src/components/bad.jsx",
                    "content-['src/components/bad.jsx']",
                ),
            ],
        );

        let candidates = scanner.scan_content(vec![
            ChangedContent::File(dir.join("src/components/good.tsx"), "tsx".to_owned()),
            ChangedContent::File(dir.join("src/components/bad.jsx"), "jsx".to_owned()),
        ]);

        assert_eq!(candidates, vec!["content-['src/components/good.tsx']"]);

        // Create a generated file in a nested folder that is ignored by a `.gitignore` file higher
        // up the tree.
        create_files_in(
            &dir,
            &[
                (
                    "src/components/generated/bad.tsx",
                    "content-['src/components/generated/bad.tsx']",
                ),
                (
                    "src/components/generated/bad.jsx",
                    "content-['src/components/generated/bad.jsx']",
                ),
            ],
        );

        let candidates = scanner.scan_content(vec![
            ChangedContent::File(
                dir.join("src/components/generated/bad.tsx"),
                "tsx".to_owned(),
            ),
            ChangedContent::File(
                dir.join("src/components/generated/bad.jsx"),
                "jsx".to_owned(),
            ),
        ]);

Domain

Subdomains

Frequently Asked Questions

What does test_manually_scanning_files_should_follow_all_rules() do?
test_manually_scanning_files_should_follow_all_rules() is a function in the tailwindcss codebase, defined in crates/oxide/tests/scanner.rs.
Where is test_manually_scanning_files_should_follow_all_rules() defined?
test_manually_scanning_files_should_follow_all_rules() is defined in crates/oxide/tests/scanner.rs at line 1541.
What does test_manually_scanning_files_should_follow_all_rules() call?
test_manually_scanning_files_should_follow_all_rules() calls 3 function(s): create_files_in, public_source_entry_from_pattern, scan.

Analyze Your Own Codebase

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

Try Supermodel Free