diff --git a/tests/unittest/test_try_fix_yaml.py b/tests/unittest/test_try_fix_yaml.py index 09bdbff8..b23e9dd3 100644 --- a/tests/unittest/test_try_fix_yaml.py +++ b/tests/unittest/test_try_fix_yaml.py @@ -218,3 +218,36 @@ code_suggestions: } assert try_fix_yaml(review_text, first_key='code_suggestions', last_key='existing_code') == expected_output + + def test_wrong_indentation_code_block_scalar(self): + review_text = '''\ +code_suggestions: +- relevant_file: | + a.c + existing_code: | + int sum(int a, int b) { + return a + b; + } + + int sub(int a, int b) { + return a - b; + } +''' + expected_code_block = '''\ +int sum(int a, int b) { + return a + b; +} + +int sub(int a, int b) { + return a - b; +} +''' + expected_output = { + "code_suggestions": [ + { + "relevant_file": "a.c\n", + "existing_code": expected_code_block + } + ] + } + assert try_fix_yaml(review_text, first_key='code_suggestions', last_key='existing_code') == expected_output