Class: ODDB::ChapterParse::TestParserIE

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
ext/chapterparse/test/test_parser.rb

Defined Under Namespace

Classes: Formatter

Instance Method Summary collapse

Instance Method Details

#setupObject



137
138
139
140
# File 'ext/chapterparse/test/test_parser.rb', line 137

def setup
	@formatter = Formatter.new
	@parser = Parser.new(@formatter)
end

#test_parse__bObject



141
142
143
144
145
146
147
148
149
150
# File 'ext/chapterparse/test/test_parser.rb', line 141

def test_parse__b
	src=<<-EOS
<STRONG>Text
	EOS
		@parser.feed(src)
	assert_equal([[nil, nil, 1, nil]],
		@formatter.font_stack)
	@parser.feed('</STRONG>')
	assert_equal([], @formatter.font_stack)
end

#test_parse__biObject



161
162
163
164
165
166
167
168
169
170
# File 'ext/chapterparse/test/test_parser.rb', line 161

def test_parse__bi
	src = <<-EOS
<STRONG><EM>Text
	EOS
	@parser.feed(src)
	assert_equal([[nil, nil, 1, nil], [nil, 1, nil, nil]],
		@formatter.font_stack)				
	@parser.feed('</STRONG></EM>')
	assert_equal([], @formatter.font_stack)
end

#test_parse__combinedObject



180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# File 'ext/chapterparse/test/test_parser.rb', line 180

def test_parse__combined
	src = <<-EOS
<STRONG>
  Fett
	EOS
	@parser.feed(src)
	assert_equal([[nil, nil, 1, nil]], 
		@formatter.font_stack)
	src = <<-EOS
  <FONT face="Courier New, Courier, mono">Wirkstoff
Fixed-Width Font
	EOS
	@parser.feed(src)
	assert_equal([[nil, nil, 1, nil], [nil, nil, nil, 1]],
		@formatter.font_stack)
	assert_equal(1, @parser.nofill)
	@parser.feed('</FONT>')
	assert_equal([[nil, nil, 1, nil]], 
		@formatter.font_stack)
	assert_equal(0, @parser.nofill)
	@parser.feed('</STRONG>')
	assert_equal([], @formatter.font_stack)
	assert_equal(0, @parser.nofill)
end

#test_parse__courierObject



204
205
206
207
208
# File 'ext/chapterparse/test/test_parser.rb', line 204

def test_parse__courier
	src = <<-EOS
		Courier-Font of Internet-Explorer
	EOS
end

#test_parse__fontObject



171
172
173
174
175
176
177
178
179
# File 'ext/chapterparse/test/test_parser.rb', line 171

def test_parse__font
	src = <<-EOS
<FONT face="Courier New, Courier, mono">Wirkstoff
	EOS
	@parser.feed(src)
	assert_equal(1, @parser.nofill)
	@parser.feed('</FONT>')
	assert_equal(0, @parser.nofill)
end

#test_parse__iObject



151
152
153
154
155
156
157
158
159
160
# File 'ext/chapterparse/test/test_parser.rb', line 151

def test_parse__i
	src=<<-EOS
<EM>Text
	EOS
	@parser.feed(src)
	assert_equal([[nil, 1, nil, nil]],
		@formatter.font_stack)
	@parser.feed('</EM>')
	assert_equal([], @formatter.font_stack)
end