Skip to content

Commit df5c583

Browse files
committed
generate_compilation_database
1 parent 4bdfecb commit df5c583

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

testing/CMakeLists.txt

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
cmake_minimum_required(VERSION 3.15)
2+
3+
# Set the project name to your project name
4+
project(main C CXX)
5+
6+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
7+
8+
add_executable(main_app
9+
${CMAKE_BINARY_SOURCE_DIR}main.c
10+
)
11+
target_include_directories(main_app PUBLIC ${CMAKE_BINARY_SOURCE_DIR})

tests/test_clang_tidy.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import pytest
2+
import subprocess
23
from pathlib import Path
34

45
from cpp_linter_hooks.clang_tidy import run_clang_tidy
@@ -11,6 +12,7 @@
1112
),
1213
)
1314
def test_run_clang_tidy_valid(args, expected_retval, tmp_path):
15+
subprocess.run(['mkdir', '-p', 'build', '&&', 'cmake', '-Bbuild', 'testing/'], shell=True)
1416
# copy test file to tmp_path to prevent modifying repo data
1517
test_file = tmp_path / "main.c"
1618
test_file.write_bytes(Path("testing/main.c").read_bytes())

0 commit comments

Comments
 (0)