Skip to content

Commit dacf1ed

Browse files
authored
Simplify tests by including C++ source inline (#15)
1 parent b6b8624 commit dacf1ed

2 files changed

Lines changed: 23 additions & 19 deletions

File tree

sample.cc

Lines changed: 0 additions & 19 deletions
This file was deleted.

test_py_cppmodel.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,35 @@
1212
"-I/Library/Developer/CommandLineTools/usr/include",
1313
]
1414

15+
SOURCE = """\
16+
int z = 0;
17+
18+
struct __attribute__((annotate("A"))) A {
19+
int a;
20+
double b;
21+
char c[8];
22+
23+
__attribute__((annotate("foo"))) int foo(int);
24+
};
25+
26+
template <class T>
27+
class B {
28+
T t;
29+
T wibble(T);
30+
};
31+
32+
double bar(double);
33+
34+
int main() {}
35+
"""
36+
1537

1638
class TestCppModel(unittest.TestCase):
1739
def setUp(self):
1840
tu = TranslationUnit.from_source(
1941
"sample.cc",
2042
COMPILER_ARGS,
43+
unsaved_files=[("sample.cc", SOURCE)],
2144
)
2245
self.model = py_cppmodel.Model(tu)
2346

0 commit comments

Comments
 (0)