Does there exist a preprocessor to remove test annotations, e.g. <caret>?

I am using test data files with my subclass of LightCodeInsightFixtureTestCase.

I want to use these files for multiple purposes: for use with the in-memory editor and also for parsing through another program to get an AST. However, the <caret> markup interferes with the other program's parsing. Is there a preprocessor to remove the annotations? Currently, I'm just having to keep 2 versions of each before file, e.g.:

BeforeInsertParameterWithCaret.java

 
public class Test {
    void drive(Car car<caret>) {
        car.start();
    
}
}


BeforeInsertParameterWithoutCaret.java

 
public class Test {
    void drive(Car car) {
        car.start();
    
}
}


AfterInsertParameter.java

 
public class Test {
    void drive(Car car, int distance) {
        car.start();
    
}
}
2 comments
Comment actions Permalink

No, there is no such preprocessor in our codebase. The parsing of <caret> and <selection> is performed by EditorTestUtil.extractCaretAndSelectionMarkersImpl(). You can use this code as a basis for building an external script that would remove those markers from the code.

0
Comment actions Permalink

I had a feeling a script might be the answer. Thanks for pointing me to this method; it will probably be quite helpful in creating a solution.

0

Please sign in to leave a comment.