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
  37d04bd1_4dd6_3db9_d1e5_44293a447f99["test_manually_scanning_files_should_follow_all_rules()"]
  6b48c515_a72f_7a7d_7ea7_b80f71a82b19["scanner.rs"]
  37d04bd1_4dd6_3db9_d1e5_44293a447f99 -->|defined in| 6b48c515_a72f_7a7d_7ea7_b80f71a82b19
  56624ac4_6945_32d1_2b96_700de264829d["create_files_in()"]
  37d04bd1_4dd6_3db9_d1e5_44293a447f99 -->|calls| 56624ac4_6945_32d1_2b96_700de264829d
  0ffee7bc_8829_8e8e_00ee_4a8f4e4d9736["public_source_entry_from_pattern()"]
  37d04bd1_4dd6_3db9_d1e5_44293a447f99 -->|calls| 0ffee7bc_8829_8e8e_00ee_4a8f4e4d9736
  89cd8369_536c_74e5_91d1_719df04e4597["scan()"]
  37d04bd1_4dd6_3db9_d1e5_44293a447f99 -->|calls| 89cd8369_536c_74e5_91d1_719df04e4597
  style 37d04bd1_4dd6_3db9_d1e5_44293a447f99 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