Skip to content

Commit 0abc11d

Browse files
fix(scripts): clang format on cuda header files
1 parent 0f12f80 commit 0abc11d

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

scripts/update_clang_format.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Run clang-format across shared C and C++ source directories."""
1+
"""Run clang-format across shared C, C++, Objective-C, and CUDA source directories."""
22

33
# standard imports
44
import os
@@ -15,6 +15,7 @@
1515
'c',
1616
'cpp',
1717
'cu',
18+
'cuh',
1819
'h',
1920
'hpp',
2021
'm',

tests/unit/test_update_clang_format.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@ def test_directories_include_expected_roots():
1919

2020

2121
def test_file_types_include_shared_extensions():
22-
"""Verify the formatter includes shared C and C++ extensions."""
22+
"""Verify the formatter includes shared source extensions."""
2323

2424
assert update_clang_format.file_types == [
2525
'c',
2626
'cpp',
2727
'cu',
28+
'cuh',
2829
'h',
2930
'hpp',
3031
'm',
@@ -65,6 +66,7 @@ def test_main_formats_supported_files_only(monkeypatch, tmp_path):
6566
files = [
6667
os.path.join(tmp_root, 'src', 'main.cpp'),
6768
os.path.join(tmp_root, 'src', 'nested', 'kernel.cu'),
69+
os.path.join(tmp_root, 'src', 'nested', 'kernel.cuh'),
6870
os.path.join(tmp_root, 'tests', 'test_helper.mm'),
6971
os.path.join(tmp_root, 'tools', 'tool.h'),
7072
os.path.join(tmp_root, 'tools', 'notes.txt'),
@@ -90,6 +92,7 @@ def fake_clang_format(file):
9092
assert set(formatted_files) == {
9193
'src/main.cpp',
9294
'src/nested/kernel.cu',
95+
'src/nested/kernel.cuh',
9396
'tests/test_helper.mm',
9497
'tools/tool.h',
9598
}

0 commit comments

Comments
 (0)