leejunyoung5819handmade-dataset-creator

공개

고품질 LLM 데이터셋 수제작을 위한 생산성 도구

23줄920 바이트
1use handmade_dataset_creator::recent::{MAX_RECENT, RecentFiles};
2
3#[test]
4fn recent_files_order_limit_and_persist() {
5 let dir = std::env::temp_dir().join(format!("hdc-recent-{}", std::process::id()));
6 let store = dir.join("cfg").join("recent.json");
7 let mut r = RecentFiles::load(Some(store.clone()));
8 assert!(r.paths.is_empty());
9 for i in 0..12 {
10 r.add(&dir.join(format!("{i}.jsonl")));
11 }
12 assert_eq!(r.paths.len(), MAX_RECENT);
13 assert!(r.paths[0].ends_with("11.jsonl"));
14 r.add(&dir.join("5.jsonl")); // 다시 열면 맨 앞으로
15 assert!(r.paths[0].ends_with("5.jsonl"));
16 assert_eq!(r.paths.iter().filter(|p| p.ends_with("5.jsonl")).count(), 1);
17
18 let reloaded = RecentFiles::load(Some(store.clone()));
19 assert_eq!(reloaded.paths, r.paths);
20 r.clear();
21 assert!(RecentFiles::load(Some(store)).paths.is_empty());
22 std::fs::remove_dir_all(&dir).ok();
23}