test: add test case for fixing incorrect indentation in YAML code block scalar

This commit is contained in:
jwsong98
2025-05-22 16:18:45 +09:00
parent f10c389406
commit 684a438167

View File

@ -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