From 0734edf6f0449a0fbbea8c3a2cc73449440bf25a Mon Sep 17 00:00:00 2001 From: William Ballenthin Date: Mon, 31 Aug 2020 16:34:10 -0600 Subject: [PATCH] tests: fmt: add test for #263 --- tests/test_fmt.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/test_fmt.py b/tests/test_fmt.py index 1ca4725a..bac79d6c 100644 --- a/tests/test_fmt.py +++ b/tests/test_fmt.py @@ -92,6 +92,8 @@ def test_rule_reformat_order(): def test_rule_reformat_meta_update(): + # test updating the rule content after parsing + rule = textwrap.dedent( """ rule: @@ -112,3 +114,23 @@ def test_rule_reformat_meta_update(): rule = capa.rules.Rule.from_yaml(rule) rule.name = "test rule" assert rule.to_yaml() == EXPECTED + + +def test_rule_reformat_string_description(): + # see #263 + src = textwrap.dedent( + """ + rule: + meta: + name: test rule + author: user@domain.com + scope: function + features: + - and: + - string: foo + description: bar + """ + ) + + rule = capa.rules.Rule.from_yaml(src) + assert rule.to_yaml() == src