diff options
Diffstat (limited to 'zephyr/zmake/tests/test_util.py')
-rw-r--r-- | zephyr/zmake/tests/test_util.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/zephyr/zmake/tests/test_util.py b/zephyr/zmake/tests/test_util.py index 15f92f58ab..0524a153fd 100644 --- a/zephyr/zmake/tests/test_util.py +++ b/zephyr/zmake/tests/test_util.py @@ -87,3 +87,18 @@ def test_read_kconfig_autoconf_value(value): f.write("#define TEST {}".format(value)) read_value = util.read_kconfig_autoconf_value(path, "TEST") assert int(read_value) == value + + +@pytest.mark.parametrize( + ["input_str", "expected_result"], + [ + ("", '""'), + ("TROGDOR ABC-123", '"TROGDOR ABC-123"'), + ("hello world", '"hello world"'), + ("hello\nworld", r'"hello\nworld"'), + ('hello"world', r'"hello\"world"'), + ("hello\\world", '"hello\\\\world"'), + ], +) +def test_c_str(input_str, expected_result): + assert util.c_str(input_str) == expected_result |