Skip to content

Commit

Permalink
generate_compilation_database
Browse files Browse the repository at this point in the history
  • Loading branch information
shenxianpeng committed Aug 16, 2024
1 parent 4bdfecb commit df5c583
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions testing/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cmake_minimum_required(VERSION 3.15)

# Set the project name to your project name
project(main C CXX)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

add_executable(main_app
${CMAKE_BINARY_SOURCE_DIR}main.c
)
target_include_directories(main_app PUBLIC ${CMAKE_BINARY_SOURCE_DIR})
2 changes: 2 additions & 0 deletions tests/test_clang_tidy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest
import subprocess
from pathlib import Path

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

0 comments on commit df5c583

Please sign in to comment.