xref: /freebsd/contrib/libxo/tests/xo/xo_01.sh (revision 7fdf597e96a02165cfe22ff357b857d5fa15ed8a)
1#
2# $Id$
3#
4# Copyright 2014, Juniper Networks, Inc.
5# All rights reserved.
6# This SOFTWARE is licensed under the LICENSE provided in the
7# ../Copyright file. By downloading, installing, copying, or otherwise
8# using the SOFTWARE, you agree to be bound by the terms of that
9# LICENSE.
10
11XO=$1
12shift
13
14XOP="${XO} --warn --depth 1 --leading-xpath /top"
15
16${XO} --open top
17
18NF=
19for i in one:1:red two:2:blue three:3:green four:4:yellow ; do
20    set `echo $i | sed 's/:/ /g'`
21    ${XOP} ${NF} --wrap item \
22        'Item {k:name} is {Lw:number}{:value/%03d/%d}, {Lwc:color}{:color}\n' \
23         $1 $2 $3
24    NF=--not-first
25done
26
27XOAN="${XO} --wrap anchor  --not-first --warn --depth 1"
28${XOAN} "{[:18}{:address/%p}..{:foo/%u}{]:}\n" 0xdeadbeef 1
29${XOAN} "{[:/18}{:address/%p}..{:foo/%u}{]:}\n" 0xdeadbeef 1
30${XOAN} "{[:/%d}{:address/%p}..{:foo/%u}{]:}\n" 18 0xdeadbeef 1
31${XOAN} "{[:/%s}{:address/%p}..{:foo/%u}{]:}\n" 18 0xdeadbeef 1
32
33${XO} "partial line"
34${XO} -C " -- rest of line\n"
35
36${XO} --close top
37