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

- (Object) setup



146
147
148
149
# File 'ext/chapterparse/test/test_parser.rb', line 146

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

- (Object) test_parse__b



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

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

- (Object) test_parse__bi



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

def test_parse__bi
  src = "<STRONG><EM>Text\n"
  @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

- (Object) test_parse__combined



193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# File 'ext/chapterparse/test/test_parser.rb', line 193

def test_parse__combined
  src = "<STRONG>\nFett\n"
  @parser.feed(src)
  assert_equal([[nil, nil, 1, nil]], 
    @formatter.font_stack)
  src = "<FONT face=\"Courier New, Courier, mono\">Wirkstoff\nFixed-Width Font\n"
  @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

- (Object) test_parse__courier



219
220
221
# File 'ext/chapterparse/test/test_parser.rb', line 219

def test_parse__courier
  src = "Courier-Font of Internet-Explorer\n"
end

- (Object) test_parse__font



183
184
185
186
187
188
189
# File 'ext/chapterparse/test/test_parser.rb', line 183

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

- (Object) test_parse__i



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

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