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

107 lines
2.3 KiB
Text
Raw Normal View History

2022-04-29 02:44:38 +00:00
#!/bin/sh
# Architectural Form: test ArcNamrA:
# Deriving content from attribute values; derive value of attribute "n"
# as content. Additionally, data from element "v" goes
# to attribute "text" of "verse".
# This makes onsgmls segfault; nsgmls.jc accepts this input:
# ONSGMLS=nsgmls.jc OSGMLNORM=sgmlnorm.jc ./af-11
# 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-11.sgml af-11.dtd af-meta-11.dtd"
cat <<EOF >af-11.sgml
<!DOCTYPE doc SYSTEM "af-11.dtd">
<doc>
<s>
<v n="1">verse 1</v>
<v n="2">verse 2</v>
</s>
</doc>
EOF
cat <<EOF >af-11.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-11.dtd" CDATA SGML>
<!ELEMENT doc - o (s+)>
<!ATTLIST doc
open NMTOKEN #FIXED "open">
<!ELEMENT s - o (v+)>
<!ATTLIST s
open NMTOKEN #FIXED "stanza">
<!ELEMENT v - o (#PCDATA)>
<!ATTLIST v
n CDATA #REQUIRED
open NMTOKEN #FIXED "verse"
doc-attr CDATA #FIXED "#ARCCONT n
text #CONTENT">
EOF
cat <<EOF >af-meta-11.dtd
<!ELEMENT open - o (stanza+)>
<!ELEMENT stanza - o (verse+)>
<!ELEMENT verse - o (#PCDATA)>
<!ATTLIST verse
-- n CDATA #REQUIRED --
text CDATA #IMPLIED>
EOF
tmpfiles="$tmpfiles af-11-onsgmls.out"
: ${ONSGMLS=onsgmls}
${ONSGMLS} >af-11-onsgmls.out -A open af-11.sgml
tmpfiles="$tmpfiles af-11-onsgmls.ok"
cat <<EOF >af-11-onsgmls.ok
(OPEN
(STANZA
ATEXT CDATA verse 1
(VERSE
-1
)VERSE
ATEXT CDATA verse 2
(VERSE
-2
)VERSE
)STANZA
)OPEN
C
EOF
: ${DIFF=diff}
${DIFF} af-11-onsgmls.ok af-11-onsgmls.out
result=$?
test $result = 0 || { rm -fr $tmpfiles; exit 1; }
tmpfiles="$tmpfiles af-11-norm.out"
: ${OSGMLNORM=osgmlnorm}
${OSGMLNORM} >af-11-norm.out -A open af-11.sgml
tmpfiles="$tmpfiles af-11-norm.ok"
cat <<EOF >af-11-norm.ok
<OPEN>
<STANZA>
<VERSE TEXT="verse 1">1</VERSE>
<VERSE TEXT="verse 2">2</VERSE>
</STANZA>
</OPEN>
EOF
${DIFF} af-11-norm.ok af-11-norm.out
result=$?
test $result = 0 || result=$(($result + 1))
rm -fr $tmpfiles
exit $result