Home / Function/ it_should_pick_up_new_files() — tailwindcss Function Reference

it_should_pick_up_new_files() — tailwindcss Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  682eb566_a24c_752f_94bd_e2d2090ab470["it_should_pick_up_new_files()"]
  96c928f4_eee8_bcbc_0339_e2dce4b2d810["create_files_in()"]
  682eb566_a24c_752f_94bd_e2d2090ab470 -->|calls| 96c928f4_eee8_bcbc_0339_e2dce4b2d810
  257cbf08_9e94_64b3_97f2_0416460fab35["public_source_entry_from_pattern()"]
  682eb566_a24c_752f_94bd_e2d2090ab470 -->|calls| 257cbf08_9e94_64b3_97f2_0416460fab35
  1581ed51_04e1_62c1_6e26_ea43cf82d5f9["scan()"]
  682eb566_a24c_752f_94bd_e2d2090ab470 -->|calls| 1581ed51_04e1_62c1_6e26_ea43cf82d5f9
  style 682eb566_a24c_752f_94bd_e2d2090ab470 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

crates/oxide/tests/scanner.rs lines 713–841

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

        // Initialize this directory as a git repository
        let _ = Command::new("git").arg("init").current_dir(&dir).output();

        // Create files
        create_files_in(
            &dir,
            &[
                ("project-a/index.html", "content-['project-a/index.html']"),
                ("project-b/index.html", "content-['project-b/index.html']"),
            ],
        );

        let sources = vec![
            public_source_entry_from_pattern(dir.join("project-a"), "@source '**/*'"),
            public_source_entry_from_pattern(dir.join("project-b"), "@source '**/*'"),
        ];

        let mut scanner = Scanner::new(sources);
        let candidates = scanner.scan();

        // We've done the initial scan and found the files
        assert_eq!(
            candidates,
            vec![
                "content-['project-a/index.html']",
                "content-['project-b/index.html']"
            ]
        );

        // We have to sleep because it might run too fast (seriously) and the
        // mtimes of the directories end up being the same as the last time we
        // checked them
        sleep(Duration::from_millis(100));

        // Create files
        create_files_in(
            &dir,
            &[
                ("project-a/new.html", "content-['project-a/new.html']"),
                ("project-b/new.html", "content-['project-b/new.html']"),
            ],
        );

        let candidates = scanner.scan();

        assert_eq!(
            candidates,
            vec![
                "content-['project-a/index.html']",
                "content-['project-a/new.html']",
                "content-['project-b/index.html']",
                "content-['project-b/new.html']"
            ]
        );

        // We have to sleep because it might run too fast (seriously) and the
        // mtimes of the directories end up being the same as the last time we
        // checked them
        sleep(Duration::from_millis(100));

        // Create folders
        create_files_in(
            &dir,
            &[
                (
                    "project-a/sub1/sub2/index.html",
                    "content-['project-a/sub1/sub2/index.html']",
                ),
                (
                    "project-b/sub1/sub2/index.html",
                    "content-['project-b/sub1/sub2/index.html']",
                ),
            ],
        );

        let candidates = scanner.scan();

        assert_eq!(
            candidates,
            vec![
                "content-['project-a/index.html']",
                "content-['project-a/new.html']",
                "content-['project-a/sub1/sub2/index.html']",
                "content-['project-b/index.html']",
                "content-['project-b/new.html']",
                "content-['project-b/sub1/sub2/index.html']"
            ]
        );

        // We have to sleep because it might run too fast (seriously) and the
        // mtimes of the directories end up being the same as the last time we
        // checked them
        sleep(Duration::from_millis(100));

        // Create folders
        create_files_in(
            &dir,
            &[
                (
                    "project-a/sub1/sub2/new.html",
                    "content-['project-a/sub1/sub2/new.html']",
                ),
                (
                    "project-b/sub1/sub2/new.html",
                    "content-['project-b/sub1/sub2/new.html']",
                ),
            ],
        );

        let candidates = scanner.scan();

        assert_eq!(
            candidates,
            vec![
                "content-['project-a/index.html']",
                "content-['project-a/new.html']",
                "content-['project-a/sub1/sub2/index.html']",
                "content-['project-a/sub1/sub2/new.html']",
                "content-['project-b/index.html']",
                "content-['project-b/new.html']",
                "content-['project-b/sub1/sub2/index.html']",
                "content-['project-b/sub1/sub2/new.html']"
            ]
        );
    }

Domain

Subdomains

Frequently Asked Questions

What does it_should_pick_up_new_files() do?
it_should_pick_up_new_files() is a function in the tailwindcss codebase.
What does it_should_pick_up_new_files() call?
it_should_pick_up_new_files() 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