Ejemplo n.º 1
0
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.")
Ejemplo n.º 2
0
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
Ejemplo n.º 3
0
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]))
Ejemplo n.º 4
0
def ClangPreprocess(text: str) -> str:
    try:
        return clang.StripPreprocessorLines(Preprocess(text))
    except Exception as e:
        raise e
Ejemplo n.º 5
0
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"
Ejemplo n.º 6
0
def test_StripPreprocessorLines_no_stdin():
    """Test that without a stdin marker is stripped."""
    assert clang.StripPreprocessorLines("The\ncat\nsat\non\nthe\nmat") == ""
Ejemplo n.º 7
0
def test_StripPreprocessorLines_empty_input():
    assert clang.StripPreprocessorLines("") == ""