1898
|
1 |
"{ Encoding: utf8 }"
|
|
2 |
|
|
3 |
"{ Package: 'stx:goodies/regression' }"
|
|
4 |
|
|
5 |
"{ NameSpace: RegressionTests }"
|
|
6 |
|
|
7 |
TestCase subclass:#XMLCanonicalEncodingTests
|
|
8 |
instanceVariableNames:''
|
|
9 |
classVariableNames:''
|
|
10 |
poolDictionaries:''
|
|
11 |
category:'tests-Regression-XML'
|
|
12 |
!
|
|
13 |
|
|
14 |
!XMLCanonicalEncodingTests class methodsFor:'documentation'!
|
|
15 |
|
|
16 |
documentation
|
|
17 |
"
|
|
18 |
documentation to be added.
|
|
19 |
|
|
20 |
[author:]
|
|
21 |
cg
|
|
22 |
|
|
23 |
[instance variables:]
|
|
24 |
|
|
25 |
[class variables:]
|
|
26 |
|
|
27 |
[see also:]
|
|
28 |
|
|
29 |
"
|
|
30 |
! !
|
|
31 |
|
|
32 |
!XMLCanonicalEncodingTests methodsFor:'testing'!
|
|
33 |
|
|
34 |
test01
|
|
35 |
"see examples in https://www.w3.org/TR/2001/REC-xml-c14n-20010315"
|
|
36 |
|
|
37 |
|dom out canonOut|
|
|
38 |
|
|
39 |
dom := XML::XMLParser
|
|
40 |
parse:
|
|
41 |
'<?xml version="1.0" encoding="ISO-8859-1"?>
|
|
42 |
<doc>©</doc>'.
|
|
43 |
|
|
44 |
out := dom printString.
|
|
45 |
self assert:(out =
|
|
46 |
'<?xml version="1.0"?>
|
|
47 |
<doc>©</doc>').
|
|
48 |
canonOut := dom canonicalPrintString.
|
|
49 |
self assert:(canonOut = '<doc>©</doc>').
|
|
50 |
!
|
|
51 |
|
|
52 |
test02
|
|
53 |
"see examples in https://www.w3.org/TR/2001/REC-xml-c14n-20010315"
|
|
54 |
|
|
55 |
|dom out canonOut worldFile|
|
|
56 |
|
|
57 |
"/ <!!-- Let world.txt contain "world" (excluding the quotes) -->
|
|
58 |
|
|
59 |
worldFile := 'world.txt' asFilename.
|
|
60 |
[
|
|
61 |
worldFile contents:'world'.
|
|
62 |
|
|
63 |
dom := XML::XMLParser
|
|
64 |
parse:
|
|
65 |
'<!!DOCTYPE doc [
|
|
66 |
<!!ATTLIST doc attrExtEnt ENTITY #IMPLIED>
|
|
67 |
<!!ENTITY ent1 "Hello">
|
|
68 |
<!!ENTITY ent2 SYSTEM "world.txt">
|
|
69 |
<!!ENTITY entExt SYSTEM "earth.gif" NDATA gif>
|
|
70 |
<!!NOTATION gif SYSTEM "viewgif.exe">
|
|
71 |
]>
|
|
72 |
<doc attrExtEnt="entExt">
|
|
73 |
&ent1;, &ent2;!!
|
|
74 |
</doc>'.
|
|
75 |
|
|
76 |
out := dom printString.
|
|
77 |
self assert:(out =
|
|
78 |
'<doc attrExtEnt="entExt">
|
|
79 |
Hello, world!!
|
|
80 |
</doc>'
|
|
81 |
).
|
|
82 |
|
|
83 |
canonOut := dom canonicalPrintString.
|
|
84 |
self assert:(canonOut = '<doc attrExtEnt="entExt">
|
|
85 |
Hello, world!!
|
|
86 |
</doc>').
|
|
87 |
] ensure:[
|
|
88 |
worldFile remove
|
|
89 |
]
|
|
90 |
! !
|
|
91 |
|
|
92 |
!XMLCanonicalEncodingTests class methodsFor:'documentation'!
|
|
93 |
|
|
94 |
version
|
|
95 |
^ '$Header$'
|
|
96 |
!
|
|
97 |
|
|
98 |
version_CVS
|
|
99 |
^ '$Header$'
|
|
100 |
! !
|
|
101 |
|