From 69fe19d269faa698eff943d4fccb239b73ab7472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 8 Nov 2017 22:51:23 +0100 Subject: [PATCH] Use single quotes around JSON data to reduce need for escaping Also use unicode escape sequence for newline to avoid problems with some shells decoding \n even when they probably should not. --- tests/t_json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/t_json b/tests/t_json index 466dc9c..1887b0b 100755 --- a/tests/t_json +++ b/tests/t_json @@ -18,8 +18,8 @@ test_json() { fi } -test_json "[{\"name\": \"Test synonyms\", \"wordcount\": \"2\"},{\"name\": \"Sample 1 test dictionary\", \"wordcount\": \"1\"},{\"name\": \"test_dict\", \"wordcount\": \"1\"}]" -x -j -l -n --data-dir "$TEST_DIR" -test_json "[{\"dict\": \"Test synonyms\",\"word\":\"test\",\"definition\":\"\\\nresult of test\"}]" -x -j -n --data-dir "$TEST_DIR" foo -test_json "[]" -x -j -n --data-dir "$TEST_DIR" foobarbaaz +test_json '[{"name": "Test synonyms", "wordcount": "2"},{"name": "Sample 1 test dictionary", "wordcount": "1"},{"name": "test_dict", "wordcount": "1"}]' -x -j -l -n --data-dir "$TEST_DIR" +test_json '[{"dict": "Test synonyms","word":"test","definition":"\u000aresult of test"}]' -x -j -n --data-dir "$TEST_DIR" foo +test_json '[]' -x -j -n --data-dir "$TEST_DIR" foobarbaaz exit 0