MCPcopy Create free account
hub / github.com/dallay/agentsync / test_nested_glob_invalidates_cache_after_compressed_write

Function test_nested_glob_invalidates_cache_after_compressed_write

src/linker.rs:3667–3734  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3665 #[test]
3666 #[cfg(unix)]
3667 fn test_nested_glob_invalidates_cache_after_compressed_write() {
3668 let temp_dir = TempDir::new().unwrap();
3669 let agents_dir = temp_dir.path().join(".agents");
3670 fs::create_dir_all(&agents_dir).unwrap();
3671
3672 let config_path = agents_dir.join("agentsync.toml");
3673 fs::write(&config_path, "source_dir = \".\"\n").unwrap();
3674
3675 let search_root = temp_dir.path().join("workspace");
3676 let old_dir = search_root.join("old");
3677 let new_dir = search_root.join("new");
3678 fs::create_dir_all(&old_dir).unwrap();
3679 fs::write(old_dir.join("legacy.compact.md"), "# old").unwrap();
3680
3681 let config = Config::load(&config_path).unwrap();
3682 let linker = Linker::new(config, config_path);
3683
3684 let dry_run_options = SyncOptions {
3685 dry_run: true,
3686 ..Default::default()
3687 };
3688
3689 linker
3690 .process_nested_glob(
3691 &search_root,
3692 "**/*.compact.md",
3693 &[],
3694 "linked/{relative_path}/{file_name}",
3695 &dry_run_options,
3696 )
3697 .unwrap();
3698
3699 fs::rename(
3700 old_dir.join("legacy.compact.md"),
3701 old_dir.join("legacy.md.bak"),
3702 )
3703 .unwrap();
3704
3705 let source = temp_dir.path().join("AGENTS.md");
3706 fs::write(&source, "# compressed").unwrap();
3707 let compressed_dest = new_dir.join(COMPRESSED_AGENTS_MD_NAME);
3708 linker
3709 .write_compressed_agents_md(&source, &compressed_dest, &SyncOptions::default())
3710 .unwrap();
3711
3712 let result = linker
3713 .process_nested_glob(
3714 &search_root,
3715 "**/*.compact.md",
3716 &[],
3717 "linked/{relative_path}/{file_name}",
3718 &SyncOptions::default(),
3719 )
3720 .unwrap();
3721
3722 assert_eq!(result.created, 1);
3723
3724 let new_link = temp_dir.path().join("linked/new/AGENTS.compact.md");

Callers

nothing calls this directly

Calls 2

process_nested_globMethod · 0.80

Tested by

no test coverage detected