From 656c982f36f4fa66d8f158f073d8b875c1f0a2ed Mon Sep 17 00:00:00 2001 From: keyhr Date: Tue, 10 Jan 2023 21:27:26 +0900 Subject: [PATCH 1/2] [fix] error if preprocessor part does not exist --- .../formatters/preprocessor_directive.py | 2 +- tests/test_run.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/c_formatter_42/formatters/preprocessor_directive.py b/c_formatter_42/formatters/preprocessor_directive.py index 27d763d..ed86469 100644 --- a/c_formatter_42/formatters/preprocessor_directive.py +++ b/c_formatter_42/formatters/preprocessor_directive.py @@ -35,8 +35,8 @@ def preprocessor_directive(content: str) -> str: indent -= 1 # if newline doesn't follows preprocessor part, insert one - lastline_index = idented[-1][0] try: + lastline_index = idented[-1][0] if lines[lastline_index + 1] != "": lines.insert(lastline_index + 1, "") except IndexError: diff --git a/tests/test_run.py b/tests/test_run.py index 12874e6..cb47b03 100644 --- a/tests/test_run.py +++ b/tests/test_run.py @@ -53,3 +53,18 @@ def test_run_align_break_column_max(): def test_run_func_decl_single_tab_and_global_aligned(): pass + + +def test_basic(): + input = """ +int main(int argc, char*argv[]){ + return 0; +} +""" + output = """ +int\tmain(int argc, char *argv[]) +{ + return (0); +} +""" + assert output == run_all(input) From df1114661ad25a9e02fc17b277554881b691364f Mon Sep 17 00:00:00 2001 From: keyhr Date: Tue, 10 Jan 2023 21:29:56 +0900 Subject: [PATCH 2/2] [update] bump version 0.2.0 -> 0.2.1 --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 194e78f..0bead7b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = c_formatter_42 -version = 0.2.0 +version = 0.2.1 description = formatting tool complient with 42 school's norm long_description = file: README.md long_description_content_type = text/markdown