Root/b2/test/hierfld

1#!/bin/bash
2. ./Common
3
4#
5# Note: the hierarchy dump differs in some details from the input format.
6# Its main purpose is to aid with debugging, not to produce a syntactically
7# valid representation of the currently loaded hierarchy.
8#
9
10###############################################################################
11
12tst "hierarchy: name field" -dh <<EOF
13{ X=* };
14EOF
15
16expect <<EOF
17{ X=* }
18EOF
19
20#------------------------------------------------------------------------------
21
22tst "hierarchy: name set field (correct name)" -dh <<EOF
23<abc> = A<B<C;
24{ X=<abc> };
25EOF
26
27expect <<EOF
28{ X=<abc> }
29EOF
30
31#------------------------------------------------------------------------------
32
33tst_fail "hierarchy: name set field (incorrect name)" <<EOF
34<abc> = A<B<C;
35{ X=<def> };
36EOF
37
38expect <<EOF
39h:2: unknown name set "def"
40EOF
41
42#------------------------------------------------------------------------------
43
44tst "hierarchy: absolute value field (with unit)" -dh <<EOF
45{ X=#foo };
46EOF
47
48expect <<EOF
49{ X=#foo }
50EOF
51
52#------------------------------------------------------------------------------
53
54tst "hierarchy: absolute value field (without unit)" -dh <<EOF
55{ X=## };
56EOF
57
58expect <<EOF
59{ X=## }
60EOF
61
62#------------------------------------------------------------------------------
63
64tst_fail "hierarchy: absolute value field (omit unit name)" <<EOF
65{ X=# };
66EOF
67
68expect <<EOF
69h:1: syntax error
70EOF
71
72#------------------------------------------------------------------------------
73
74tst "hierarchy: relative value field (correct name)" -dh <<EOF
75{ X=#foo Y=%X };
76EOF
77
78expect <<EOF
79{ X=#foo Y=%foo }
80EOF
81
82#------------------------------------------------------------------------------
83
84tst_fail "hierarchy: relative value field (incorrect name)" <<EOF
85{ X=#foo Y=%Z };
86EOF
87
88expect <<EOF
89h:1: unknown field "Z"
90EOF
91
92###############################################################################
93

Archive Download this file

Branches:
master



interactive