2727import static org .junit .Assert .assertNotNull ;
2828import static org .junit .Assert .fail ;
2929
30-
3130import com .igormaznitsa .jcp .containers .FileInfoContainer ;
3231import com .igormaznitsa .jcp .containers .TextFileDataContainer ;
3332import com .igormaznitsa .jcp .context .PreprocessingState ;
@@ -187,6 +186,7 @@ private PreprocessorContext internalPreprocessAndMatch(final File srcfile,
187186 final PreprocessorExtension extension ,
188187 final PreprocessorLogger logger ,
189188 final boolean keepLines ,
189+ final boolean allowBlocks ,
190190 final VariablePair ... globalVariables )
191191 throws Exception {
192192 assertNotNull ("Preprocessing text is null" , preprocessingText );
@@ -200,6 +200,7 @@ private PreprocessorContext internalPreprocessAndMatch(final File srcfile,
200200 context .setDryRun (true );
201201 context .setSources (Collections .singletonList (srcfile .getParent ()));
202202 context .setKeepLines (keepLines );
203+ context .setAllowsBlocks (allowBlocks );
203204 context .setPreprocessorExtension (extension );
204205
205206 setGlobalVars (context , globalVariables );
@@ -283,10 +284,20 @@ private PreprocessorContext preprocessString(final String text, final List<Strin
283284 final List <String > preprocessingPart = parseStringForLines (text );
284285 return internalPreprocessAndMatch (THIS_CLASS_FILE , preprocessingPart ,
285286 preprocessedText == null ? new ArrayList <>() : preprocessedText , null , ext , null , false ,
287+ false ,
286288 globalVars );
287289 }
288290
289291 public PreprocessorContext assertFilePreprocessing (final String testFileName , boolean keepLines , final PreprocessorExtension ext , final PreprocessorLogger logger , final VariablePair ... globalVars ) throws Exception {
292+ return this .assertFilePreprocessing (testFileName , keepLines , false , ext , logger , globalVars );
293+ }
294+
295+ public PreprocessorContext assertFilePreprocessing (final String testFileName , boolean keepLines ,
296+ boolean allowsBlocks ,
297+ final PreprocessorExtension ext ,
298+ final PreprocessorLogger logger ,
299+ final VariablePair ... globalVars )
300+ throws Exception {
290301 final File file = new File (getClass ().getResource (testFileName ).toURI ());
291302
292303 if (!file .exists () || !file .isFile ()) {
@@ -324,6 +335,6 @@ public PreprocessorContext assertFilePreprocessing(final String testFileName, bo
324335 }
325336
326337 return internalPreprocessAndMatch (file , preprocessingPart , new ArrayList <>(), etalonPart , ext ,
327- logger , keepLines , globalVars );
338+ logger , keepLines , allowsBlocks , globalVars );
328339 }
329340}
0 commit comments