xref: /freebsd/contrib/libxo/tests/xo/xo_02.sh (revision 34b867ca30479cec104fd069178df294f8ea35f1)
1*406a584dSPhil Shafer#
2*406a584dSPhil Shafer# $Id$
3*406a584dSPhil Shafer#
4*406a584dSPhil Shafer# Copyright 2019, Juniper Networks, Inc.
5*406a584dSPhil Shafer# All rights reserved.
6*406a584dSPhil Shafer# This SOFTWARE is licensed under the LICENSE provided in the
7*406a584dSPhil Shafer# ../Copyright file. By downloading, installing, copying, or otherwise
8*406a584dSPhil Shafer# using the SOFTWARE, you agree to be bound by the terms of that
9*406a584dSPhil Shafer# LICENSE.
10*406a584dSPhil Shafer
11*406a584dSPhil ShaferXO=$1
12*406a584dSPhil Shafershift
13*406a584dSPhil Shafer
14*406a584dSPhil ShaferXOP="${XO} --warn"
15*406a584dSPhil Shafer
16*406a584dSPhil Shafer# This is testing --wrap, --open, --close, --top-wrap, etc, so
17*406a584dSPhil Shafer# the output is not a single valid document
18*406a584dSPhil Shafer
19*406a584dSPhil Shaferset -- 'The capital of {:state} is {:city}\n' 'North Carolina' Raleigh
20*406a584dSPhil Shafer
21*406a584dSPhil Shafer${XOP} --top-wrap --open a/b/c "$@"
22*406a584dSPhil Shafer${XOP} --top-wrap --close a/b/c --not-first "$@"
23*406a584dSPhil Shafer
24*406a584dSPhil Shafer${XOP} --top-wrap --wrap a/b/c "$@"
25*406a584dSPhil Shafer
26*406a584dSPhil Shafer${XOP} --top-wrap --open a/b/c "$@"
27*406a584dSPhil Shafer${XOP} --depth 4 --not-first --wrap d/e/f "$@"
28*406a584dSPhil Shafer${XOP} --top-wrap --close a/b/c --not-first "$@"
29*406a584dSPhil Shafer
30*406a584dSPhil Shafer${XOP} --wrap a/b/c "$@"
31*406a584dSPhil Shafer
32*406a584dSPhil Shafer${XOP} --top-wrap --wrap a/b/c "$@"
33*406a584dSPhil Shafer
34*406a584dSPhil Shafer${XOP} --top-wrap "test\n"
35*406a584dSPhil Shafer
36*406a584dSPhil Shafer${XOP} --open answer
37*406a584dSPhil Shafer${XOP} "Answer:"
38*406a584dSPhil Shafer${XOP} --continuation "$@"
39*406a584dSPhil Shafer${XOP} --close answer
40*406a584dSPhil Shafer
41*406a584dSPhil Shafer${XOP} --top-wrap --open top/data
42*406a584dSPhil Shafer${XOP} --depth 2 'First {:tag} ' value1
43*406a584dSPhil Shafer${XOP} --depth 2 --continuation 'and then {:tag}\n' value2
44*406a584dSPhil Shafer${XOP} --top-wrap --close top/data
45*406a584dSPhil Shafer
46*406a584dSPhil Shafer
47*406a584dSPhil Shafer${XOP} --help
48*406a584dSPhil Shafer
49*406a584dSPhil Shafer${XOP} --open-list machine
50*406a584dSPhil ShaferNF=
51*406a584dSPhil Shaferfor name in red green blue; do
52*406a584dSPhil Shafer    ${XOP} --depth 1 $NF --open-instance machine
53*406a584dSPhil Shafer    ${XOP} --depth 2 "Machine {k:name} has {:memory}\n" $name 55
54*406a584dSPhil Shafer    ${XOP} --depth 1 --close-instance machine
55*406a584dSPhil Shafer    NF=--not-first
56*406a584dSPhil Shaferdone
57*406a584dSPhil Shafer${XOP} $NF --close-list machine
58