aboutsummaryrefslogtreecommitdiff
path: root/contrib/libxo/tests/xo/xo_02.sh
blob: 3f4917a6260316bb04440a83e6e029fabd804671 (plain) (blame)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#
# $Id$
#
# Copyright 2019, 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"

# This is testing --wrap, --open, --close, --top-wrap, etc, so
# the output is not a single valid document

set -- 'The capital of {:state} is {:city}\n' 'North Carolina' Raleigh

${XOP} --top-wrap --open a/b/c "$@"
${XOP} --top-wrap --close a/b/c --not-first "$@"

${XOP} --top-wrap --wrap a/b/c "$@"

${XOP} --top-wrap --open a/b/c "$@"
${XOP} --depth 4 --not-first --wrap d/e/f "$@"
${XOP} --top-wrap --close a/b/c --not-first "$@"

${XOP} --wrap a/b/c "$@"

${XOP} --top-wrap --wrap a/b/c "$@"

${XOP} --top-wrap "test\n"

${XOP} --open answer
${XOP} "Answer:"
${XOP} --continuation "$@"
${XOP} --close answer

${XOP} --top-wrap --open top/data
${XOP} --depth 2 'First {:tag} ' value1
${XOP} --depth 2 --continuation 'and then {:tag}\n' value2
${XOP} --top-wrap --close top/data


${XOP} --help

${XOP} --open-list machine
NF=
for name in red green blue; do
    ${XOP} --depth 1 $NF --open-instance machine
    ${XOP} --depth 2 "Machine {k:name} has {:memory}\n" $name 55
    ${XOP} --depth 1 --close-instance machine
    NF=--not-first
done
${XOP} $NF --close-list machine