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
  8cfb823b_4d4d_dc1b_914a_edf7407eae8a["test_manually_scanning_files_should_follow_all_rules()"]
  96c928f4_eee8_bcbc_0339_e2dce4b2d810["create_files_in()"]
  8cfb823b_4d4d_dc1b_914a_edf7407eae8a -->|calls| 96c928f4_eee8_bcbc_0339_e2dce4b2d810
  257cbf08_9e94_64b3_97f2_0416460fab35["public_source_entry_from_pattern()"]
  8cfb823b_4d4d_dc1b_914a_edf7407eae8a -->|calls| 257cbf08_9e94_64b3_97f2_0416460fab35
  1581ed51_04e1_62c1_6e26_ea43cf82d5f9["scan()"]
  8cfb823b_4d4d_dc1b_914a_edf7407eae8a -->|calls| 1581ed51_04e1_62c1_6e26_ea43cf82d5f9
  style 8cfb823b_4d4d_dc1b_914a_edf7407eae8a 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(),
            ),
        ]);

        assert!(candidates.is_empty());
    }

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.
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