1#!/bin/ksh 2# 3# This file and its contents are supplied under the terms of the 4# Common Development and Distribution License ("CDDL"), version 1.0. 5# You may only use this file in accordance with the terms of version 6# 1.0 of the CDDL. 7# 8# A full copy of the text of the CDDL should have accompanied this 9# source. A copy of the CDDL is also available via the Internet at 10# http://www.illumos.org/license/CDDL. 11# 12 13# 14# Copyright (c) 2014, Joyent, Inc. 15# 16 17DIR=$(dirname $(whence $0)) 18. ${DIR}/json_common 19 20# 21# This test checks UTF-8 parsing behaviour 22# 23export LC_ALL="en_US.UTF-8" 24export LANG="${LANG}" 25 26BASELINE="$(cat <<EOF 27{\ 28"blank":"",\ 29"":"blank key",\ 30" ":"whitespace key",\ 31"\ttab\t":"tab key",\ 32"escapes":"escape \u001b newline \n cr \r backslash \\\\ quote \"",\ 33"escape array":[\ 34"escape \u001b",\ 35"alarm \u0007",\ 36"backspace \b",\ 37"formfeed \f",\ 38"newline \n",\ 39"return \r",\ 40"tab \t",\ 41"vertical tab \u000b",\ 42"black circle (UTF-8) \u25cf"\ 43]\ 44} 45EOF)" 46 47OUTPUT="$(${DIR}/../../bin/print_json <<'EOF' 48add_string "blank" ""; 49add_string "" "blank key"; 50add_string " " "whitespace key"; 51add_string " tab " "tab key"; 52add_string "escapes" "escape \x1b newline \n cr \r backslash \\ quote \""; 53add_string_array "escape array" 54 "escape \x1b" 55 "alarm \a" 56 "backspace \b" 57 "formfeed \f" 58 "newline \n" 59 "return \r" 60 "tab \t" 61 "vertical tab \v" 62 "black circle (UTF-8) \xe2\x97\x8f"; 63EOF)" 64 65complete 66