diff --git a/resources/tests/bin-quote.bin b/resources/tests/bin-quote.bin new file mode 100644 index 00000000..0c26c19c --- /dev/null +++ b/resources/tests/bin-quote.bin @@ -0,0 +1 @@ +'test \ No newline at end of file diff --git a/src/compiler/preprocessor/mod.rs b/src/compiler/preprocessor/mod.rs index 97895375..9ba80e4a 100644 --- a/src/compiler/preprocessor/mod.rs +++ b/src/compiler/preprocessor/mod.rs @@ -199,7 +199,8 @@ impl Preprocessor { desc: IncludeDesc, ) -> Result<(), CompileErr> { let name_string = decode_string(&desc.name); - if KNOWN_DIALECTS.contains_key(&name_string) { + // Terminate early checking anything with a processed include type. + if KNOWN_DIALECTS.contains_key(&name_string) || desc.kind.is_some() { return Ok(()); } diff --git a/src/tests/classic/run.rs b/src/tests/classic/run.rs index 83335888..ec6a31f2 100644 --- a/src/tests/classic/run.rs +++ b/src/tests/classic/run.rs @@ -2530,3 +2530,16 @@ fn test_include_zero_bin_pre_fix() { ]); assert_eq!(program, "(2 (1 14 (1 . 1) 2) (4 (1 . 1) 1))"); } + +#[test] +fn test_include_bin_should_not_be_parsed() { + let program = do_basic_run(&vec![ + "run".to_string(), + "-i".to_string(), + "resources/tests".to_string(), + "(mod (X) (include *standard-cl-23.1*) (embed-file test bin bin-quote.bin) test)" + .to_string(), + ]); + let result = do_basic_brun(&vec!["brun".to_string(), program]); + assert_eq!(result.trim(), "\"'test\""); +}