actual/packages/node-libofx/OpenSP-1.5.2/tests/af-8

109 lines
2.2 KiB
Text
Raw Normal View History

2022-04-29 02:44:38 +00:00
#!/bin/sh
# Architectural Form: test ArcNamrA:
# Keep attribute "role" as "role", but rename its value "a" to "yyy"
# #MAPTOKEN is supported since 1.5pre4 according to NEWS
# test onsgmls and osgmlnorm
LANG=C; export LANG
LC_ALL=C; export LC_ALL
tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15
tmpfiles="$tmpfiles af-8.sgml af-8.dtd af-meta-8.dtd"
cat <<EOF >af-8.sgml
<!DOCTYPE doc SYSTEM "af-8.dtd">
<doc>
<s role="a">
<v n="1">verse 1</v>
<v n="2">verse 2</v>
</s>
</doc>
EOF
cat <<EOF >af-8.dtd
<!NOTATION SGML PUBLIC "-//ISO 8879:1986//NOTATION Standard Generalized Markup
Language//EN">
<?IS10744 ArcBase open>
<!NOTATION open PUBLIC "-//OpenJade Project//NOTATION AFDR ARCBASE open Architecture//EN">
<!ATTLIST #NOTATION open
ArcNamrA NAME #FIXED "doc-attr"
ArcDTD CDATA #FIXED "opendtd">
<!ENTITY opendtd SYSTEM "af-meta-8.dtd" CDATA SGML>
<!ELEMENT doc - o (s+)>
<!ATTLIST doc
open NMTOKEN #FIXED "open">
<!ELEMENT s - o (v+)>
<!ATTLIST s
role (a|b) #REQUIRED
doc-attr CDATA #FIXED "role role
#MAPTOKEN yyy a"
open NMTOKEN #FIXED "stanza">
<!ELEMENT v - o (#PCDATA)>
<!ATTLIST v
n CDATA #REQUIRED
open NMTOKEN #FIXED "verse"
doc-attr CDATA #FIXED "v n">
EOF
cat <<EOF >af-meta-8.dtd
<!ELEMENT open - o (stanza+)>
<!ELEMENT stanza - o (verse+)>
<!ATTLIST stanza
role (zzz|yyy) #REQUIRED
-- role CDATA #REQUIRED --
>
<!ELEMENT verse - o (#PCDATA)>
<!ATTLIST verse
v CDATA #REQUIRED>
EOF
tmpfiles="$tmpfiles af-8-onsgmls.out"
: ${ONSGMLS=onsgmls}
${ONSGMLS} >af-8-onsgmls.out -A open af-8.sgml
tmpfiles="$tmpfiles af-8-onsgmls.ok"
cat <<EOF >af-8-onsgmls.ok
(OPEN
AROLE TOKEN YYY
(STANZA
AV CDATA 1
(VERSE
-verse 1
)VERSE
AV CDATA 2
(VERSE
-verse 2
)VERSE
)STANZA
)OPEN
EOF
: ${DIFF=diff}
${DIFF} af-8-onsgmls.ok af-8-onsgmls.out
result=$?
test $result = 0 || { rm -fr $tmpfiles; exit 1; }
tmpfiles="$tmpfiles af-8-norm.out"
: ${OSGMLNORM=osgmlnorm}
${OSGMLNORM} >af-8-norm.out -A open af-8.sgml
tmpfiles="$tmpfiles af-8-norm.ok"
cat <<EOF >af-8-norm.ok
<OPEN>
<STANZA ROLEE="YYY">
<VERSE V="1">verse 1</VERSE>
<VERSE V="2">verse 2</VERSE>
</STANZA>
</OPEN>
EOF
${DIFF} af-8-norm.ok af-8-norm.out
result=$?
test $result = 0 || result=$(($result + 1))
rm -fr $tmpfiles
exit $result