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 17 DIR=$(dirname $(whence $0)) 18 . ${DIR}/json_common 19 20 BASELINE="$(cat <<EOF 21 {\ 22 "bool0":true,\ 23 "a fact":true,\ 24 "a fiction":false,\ 25 "1":true,\ 26 " ":true\ 27 } 28 EOF)" 29 30 OUTPUT="$(${DIR}/../../bin/print_json <<'EOF' 31 /* 32 * add_boolean calls nvlist_add_boolean(), which the JSON formatter 33 * will emit as a true-valued boolean. 34 */ 35 add_boolean "bool0"; 36 add_boolean_value "a fact" "true"; 37 add_boolean_value "a fiction" "false"; 38 add_boolean "1"; 39 40 /* 41 * Test a key with a whitespace-only name: 42 */ 43 add_boolean " "; 44 EOF)" 45 46 complete