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 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
# Features covered: Document Type Declaration
#
# This file contains a collection of tests for the TclXML parser.
# This file tests the parser's performance on Document Type Declarations.
# Sourcing this file into Tcl runs the tests and generates output
# for errors. No output means no errors were found.
#
# Copyright (c) 1998-2003 Zveno Pty Ltd.
#
# $Id: doctype.test,v 1.7 2003/12/03 20:06:36 balls Exp $
package require tcltest
source [file join [tcltest::workingDirectory] tclxmlutils.tcl]
testPackage $::tcltest::parser
namespace eval ::xml::doctypeTest {
namespace import -force ::tcltest::*
variable SETUP {
variable result {}
proc doctype {name pub system dtd} {
variable result
lappend result $name $pub $system $dtd
}
set parser [xml::parser \
-doctypecommand [namespace code doctype]]
}
variable CLEANUP {
catch {unset result}
rename doctype {}
$parser free
}
test doctype-1.1 {Document Type Declaration: no internal DTD subset} -setup $SETUP -constraints !xml_libxml2 -body {
$parser parse {<?xml version="1.0"?>
<!DOCTYPE Test>
<Test></Test>
}
set result
} -cleanup $CLEANUP -result {Test {} {} {{}}}
test doctype-2.1 {Document Type Declaration: internal DTD subset} -setup $SETUP -constraints !xml_libxml2 -body {
$parser parse {<?xml version="1.0"?>
<!DOCTYPE Test [<!ELEMENT Test EMPTY>]>
<Test></Test>
}
set result
} -cleanup $CLEANUP -result {Test {} {} {{<!ELEMENT Test EMPTY>}}}
test doctype-2.2 {Document Type Declaration: internal DTD subset} -setup $SETUP -constraints !xml_libxml2 -body {
$parser parse {<?xml version="1.0"?>
<!DOCTYPE Test [
<!ELEMENT Test EMPTY>
<!ATTLIST Test id CDATA #IMPLIED>
]>
<Test></Test>
}
set result
} -cleanup $CLEANUP -result {Test {} {} {{
<!ELEMENT Test EMPTY>
<!ATTLIST Test id CDATA #IMPLIED>
}}}
cleanupTests
}
namespace delete ::xml::doctypeTest
return
|