summaryrefslogtreecommitdiffstats
path: root/contrib/libxo/tests/xo/xo_01.sh
blob: 504f1755311c3b60040293a5714369ae08391de7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#
# $Id$
#
# Copyright 2014, Juniper Networks, Inc.
# All rights reserved.
# This SOFTWARE is licensed under the LICENSE provided in the
# ../Copyright file. By downloading, installing, copying, or otherwise
# using the SOFTWARE, you agree to be bound by the terms of that
# LICENSE.

XO=$1
shift

XOP="${XO} --warn --depth 1 --leading-xpath /top"

${XO} --open top

NF=
for i in one:1:red two:2:blue three:3:green four:4:yellow ; do
    set `echo $i | sed 's/:/ /g'`
    ${XOP} ${NF} --wrap item \
        'Item {k:name} is {Lw:number}{:value/%03d/%d}, {Lwc:color}{:color}\n' \
         $1 $2 $3
    NF=--not-first
done

XOAN="${XO} --wrap anchor  --not-first --warn --depth 1"
${XOAN} "{[:18}{:address/%p}..{:foo/%u}{]:}\n" 0xdeadbeef 1
${XOAN} "{[:/18}{:address/%p}..{:foo/%u}{]:}\n" 0xdeadbeef 1
${XOAN} "{[:/%d}{:address/%p}..{:foo/%u}{]:}\n" 18 0xdeadbeef 1
${XOAN} "{[:/%s}{:address/%p}..{:foo/%u}{]:}\n" 18 0xdeadbeef 1

${XO} --close top
OpenPOWER on IntegriCloud