# Features covered: Processing Instructions # # This file tests the parser's performance on Processing Instructions. # Sourcing this file into Tcl runs the tests and generates output # for errors. No output means no errors were found. # # Copyright (c) 1998-2000 Zveno Pty Ltd. # # $Id: pi.test,v 1.4 2002/07/28 23:20:37 rolf Exp $ source [file join [file dir [info script]] loadtdom.tcl] catch {unset result} proc PI {target data args} { lappend ::result $target $data } test pi-1.1 {PI} { set ::result {} catch {rename xml::pi-1.1 {}} set parser [xml::parser pi-1.1 \ -processinginstructioncommand PI] $parser parse { } set ::result } {Test {This is a processing instruction}} test pi-1.2 {PI: missing trailing ?} { set ::result {} catch {rename xml::pi-1.2 {}} set parser [xml::parser pi-1.2 \ -processinginstructioncommand PI] set returncode [catch {$parser parse { }} msg] list $returncode [regexp {error "unclosed token" at.+} $msg] } {1 1} test pi-2.1 {PI with special characters} { set ::result {} catch {rename xml::pi-2.1 {}} set parser [xml::parser pi-2.1 \ -processinginstructioncommand PI] $parser parse { } set ::result } {Test {[if !VMLRender]}} foreach parser [info commands pi-*] { $parser free } # cleanup ::tcltest::cleanupTests return