diff --git a/applications/test/string/Test-string.C b/applications/test/string/Test-string.C index e3adafffab..46257c117b 100644 --- a/applications/test/string/Test-string.C +++ b/applications/test/string/Test-string.C @@ -44,6 +44,20 @@ Description using namespace Foam; +void testCommentStripping(const std::string& s) +{ + Info<< "input" << nl + << "========" << nl + << s << nl + << "========" << nl; + + Info<< "output" << nl + << "========" << nl + << stringOps::removeComments(s) << nl + << "========" << nl << nl; +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Main program: @@ -158,6 +172,35 @@ int main(int argc, char *argv[]) Info<<"trimRight: " << stringOps::trimRight(test) << endl; Info<<"trim: " << stringOps::trim(test) << endl; + // Test comment stripping + { + Info<< nl << "Test comment stripping" << nl; + testCommentStripping + ( + "/String without comments/" + ); + testCommentStripping + ( + "Removed some/* C-comments */ / C comments" + ); + testCommentStripping + ( + "Removed some//C++ comments\n / C++ comments" + ); + testCommentStripping + ( + "Partly degenerate C comment