def test_StripPreprocessorLines_everything_stripped_before_stdin(): """Test that everything before the stdin marker is stripped.""" assert (clang.StripPreprocessorLines(""" This will all be stripped. # 1 "<stdin>" 2 This will not be stripped.""") == "This will not be stripped.")
def test_StripPreprocessorLines_hash_stripped(): """Test that lines which begin with # symbol are stripped.""" assert clang.StripPreprocessorLines("""# 1 "<stdin>" 2 # This will be stripped. Foo This will # not be stripped. # But this will.""") == """Foo
def ClangPreprocess(text: str) -> str: try: return clang.StripPreprocessorLines( clanglib.Preprocess(text, CLANG_ARGS)) except llvm.LlvmError as e: raise errors.ClangException(str(e.stderr[:1024]))
def ClangPreprocess(text: str) -> str: try: return clang.StripPreprocessorLines(Preprocess(text)) except Exception as e: raise e
def test_StripPreprocessorLines_nothing_before_stdin(): """Test that if nothing exists before stdin marker, nothing is lost.""" assert clang.StripPreprocessorLines('# 1 "<stdin>" 2\nfoo') == "foo"
def test_StripPreprocessorLines_no_stdin(): """Test that without a stdin marker is stripped.""" assert clang.StripPreprocessorLines("The\ncat\nsat\non\nthe\nmat") == ""
def test_StripPreprocessorLines_empty_input(): assert clang.StripPreprocessorLines("") == ""