Skip to content

Commit 2d246e2

Browse files
author
Bao Zhiyuan
committed
fix skip dir
1 parent b27d639 commit 2d246e2

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

testgen/collect.mbt

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,20 @@ fn collect_cases_for_text(
397397
}
398398
}
399399

400+
///|
401+
fn should_skip_dir(name : String) -> Bool {
402+
match name {
403+
"_build"
404+
| "target"
405+
| "node_modules"
406+
| ".mooncakes"
407+
| ".moonagent"
408+
| ".repo"
409+
| ".git" => true
410+
_ => false
411+
}
412+
}
413+
400414
///|
401415
fn walk_dir(
402416
abs_dir : String,
@@ -422,7 +436,7 @@ fn walk_dir(
422436
value => value
423437
}
424438
if is_dir {
425-
if not(name is "_build" || name is "target" || name is "node_modules") {
439+
if not(should_skip_dir(name)) {
426440
walk_dir(abs_path, rel_path, out)
427441
}
428442
continue

testgen/testgen_wbtest.mbt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
///|
2+
test "should_skip_dir covers dependency and vcs dirs" {
3+
debug_inspect(
4+
[
5+
should_skip_dir("_build"),
6+
should_skip_dir("target"),
7+
should_skip_dir("node_modules"),
8+
should_skip_dir(".mooncakes"),
9+
should_skip_dir(".moonagent"),
10+
should_skip_dir(".repo"),
11+
should_skip_dir(".git"),
12+
should_skip_dir("src"),
13+
],
14+
content="[true, true, true, true, true, true, true, false]",
15+
)
16+
}
17+
118
///|
219
test "collect_cases_for_text uses ast nodes" {
320
let text =

0 commit comments

Comments
 (0)