Class: ODDB::ChapterParse::TestParserGecko

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



29
30
31
32
# File 'ext/chapterparse/test/test_parser.rb', line 29

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

- (Object) test_parse__b



33
34
35
36
37
38
39
# File 'ext/chapterparse/test/test_parser.rb', line 33

def test_parse__b
src = "<span style=\"font-weight: bold;\">Acidum\n"
@parser.feed(src)
assert_equal([[nil, nil, 1, nil]], 
  @formatter.font_stack)
@parser.feed('</span>')
assert_equal([], @formatter.font_stack) end

- (Object) test_parse__bb



43
44
45
46
47
48
49
50
# File 'ext/chapterparse/test/test_parser.rb', line 43

def test_parse__bb
  src = "<span bgcolor=\"#FFFFFF\" style=\"font-weight: bold;font-weight: bold\">Acidum\n"
  @parser.feed(src)
  assert_equal([[nil, nil, 1, nil]], 
    @formatter.font_stack)
  @parser.feed('</span>')
  assert_equal([], @formatter.font_stack)
end

- (Object) test_parse__bi



65
66
67
68
69
70
71
72
# File 'ext/chapterparse/test/test_parser.rb', line 65

def test_parse__bi
  src = "<span style=\"font-weight: bold; font-style: italic;\">Eigenschaften/Wirkungen\n"
  @parser.feed(src)
  assert_equal([[nil, nil, 1, nil], [nil, 1, nil, nil]],
    @formatter.font_stack)       
  @parser.feed('</span>')
  assert_equal([], @formatter.font_stack)
end

- (Object) test_parse__combined



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'ext/chapterparse/test/test_parser.rb', line 86

def test_parse__combined
  src = "<span style=\"font-weight: bold;\">\nFett\n"
  @parser.feed(src)
  assert_equal([[nil, nil, 1, nil]], 
    @formatter.font_stack)
  src = "<span style=\"font-family: courier new,courier,mono;\">\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('</span>')
  assert_equal([[nil, nil, 1, nil]], 
    @formatter.font_stack)
  assert_equal(0, @parser.nofill)
  @parser.feed('</span>')
  assert_equal([], @formatter.font_stack)
  assert_equal(0, @parser.nofill)
end

- (Object) test_parse__courier



112
113
114
115
116
117
118
# File 'ext/chapterparse/test/test_parser.rb', line 112

def test_parse__courier
  src="<span style=\"font-family: courier new,courier,mono;\">Test\n"
  @parser.feed(src)
  assert_equal([[nil,nil,nil,1]], @formatter.font_stack)
  @parser.feed("</span>")
  assert_equal([], @formatter.font_stack)
end

- (Object) test_parse__div_preformatted



122
123
124
125
126
127
128
# File 'ext/chapterparse/test/test_parser.rb', line 122

def test_parse__div_preformatted
  src="<div class=\"preformatted\">Test\n"
  @parser.feed(src)
  assert_equal([[nil, nil, nil, 1]], @formatter.font_stack)
  @parser.feed("</div>")
  assert_equal([], @formatter.font_stack)
end

- (Object) test_parse__font



76
77
78
79
80
81
82
# File 'ext/chapterparse/test/test_parser.rb', line 76

def test_parse__font
  src = "<span style=\"font-family: courier new,courier,mono;\">Wirkstoff\n"
  @parser.feed(src)
  assert_equal(1, @parser.nofill)
  @parser.feed('</span>')
  assert_equal(0, @parser.nofill)
end

- (Object) test_parse__i



54
55
56
57
58
59
60
61
# File 'ext/chapterparse/test/test_parser.rb', line 54

def test_parse__i
  src = "<span style=\"font-style: italic;\">mefenamicum\n"
  @parser.feed(src)
  assert_equal([[nil, 1, nil, nil]], 
    @formatter.font_stack)
  @parser.feed('</span>')
  assert_equal([], @formatter.font_stack)
end