2012-05-30 18:27:05 +03:00
|
|
|
#!/bin/bash
|
|
|
|
. ./Common
|
|
|
|
|
|
|
|
#
|
|
|
|
# Note: the hierarchy dump differs in some details from the input format.
|
|
|
|
# Its main purpose is to aid with debugging, not to produce a syntactically
|
|
|
|
# valid representation of the currently loaded hierarchy.
|
|
|
|
#
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
|
2012-06-02 11:24:50 +03:00
|
|
|
tst "hierarchy: name field" -dh <<EOF
|
2012-05-30 18:27:05 +03:00
|
|
|
{ X=* };
|
|
|
|
EOF
|
|
|
|
|
|
|
|
expect <<EOF
|
|
|
|
{ X=* }
|
|
|
|
EOF
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
|
2012-06-02 11:24:50 +03:00
|
|
|
tst "hierarchy: name set field (correct name)" -dh <<EOF
|
2012-05-30 18:27:05 +03:00
|
|
|
<abc> = A<B<C;
|
|
|
|
{ X=<abc> };
|
|
|
|
EOF
|
|
|
|
|
|
|
|
expect <<EOF
|
|
|
|
{ X=<abc> }
|
|
|
|
EOF
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
tst_fail "hierarchy: name set field (incorrect name)" <<EOF
|
|
|
|
<abc> = A<B<C;
|
|
|
|
{ X=<def> };
|
|
|
|
EOF
|
|
|
|
|
|
|
|
expect <<EOF
|
2012-05-31 16:42:57 +03:00
|
|
|
h:2: unknown name set "def"
|
2012-05-30 18:27:05 +03:00
|
|
|
EOF
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
|
2012-06-02 11:24:50 +03:00
|
|
|
tst "hierarchy: absolute value field (with unit)" -dh <<EOF
|
2012-05-30 18:27:05 +03:00
|
|
|
{ X=#foo };
|
|
|
|
EOF
|
|
|
|
|
|
|
|
expect <<EOF
|
|
|
|
{ X=#foo }
|
|
|
|
EOF
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
|
2012-06-02 11:24:50 +03:00
|
|
|
tst "hierarchy: absolute value field (without unit)" -dh <<EOF
|
2012-06-01 06:20:31 +03:00
|
|
|
{ X=## };
|
|
|
|
EOF
|
|
|
|
|
|
|
|
expect <<EOF
|
|
|
|
{ X=## }
|
|
|
|
EOF
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
tst_fail "hierarchy: absolute value field (omit unit name)" <<EOF
|
2012-05-30 18:27:05 +03:00
|
|
|
{ X=# };
|
|
|
|
EOF
|
|
|
|
|
|
|
|
expect <<EOF
|
2012-05-31 16:42:57 +03:00
|
|
|
h:1: syntax error
|
2012-05-30 18:27:05 +03:00
|
|
|
EOF
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
|
2012-06-02 11:24:50 +03:00
|
|
|
tst "hierarchy: relative value field (correct name)" -dh <<EOF
|
2012-05-30 18:27:05 +03:00
|
|
|
{ X=#foo Y=%X };
|
|
|
|
EOF
|
|
|
|
|
|
|
|
expect <<EOF
|
|
|
|
{ X=#foo Y=%foo }
|
|
|
|
EOF
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
tst_fail "hierarchy: relative value field (incorrect name)" <<EOF
|
|
|
|
{ X=#foo Y=%Z };
|
|
|
|
EOF
|
|
|
|
|
|
|
|
expect <<EOF
|
2012-05-31 16:42:57 +03:00
|
|
|
h:1: unknown field "Z"
|
2012-05-30 18:27:05 +03:00
|
|
|
EOF
|
|
|
|
|
|
|
|
###############################################################################
|