Skip to content

Commit 2c60bcb

Browse files
committed
add test for #340
1 parent 3b65416 commit 2c60bcb

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/test_bundle.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,24 @@ def test_uncommenting(self) -> None:
6565
self.assertIn(b'void foo() {}', bundled)
6666
self.assertNotIn(b'void bar() {}', bundled)
6767

68+
def test_without_extension(self) -> None:
69+
# .hppといった拡張子がないheader fileがinclude中に現れても正しく展開される事を確認
70+
71+
files = {
72+
'example.test.cpp': b'#include "bar"\n#include "foo.hpp"',
73+
'bar': b'#include "./bar.hpp"',
74+
'bar.hpp': b'hello bar\n',
75+
'foo.hpp': b'hello foo\n',
76+
}
77+
path = pathlib.Path('example.test.cpp')
78+
with tests.utils.load_files(files) as tempdir:
79+
with tests.utils.chdir(tempdir):
80+
bundler = cplusplus_bundle.Bundler(iquotes=[tempdir])
81+
bundler.update(path)
82+
res = bundler.get()
83+
self.assertIn(b'hello bar\n', res)
84+
self.assertIn(b'hello foo\n', res)
85+
6886
@unittest.skipIf(shutil.which('clang++') is None, 'clang++ is required for this test')
6987
def test_reject_clang(self) -> None:
7088
files = {

0 commit comments

Comments
 (0)