Skip to content

Commit df3a0cc

Browse files
committed
test: fix indent
1 parent fdbffe7 commit df3a0cc

File tree

3 files changed

+209
-209
lines changed

3 files changed

+209
-209
lines changed

test/parser/test_sax2.rb

+138-138
Original file line numberDiff line numberDiff line change
@@ -4,200 +4,200 @@
44
require "rexml/sax2listener"
55

66
module REXMLTests
7-
class TestSAX2Parser < Test::Unit::TestCase
8-
class TestDocumentTypeDeclaration < self
9-
private
10-
def xml(internal_subset)
11-
<<-XML
7+
class TestSAX2Parser < Test::Unit::TestCase
8+
class TestDocumentTypeDeclaration < self
9+
private
10+
def xml(internal_subset)
11+
<<-XML
1212
<!DOCTYPE r SYSTEM "urn:x-henrikmartensson:test" [
1313
#{internal_subset}
1414
]>
1515
<r/>
16-
XML
17-
end
16+
XML
17+
end
1818

19-
class TestEntityDeclaration < self
20-
class Listener
21-
include REXML::SAX2Listener
22-
attr_reader :entity_declarations
23-
def initialize
24-
@entity_declarations = []
25-
end
19+
class TestEntityDeclaration < self
20+
class Listener
21+
include REXML::SAX2Listener
22+
attr_reader :entity_declarations
23+
def initialize
24+
@entity_declarations = []
25+
end
2626

27-
def entitydecl(declaration)
28-
super
29-
@entity_declarations << declaration
27+
def entitydecl(declaration)
28+
super
29+
@entity_declarations << declaration
30+
end
3031
end
31-
end
3232

33-
private
34-
def parse(internal_subset)
35-
listener = Listener.new
36-
parser = REXML::Parsers::SAX2Parser.new(xml(internal_subset))
37-
parser.listen(listener)
38-
parser.parse
39-
listener.entity_declarations
40-
end
33+
private
34+
def parse(internal_subset)
35+
listener = Listener.new
36+
parser = REXML::Parsers::SAX2Parser.new(xml(internal_subset))
37+
parser.listen(listener)
38+
parser.parse
39+
listener.entity_declarations
40+
end
4141

42-
class TestGeneralEntity < self
43-
class TestValue < self
44-
def test_double_quote
45-
assert_equal([["name", "value"]], parse(<<-INTERNAL_SUBSET))
42+
class TestGeneralEntity < self
43+
class TestValue < self
44+
def test_double_quote
45+
assert_equal([["name", "value"]], parse(<<-INTERNAL_SUBSET))
4646
<!ENTITY name "value">
47-
INTERNAL_SUBSET
48-
end
47+
INTERNAL_SUBSET
48+
end
4949

50-
def test_single_quote
51-
assert_equal([["name", "value"]], parse(<<-INTERNAL_SUBSET))
50+
def test_single_quote
51+
assert_equal([["name", "value"]], parse(<<-INTERNAL_SUBSET))
5252
<!ENTITY name 'value'>
53-
INTERNAL_SUBSET
53+
INTERNAL_SUBSET
54+
end
5455
end
55-
end
5656

57-
class TestExternlID < self
58-
class TestSystem < self
59-
def test_with_ndata
60-
declaration = [
61-
"name",
62-
"SYSTEM", "system-literal",
63-
"NDATA", "ndata-name",
64-
]
65-
assert_equal([declaration],
66-
parse(<<-INTERNAL_SUBSET))
57+
class TestExternlID < self
58+
class TestSystem < self
59+
def test_with_ndata
60+
declaration = [
61+
"name",
62+
"SYSTEM", "system-literal",
63+
"NDATA", "ndata-name",
64+
]
65+
assert_equal([declaration],
66+
parse(<<-INTERNAL_SUBSET))
6767
<!ENTITY name SYSTEM "system-literal" NDATA ndata-name>
68+
INTERNAL_SUBSET
69+
end
70+
71+
def test_without_ndata
72+
declaration = [
73+
"name",
74+
"SYSTEM", "system-literal",
75+
]
76+
assert_equal([declaration],
77+
parse(<<-INTERNAL_SUBSET))
78+
<!ENTITY name SYSTEM "system-literal">
79+
INTERNAL_SUBSET
80+
end
81+
end
82+
83+
class TestPublic < self
84+
def test_with_ndata
85+
declaration = [
86+
"name",
87+
"PUBLIC", "public-literal", "system-literal",
88+
"NDATA", "ndata-name",
89+
]
90+
assert_equal([declaration],
91+
parse(<<-INTERNAL_SUBSET))
92+
<!ENTITY name PUBLIC "public-literal" "system-literal" NDATA ndata-name>
93+
INTERNAL_SUBSET
94+
end
95+
96+
def test_without_ndata
97+
declaration = [
98+
"name",
99+
"PUBLIC", "public-literal", "system-literal",
100+
]
101+
assert_equal([declaration], parse(<<-INTERNAL_SUBSET))
102+
<!ENTITY name PUBLIC "public-literal" "system-literal">
103+
INTERNAL_SUBSET
104+
end
105+
end
106+
end
107+
end
108+
109+
class TestParameterEntity < self
110+
class TestValue < self
111+
def test_double_quote
112+
assert_equal([["%", "name", "value"]], parse(<<-INTERNAL_SUBSET))
113+
<!ENTITY % name "value">
68114
INTERNAL_SUBSET
69115
end
70116

71-
def test_without_ndata
72-
declaration = [
73-
"name",
74-
"SYSTEM", "system-literal",
75-
]
76-
assert_equal([declaration],
77-
parse(<<-INTERNAL_SUBSET))
78-
<!ENTITY name SYSTEM "system-literal">
117+
def test_single_quote
118+
assert_equal([["%", "name", "value"]], parse(<<-INTERNAL_SUBSET))
119+
<!ENTITY % name 'value'>
79120
INTERNAL_SUBSET
80121
end
81122
end
82123

83-
class TestPublic < self
84-
def test_with_ndata
124+
class TestExternlID < self
125+
def test_system
85126
declaration = [
127+
"%",
86128
"name",
87-
"PUBLIC", "public-literal", "system-literal",
88-
"NDATA", "ndata-name",
129+
"SYSTEM", "system-literal",
89130
]
90131
assert_equal([declaration],
91-
parse(<<-INTERNAL_SUBSET))
92-
<!ENTITY name PUBLIC "public-literal" "system-literal" NDATA ndata-name>
132+
parse(<<-INTERNAL_SUBSET))
133+
<!ENTITY % name SYSTEM "system-literal">
93134
INTERNAL_SUBSET
94135
end
95136

96-
def test_without_ndata
137+
def test_public
97138
declaration = [
139+
"%",
98140
"name",
99141
"PUBLIC", "public-literal", "system-literal",
100142
]
101143
assert_equal([declaration], parse(<<-INTERNAL_SUBSET))
102-
<!ENTITY name PUBLIC "public-literal" "system-literal">
144+
<!ENTITY % name PUBLIC "public-literal" "system-literal">
103145
INTERNAL_SUBSET
104146
end
105147
end
106148
end
107149
end
108150

109-
class TestParameterEntity < self
110-
class TestValue < self
111-
def test_double_quote
112-
assert_equal([["%", "name", "value"]], parse(<<-INTERNAL_SUBSET))
113-
<!ENTITY % name "value">
114-
INTERNAL_SUBSET
151+
class TestNotationDeclaration < self
152+
class Listener
153+
include REXML::SAX2Listener
154+
attr_reader :notation_declarations
155+
def initialize
156+
@notation_declarations = []
115157
end
116158

117-
def test_single_quote
118-
assert_equal([["%", "name", "value"]], parse(<<-INTERNAL_SUBSET))
119-
<!ENTITY % name 'value'>
120-
INTERNAL_SUBSET
159+
def notationdecl(*declaration)
160+
super
161+
@notation_declarations << declaration
121162
end
122163
end
123164

165+
private
166+
def parse(internal_subset)
167+
listener = Listener.new
168+
parser = REXML::Parsers::SAX2Parser.new(xml(internal_subset))
169+
parser.listen(listener)
170+
parser.parse
171+
listener.notation_declarations
172+
end
173+
124174
class TestExternlID < self
125175
def test_system
126-
declaration = [
127-
"%",
128-
"name",
129-
"SYSTEM", "system-literal",
130-
]
176+
declaration = ["name", "SYSTEM", nil, "system-literal"]
131177
assert_equal([declaration],
132-
parse(<<-INTERNAL_SUBSET))
133-
<!ENTITY % name SYSTEM "system-literal">
134-
INTERNAL_SUBSET
135-
end
136-
137-
def test_public
138-
declaration = [
139-
"%",
140-
"name",
141-
"PUBLIC", "public-literal", "system-literal",
142-
]
143-
assert_equal([declaration], parse(<<-INTERNAL_SUBSET))
144-
<!ENTITY % name PUBLIC "public-literal" "system-literal">
145-
INTERNAL_SUBSET
146-
end
147-
end
148-
end
149-
end
150-
151-
class TestNotationDeclaration < self
152-
class Listener
153-
include REXML::SAX2Listener
154-
attr_reader :notation_declarations
155-
def initialize
156-
@notation_declarations = []
157-
end
158-
159-
def notationdecl(*declaration)
160-
super
161-
@notation_declarations << declaration
162-
end
163-
end
164-
165-
private
166-
def parse(internal_subset)
167-
listener = Listener.new
168-
parser = REXML::Parsers::SAX2Parser.new(xml(internal_subset))
169-
parser.listen(listener)
170-
parser.parse
171-
listener.notation_declarations
172-
end
173-
174-
class TestExternlID < self
175-
def test_system
176-
declaration = ["name", "SYSTEM", nil, "system-literal"]
177-
assert_equal([declaration],
178-
parse(<<-INTERNAL_SUBSET))
178+
parse(<<-INTERNAL_SUBSET))
179179
<!NOTATION name SYSTEM "system-literal">
180-
INTERNAL_SUBSET
181-
end
180+
INTERNAL_SUBSET
181+
end
182182

183-
def test_public
184-
declaration = ["name", "PUBLIC", "public-literal", "system-literal"]
185-
assert_equal([declaration], parse(<<-INTERNAL_SUBSET))
183+
def test_public
184+
declaration = ["name", "PUBLIC", "public-literal", "system-literal"]
185+
assert_equal([declaration], parse(<<-INTERNAL_SUBSET))
186186
<!NOTATION name PUBLIC "public-literal" "system-literal">
187-
INTERNAL_SUBSET
187+
INTERNAL_SUBSET
188+
end
188189
end
189-
end
190190

191-
class TestPublicID < self
192-
def test_literal
193-
declaration = ["name", "PUBLIC", "public-literal", nil]
194-
assert_equal([declaration],
195-
parse(<<-INTERNAL_SUBSET))
191+
class TestPublicID < self
192+
def test_literal
193+
declaration = ["name", "PUBLIC", "public-literal", nil]
194+
assert_equal([declaration],
195+
parse(<<-INTERNAL_SUBSET))
196196
<!NOTATION name PUBLIC "public-literal">
197-
INTERNAL_SUBSET
197+
INTERNAL_SUBSET
198+
end
198199
end
199200
end
200201
end
201202
end
202203
end
203-
end

0 commit comments

Comments
 (0)