home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2000 December
/
PCWorld_2000-12_cd.bin
/
Komunikace
/
Comanche
/
xuibuilder
/
TclXML-1.1.1
/
tests
/
PI.test
< prev
next >
Wrap
Text File
|
2000-11-02
|
2KB
|
63 lines
# Features covered: Processing Instructions
#
# This file contains a collection of tests for the TclXML parser.
# 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 Zveno Pty Ltd.
#
# $Id: PI.test,v 1.1.1.1 1996/02/22 06:06:15 daniel Exp $
if {[string compare test [info procs test]] == 1} then {source defs}
if {[catch {package require xml 1.6}]} {
catch {puts stderr "Cannot load xml 1.6 package"}
return
}
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 {<?xml version="1.0"?>
<!DOCTYPE Test>
<Test><?Test This is a processing instruction?></Test>
}
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 {<?xml version="1.0"?>
<!DOCTYPE Test>
<Test><?Test This is a syntax error></Test>
}} msg]
list $returncode [regexp {PI: expected '\?' character.+} $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 {<?xml version="1.0"?>
<!DOCTYPE Test>
<Test><?[if !VMLRender]?></Test>
}
set ::result
} {{[if} !VMLRender\]}