Skip to content

Commit c2e14e4

Browse files
committed
Exclude csproj files from student files in csharp exercises
1 parent 11767e9 commit c2e14e4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

plugins/csharp/src/policy.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ impl StudentFilePolicy for CSharpStudentFilePolicy {
3737
// false for files in bin or obj directories, true for other files in src.
3838
fn is_student_source_file(path: &Path) -> bool {
3939
path.starts_with("src") && !Self::is_child_of_binary_dir(path)
40+
// exclude .csproj files
41+
&& !path.extension().map(|ext| ext == "csproj").unwrap_or_default()
4042
}
4143
}
4244

@@ -63,4 +65,14 @@ mod test {
6365
"src/any/file"
6466
)));
6567
}
68+
69+
#[test]
70+
fn csproj_file_in_src_is_not_student_file() {
71+
assert!(!CSharpStudentFilePolicy::is_student_source_file(Path::new(
72+
"src/file.csproj"
73+
)));
74+
assert!(!CSharpStudentFilePolicy::is_student_source_file(Path::new(
75+
"src/any/file.csproj"
76+
)));
77+
}
6678
}

0 commit comments

Comments
 (0)