xref: /freebsd/contrib/libxo/tests/xo/xo_02.sh (revision 8c784bb8cf36911b828652f0bf7e88f443abec50)
1#
2# $Id$
3#
4# Copyright 2019, 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"
15
16# This is testing --wrap, --open, --close, --top-wrap, etc, so
17# the output is not a single valid document
18
19set -- 'The capital of {:state} is {:city}\n' 'North Carolina' Raleigh
20
21${XOP} --top-wrap --open a/b/c "$@"
22${XOP} --top-wrap --close a/b/c --not-first "$@"
23
24${XOP} --top-wrap --wrap a/b/c "$@"
25
26${XOP} --top-wrap --open a/b/c "$@"
27${XOP} --depth 4 --not-first --wrap d/e/f "$@"
28${XOP} --top-wrap --close a/b/c --not-first "$@"
29
30${XOP} --wrap a/b/c "$@"
31
32${XOP} --top-wrap --wrap a/b/c "$@"
33
34${XOP} --top-wrap "test\n"
35
36${XOP} --open answer
37${XOP} "Answer:"
38${XOP} --continuation "$@"
39${XOP} --close answer
40
41${XOP} --top-wrap --open top/data
42${XOP} --depth 2 'First {:tag} ' value1
43${XOP} --depth 2 --continuation 'and then {:tag}\n' value2
44${XOP} --top-wrap --close top/data
45
46
47${XOP} --help
48
49${XOP} --open-list machine
50NF=
51for name in red green blue; do
52    ${XOP} --depth 1 $NF --open-instance machine
53    ${XOP} --depth 2 "Machine {k:name} has {:memory}\n" $name 55
54    ${XOP} --depth 1 --close-instance machine
55    NF=--not-first
56done
57${XOP} $NF --close-list machine
58