Skip to content

Commit ae162cc

Browse files
authored
Merge pull request #596 from ratmice/reserve_grm_tests
Reserve `test_files` extensions starting with `grm`
2 parents 419fa16 + da153e0 commit ae162cc

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

lrlex/src/lib/ctbuilder.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,13 @@ where
545545
glob(&path_joined.to_string_lossy()).map_err(|e| e.to_string())?
546546
{
547547
let path = path?;
548+
if let Some(ext) = path.extension() {
549+
if let Some(ext) = ext.to_str() {
550+
if ext.starts_with("grm") {
551+
Err(ErrorString("test_files extensions beginning with `grm` are reserved.".into()))?
552+
}
553+
}
554+
}
548555
let input = fs::read_to_string(&path)?;
549556
let l: LRNonStreamingLexer<LexerTypesT> =
550557
closure_lexerdef.lexer(&input);

nimbleparse/src/main.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,18 @@ where
561561
}
562562
let mut input_paths = Vec::new();
563563
for path in paths {
564-
input_paths.push(path?);
564+
let path = path?;
565+
if let Some(ext) = path.extension() {
566+
if let Some(ext) = ext.to_str() {
567+
if ext.starts_with("grm") {
568+
Err(NimbleparseError::Other(
569+
"test_files extensions beginning with `grm` are reserved."
570+
.into(),
571+
))?
572+
}
573+
}
574+
}
575+
input_paths.push(path);
565576
}
566577
input_paths
567578
} else {

0 commit comments

Comments
 (0)