コード例 #1
0
ファイル: clang_test.py プロジェクト: whatsmyname/clgen
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.")
コード例 #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
コード例 #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]))
コード例 #4
0
def ClangPreprocess(text: str) -> str:
    try:
        return clang.StripPreprocessorLines(Preprocess(text))
    except Exception as e:
        raise e
コード例 #5
0
ファイル: clang_test.py プロジェクト: whatsmyname/clgen
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"
コード例 #6
0
ファイル: clang_test.py プロジェクト: whatsmyname/clgen
def test_StripPreprocessorLines_no_stdin():
    """Test that without a stdin marker is stripped."""
    assert clang.StripPreprocessorLines("The\ncat\nsat\non\nthe\nmat") == ""
コード例 #7
0
ファイル: clang_test.py プロジェクト: whatsmyname/clgen
def test_StripPreprocessorLines_empty_input():
    assert clang.StripPreprocessorLines("") == ""