summaryrefslogtreecommitdiffstats
path: root/tests/create_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/create_test.py')
-rw-r--r--tests/create_test.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/create_test.py b/tests/create_test.py
index 867a66e446..deb53aca20 100644
--- a/tests/create_test.py
+++ b/tests/create_test.py
@@ -38,7 +38,7 @@ def main():
if os.path.isfile(file_path):
print(f'ERROR: The file "{file_path}" already exists.')
sys.exit(1)
- with open(file_path, "w") as file:
+ with open(file_path, "w", encoding="utf-8", newline="\n") as file:
file.write(
"""/**************************************************************************/
/* test_{name_snake_case}.h {padding} */
@@ -101,14 +101,14 @@ TEST_CASE("[{name_pascal_case}] Example test case") {{
if args.invasive:
print("Trying to insert include directive in test_main.cpp...")
- with open("test_main.cpp", "r") as file:
+ with open("test_main.cpp", "r", encoding="utf-8") as file:
contents = file.read()
match = re.search(r'#include "tests.*\n', contents)
if match:
new_string = contents[: match.start()] + f'#include "tests/{file_path}"\n' + contents[match.start() :]
- with open("test_main.cpp", "w") as file:
+ with open("test_main.cpp", "w", encoding="utf-8", newline="\n") as file:
file.write(new_string)
print("Done.")
# Use clang format to sort include directives afster insertion.