summaryrefslogtreecommitdiff
path: root/src/test/test-util.c
diff options
context:
space:
mode:
authorDaniel Mack <daniel@zonque.org>2015-06-03 13:33:26 +0200
committerDaniel Mack <daniel@zonque.org>2015-06-03 13:54:21 +0200
commit3b51f8ddd5408eaae06e774e40144c7788748000 (patch)
tree3f84a2262447e760de177f9ef79fe70192824db6 /src/test/test-util.c
parent36f5e964dedc01b685a30367b7db1fa4c71ff2f3 (diff)
util: fix another cunescape() regression
Fix a regression caused by 4034a06d ("util: rework word parsing and c unescaping code") which broke octal escape sequences. The reason for this breakage is that cunescape_one() expects 4 characters in an octal encoding, which is a stray left-over from the old code which operated on different variables to make the length check. While at it, add a test case to prevent the same thing from happening again.
Diffstat (limited to 'src/test/test-util.c')
-rw-r--r--src/test/test-util.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/test/test-util.c b/src/test/test-util.c
index e0269821d7..7a398fafbe 100644
--- a/src/test/test-util.c
+++ b/src/test/test-util.c
@@ -460,6 +460,9 @@ static void test_cunescape(void) {
assert_se(cunescape("\\u0000", 0, &unescaped) < 0);
assert_se(cunescape("\\u00DF\\U000000df\\u03a0\\U00000041", UNESCAPE_RELAX, &unescaped) >= 0);
assert_se(streq_ptr(unescaped, "ßßΠA"));
+
+ assert_se(cunescape("\\073", 0, &unescaped) >= 0);
+ assert_se(streq_ptr(unescaped, ";"));
}
static void test_foreach_word(void) {