xref: /freebsd/contrib/libxo/tests/xo/xo_01.sh (revision 406a584d7e80c2617dc035ede0d922215a12141c)
131337658SMarcel Moolenaar#
231337658SMarcel Moolenaar# $Id$
331337658SMarcel Moolenaar#
431337658SMarcel Moolenaar# Copyright 2014, Juniper Networks, Inc.
531337658SMarcel Moolenaar# All rights reserved.
631337658SMarcel Moolenaar# This SOFTWARE is licensed under the LICENSE provided in the
731337658SMarcel Moolenaar# ../Copyright file. By downloading, installing, copying, or otherwise
831337658SMarcel Moolenaar# using the SOFTWARE, you agree to be bound by the terms of that
931337658SMarcel Moolenaar# LICENSE.
1031337658SMarcel Moolenaar
1131337658SMarcel MoolenaarXO=$1
1231337658SMarcel Moolenaarshift
1331337658SMarcel Moolenaar
1431337658SMarcel MoolenaarXOP="${XO} --warn --depth 1 --leading-xpath /top"
1531337658SMarcel Moolenaar
1631337658SMarcel Moolenaar${XO} --open top
1731337658SMarcel Moolenaar
1831337658SMarcel MoolenaarNF=
1931337658SMarcel Moolenaarfor i in one:1:red two:2:blue three:3:green four:4:yellow ; do
2031337658SMarcel Moolenaar    set `echo $i | sed 's/:/ /g'`
2131337658SMarcel Moolenaar    ${XOP} ${NF} --wrap item \
2231337658SMarcel Moolenaar        'Item {k:name} is {Lw:number}{:value/%03d/%d}, {Lwc:color}{:color}\n' \
2331337658SMarcel Moolenaar         $1 $2 $3
2431337658SMarcel Moolenaar    NF=--not-first
2531337658SMarcel Moolenaardone
2631337658SMarcel Moolenaar
27fd5e3f3eSPhil ShaferXOAN="${XO} --wrap anchor  --not-first --warn --depth 1"
28fd5e3f3eSPhil Shafer${XOAN} "{[:18}{:address/%p}..{:foo/%u}{]:}\n" 0xdeadbeef 1
29fd5e3f3eSPhil Shafer${XOAN} "{[:/18}{:address/%p}..{:foo/%u}{]:}\n" 0xdeadbeef 1
30fd5e3f3eSPhil Shafer${XOAN} "{[:/%d}{:address/%p}..{:foo/%u}{]:}\n" 18 0xdeadbeef 1
31fd5e3f3eSPhil Shafer${XOAN} "{[:/%s}{:address/%p}..{:foo/%u}{]:}\n" 18 0xdeadbeef 1
32fd5e3f3eSPhil Shafer
33*406a584dSPhil Shafer${XO} "partial line"
34*406a584dSPhil Shafer${XO} -C " -- rest of line\n"
35*406a584dSPhil Shafer
3631337658SMarcel Moolenaar${XO} --close top
37