author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Tue, 02 Feb 2016 21:49:24 +0000 | |
changeset 300 | b6d834208d33 |
parent 296 | ea3dbc023c80 |
permissions | -rw-r--r-- |
3
7909b6680107
Loaded into & commited from 5.3.6
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2
diff
changeset
|
1 |
"{ Package: 'stx:goodies/xmlsuite/core' }" |
0 | 2 |
|
3 |
"{ NameSpace: XMLv2 }" |
|
4 |
||
5 |
TestCase subclass:#JamesClarkCanonicalXMLWriterTests |
|
6 |
instanceVariableNames:'writer outputStream' |
|
7 |
classVariableNames:'' |
|
8 |
poolDictionaries:'' |
|
9 |
category:'XML Suite-Tests' |
|
10 |
! |
|
11 |
||
12 |
||
13 |
!JamesClarkCanonicalXMLWriterTests class methodsFor:'accessing'! |
|
14 |
||
15 |
resources |
|
16 |
||
17 |
^Array with: |
|
18 |
JamesClarkCanonicalXMLWriterTestResource |
|
19 |
||
20 |
"Created: / 20-05-2006 / 13:08:54 / janfrog" |
|
21 |
! ! |
|
22 |
||
23 |
!JamesClarkCanonicalXMLWriterTests methodsFor:'accessing'! |
|
24 |
||
25 |
output |
|
26 |
||
27 |
^outputStream contents |
|
28 |
||
29 |
"Created: / 21-10-2005 / 15:25:44 / janfrog" |
|
30 |
! |
|
31 |
||
32 |
writer |
|
33 |
||
34 |
^writer |
|
35 |
||
36 |
"Created: / 21-10-2005 / 15:25:44 / janfrog" |
|
37 |
! ! |
|
38 |
||
39 |
!JamesClarkCanonicalXMLWriterTests methodsFor:'initialize / release'! |
|
40 |
||
41 |
setUp |
|
42 |
"common setup - invoked before testing." |
|
43 |
||
44 |
super setUp. |
|
45 |
writer := JamesClarkCanonicalXMLWriter on:(outputStream := UnicodeString new writeStream) |
|
46 |
||
47 |
"Created: / 21-10-2005 / 15:16:16 / janfrog" |
|
48 |
! |
|
49 |
||
50 |
tearDown |
|
51 |
"common cleanup - invoked after testing." |
|
52 |
||
53 |
super tearDown |
|
54 |
||
55 |
"Created: / 21-10-2005 / 15:16:16 / janfrog" |
|
56 |
! ! |
|
57 |
||
58 |
!JamesClarkCanonicalXMLWriterTests methodsFor:'tests'! |
|
59 |
||
60 |
test_01 |
|
61 |
||
62 |
self writer |
|
63 |
startDocument; |
|
64 |
startElement:'x' namespace:'uri' prefix:'' attributes:(Attributes new); |
|
65 |
characters:(UnicodeString with:Character tab); |
|
66 |
endElement:'x' namespace:'uri' prefix:''; |
|
67 |
endDocument. |
|
68 |
||
69 |
self assert: self output = '<x>	</x>' |
|
70 |
||
71 |
"Created: / 21-10-2005 / 15:25:39 / janfrog" |
|
72 |
! |
|
73 |
||
74 |
test_02 |
|
75 |
||
76 |
self writer |
|
77 |
startDocument; |
|
78 |
startElement:'x' namespace:'uri' prefix:'' attributes:(Attributes new); |
|
79 |
characters:(UnicodeString with:Character linefeed); |
|
80 |
endElement:'x' namespace:'uri' prefix:''; |
|
81 |
endDocument. |
|
82 |
||
83 |
self assert: self output = '<x>&#A;</x>' |
|
84 |
||
85 |
"Created: / 21-10-2005 / 15:28:10 / janfrog" |
|
86 |
! |
|
87 |
||
88 |
test_03 |
|
89 |
||
90 |
self writer |
|
91 |
startDocument; |
|
92 |
startElement:'x' namespace:'uri' prefix:'' attributes:(Attributes new); |
|
93 |
characters:(UnicodeString with:Character return); |
|
94 |
endElement:'x' namespace:'uri' prefix:''; |
|
95 |
endDocument. |
|
96 |
||
97 |
self assert: self output = '<x>&#D;</x>' |
|
98 |
||
99 |
"Created: / 21-10-2005 / 15:28:22 / janfrog" |
|
100 |
! |
|
101 |
||
102 |
test_04 |
|
103 |
||
104 |
self writer |
|
105 |
startDocument; |
|
106 |
startElement:'x' namespace:'uri' prefix:'' |
|
107 |
attributes:(Attributes |
|
108 |
with: (Attr new |
|
109 |
localName:'attr'; |
|
110 |
value:'val') |
|
111 |
with: (Attr new |
|
112 |
localName:'abc'; |
|
113 |
value:'xyz') |
|
114 |
); |
|
115 |
endElement:'x' namespace:'uri' prefix:''; |
|
116 |
endDocument. |
|
117 |
||
118 |
self assert: self output = '<x abc="xyz" attr="val"></x>' |
|
119 |
||
120 |
"Created: / 21-10-2005 / 15:34:02 / janfrog" |
|
121 |
! |
|
122 |
||
123 |
test_files |
|
124 |
||
125 |
||
126 |
JamesClarkCanonicalXMLWriterTestResource current testFiles do:[:filename| |
|
127 |
| source |
|
128 |
canonical |
|
129 |
parser |
|
130 |
output | |
|
131 |
writer stream reset. |
|
132 |
source := (JamesClarkCanonicalXMLWriterTestResource current testFilesDirectory construct:filename) |
|
133 |
readStream contents asString. |
|
134 |
canonical := (JamesClarkCanonicalXMLWriterTestResource current canonicalFilesDirectory construct:filename) |
|
135 |
readStream contents asString. |
|
136 |
parser := XMLReader new setContentHandler: writer. |
|
137 |
parser parseInputSource:(InputSource onString:source). |
|
138 |
output := self output. |
|
139 |
||
140 |
||
141 |
self assert: output = canonical. |
|
142 |
||
143 |
Transcript showCR:filename asString , '...OK'. |
|
144 |
] |
|
145 |
||
146 |
"Created: / 20-05-2006 / 13:08:36 / janfrog" |
|
147 |
"Modified: / 29-09-2006 / 08:00:37 / janfrog" |
|
148 |
! ! |
|
149 |
||
150 |
!JamesClarkCanonicalXMLWriterTests class methodsFor:'documentation'! |
|
151 |
||
152 |
version |
|
153 |
^ '$Header: /opt/data/cvs/stx/goodies/xmlsuite/XMLv2__JamesClarkCanonicalXMLWriterTests.st,v 1.3 2006-10-02 14:55:02 vranyj1 Exp $' |
|
174
76f50ac2e6a0
removed dependency on libutilui ans sunit, testcases are autoloaded
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3
diff
changeset
|
154 |
! |
76f50ac2e6a0
removed dependency on libutilui ans sunit, testcases are autoloaded
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3
diff
changeset
|
155 |
|
76f50ac2e6a0
removed dependency on libutilui ans sunit, testcases are autoloaded
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3
diff
changeset
|
156 |
version_SVN |
76f50ac2e6a0
removed dependency on libutilui ans sunit, testcases are autoloaded
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3
diff
changeset
|
157 |
^ '$Id$' |
0 | 158 |
! ! |
300
b6d834208d33
ExpatXMLReader and DOM3XMLReader moved to xmlsuite/core package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
296
diff
changeset
|
159 |