raf 0.1.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/test/test_strike.rb DELETED
@@ -1,76 +0,0 @@
1
- #!/usr/bin/env ruby
2
- $:.unshift File.join(File.dirname(__FILE__), "../lib")
3
- require 'test_helper'
4
- require 'rafinlineparser.tab'
5
-
6
- class TestRafStrike < Test::Unit::TestCase
7
- def setup
8
- @raf = Raf::InlineParser.new
9
- end
10
-
11
- def test_strike_is_strike
12
- str = '((-aaa-))'
13
- res = @raf.parse(str)
14
- assert_kind_of Raf::Strike, res[0]
15
- end
16
-
17
- def test_strike_apply
18
- str = '((-aaa-))'
19
- res = @raf.parse(str)
20
- assert_respond_to res[0], 'apply'
21
- assert_equal '<Strike>aaa</Strike>', res[0].apply
22
- end
23
-
24
- def test_strike_in_element
25
- str1 = '((-((-aaa-))-))'
26
- res = @raf.parse(str1)
27
- assert_equal [Raf::Strike], res[0].contents.map {|c| c.class }
28
- assert_equal '<Strike><Strike>aaa</Strike></Strike>', res[0].apply
29
-
30
- str2 = '((-a((-a-))a-))'
31
- res = @raf.parse(str2)
32
- assert_equal [Raf::Plain, Raf::Strike, Raf::Plain], res[0].contents.map {|c| c.class }
33
- assert_equal '<Strike>a<Strike>a</Strike>a</Strike>', res[0].apply
34
-
35
- str3 = '((-a((*a*))a-))'
36
- res = @raf.parse(str3)
37
- assert_equal [Raf::Plain, Raf::Emphasis, Raf::Plain], res[0].contents.map {|c| c.class }
38
- assert_equal '<Strike>a<Emphasis>a</Emphasis>a</Strike>', res[0].apply
39
- end
40
-
41
- def test_strike_raise_non_terminate
42
- str = '((-aaa))'
43
- assert_raise Racc::ParseError do
44
- @raf.parse(str)
45
- end
46
-
47
- str = '((-aaa'
48
- assert_raise Racc::ParseError do
49
- @raf.parse(str)
50
- end
51
- end
52
-
53
- def test_strike_raise_different_terminate
54
- str = '((-aaa*))'
55
- assert_raise Racc::ParseError do
56
- @raf.parse(str)
57
- end
58
- end
59
-
60
- def test_strike_linefeed
61
- str1 = <<EOL
62
- ((-a
63
- aa-))
64
- EOL
65
- res = @raf.parse(str1)
66
- assert_kind_of Raf::Strike, res[0]
67
- assert_equal "<Strike>a\naa</Strike>", res[0].apply
68
-
69
- str2 = '((-a
70
-
71
- aa-))'
72
- res = @raf.parse(str2)
73
- assert_kind_of Raf::Strike, res[0]
74
- assert_equal "<Strike>a\n\naa</Strike>", res[0].apply
75
- end
76
- end
@@ -1,63 +0,0 @@
1
- #!/usr/bin/env ruby
2
- $:.unshift File.join(File.dirname(__FILE__), "../lib")
3
- require 'test_helper'
4
- require 'rafblockparser.tab'
5
-
6
- class TestRafTableBlock < Test::Unit::TestCase
7
- def setup
8
- @raf = Raf::BlockParser.new
9
- @table = TableString.new
10
- end
11
-
12
- def test_table_is_table
13
- res = @raf.parse(@table.single)
14
- assert_kind_of Raf::Table, res[0]
15
- assert_equal "|aaa|bbb\n|ccc|ddd\n", res[0].apply
16
- end
17
-
18
- def test_table_with_terminate
19
- res = @raf.parse(@table.single_with_terminate)
20
- assert_kind_of Raf::Table, res[0]
21
- assert_equal "|aaa|bbb\n|ccc|ddd\n", res[0].apply
22
- end
23
-
24
- def test_table_with_head
25
- res = @raf.parse(@table.head)
26
- assert_kind_of Raf::Table, res[0]
27
- assert_equal "|*aaa|*bbb\n|ccc|ddd\n", res[0].apply
28
- end
29
-
30
- def test_table_with_head_and_terminate
31
- res = @raf.parse(@table.head_with_terminate)
32
- assert_kind_of Raf::Table, res[0]
33
- assert_equal "|*aaa|*bbb\n|ccc|ddd\n", res[0].apply
34
- end
35
- end
36
-
37
- class TableString
38
- def single
39
- <<EOL
40
- |aaa|bbb
41
- |ccc|ddd
42
- EOL
43
- end
44
- def single_with_terminate
45
- <<EOL
46
- |aaa|bbb|
47
- |ccc|ddd|
48
- EOL
49
- end
50
-
51
- def head
52
- <<EOL
53
- |*aaa|*bbb|
54
- |ccc|ddd|
55
- EOL
56
- end
57
- def head_with_terminate
58
- <<EOL
59
- |*aaa*|*bbb*|
60
- |ccc|ddd|
61
- EOL
62
- end
63
- end
data/test/test_verb.rb DELETED
@@ -1,86 +0,0 @@
1
- #!/usr/bin/env ruby
2
- $:.unshift File.join(File.dirname(__FILE__), "../lib")
3
- require 'test_helper'
4
- require 'rafinlineparser.tab'
5
-
6
- class TestRafVerb < Test::Unit::TestCase
7
- def setup
8
- @raf = Raf::InlineParser.new
9
- end
10
-
11
- def test_verb_is_verb
12
- str = "(('aaa'))"
13
- res = @raf.parse(str)
14
- assert_kind_of Raf::Verb, res[0]
15
- assert_equal ["aaa"], res[0].contents
16
- assert_equal '<Verb>aaa</Verb>', res[0].apply
17
- end
18
-
19
- def test_verb_in_emphasis
20
- str = "(('((*aaa*))'))"
21
- res = @raf.parse(str)
22
- assert_kind_of Raf::Verb, res[0]
23
- assert_equal '<Verb>((*aaa*))</Verb>', res[0].apply
24
-
25
- str = "(('((*aaa))'))"
26
- res = @raf.parse(str)
27
- assert_kind_of Raf::Verb, res[0]
28
- assert_equal '<Verb>((*aaa))</Verb>', res[0].apply
29
- end
30
-
31
- def test_verb_in_italic
32
- str = "(('((_aaa_))'))"
33
- res = @raf.parse(str)
34
- assert_kind_of Raf::Verb, res[0]
35
- assert_equal '<Verb>((_aaa_))</Verb>', res[0].apply
36
- end
37
-
38
- def test_verb_in_strike
39
- str = "(('((-aaa-))'))"
40
- res = @raf.parse(str)
41
- assert_kind_of Raf::Verb, res[0]
42
- assert_equal '<Verb>((-aaa-))</Verb>', res[0].apply
43
- end
44
-
45
- def test_verb_in_ruby
46
- str = "(('((^aaa^))'))"
47
- res = @raf.parse(str)
48
- assert_kind_of Raf::Verb, res[0]
49
- assert_equal '<Verb>((^aaa^))</Verb>', res[0].apply
50
- end
51
-
52
- def test_verb_in_footnote
53
- str = "(('(([aaa]))'))"
54
- res = @raf.parse(str)
55
- assert_kind_of Raf::Verb, res[0]
56
- assert_equal '<Verb>(([aaa]))</Verb>', res[0].apply
57
- end
58
-
59
- def test_verb_in_image
60
- str = "(('(($aaa$))'))"
61
- res = @raf.parse(str)
62
- assert_kind_of Raf::Verb, res[0]
63
- assert_equal '<Verb>(($aaa$))</Verb>', res[0].apply
64
- end
65
-
66
- def test_verb_in_reference
67
- str = "(('((<aaa>))'))"
68
- res = @raf.parse(str)
69
- assert_kind_of Raf::Verb, res[0]
70
- assert_equal '<Verb>((<aaa>))</Verb>', res[0].apply
71
- end
72
-
73
- def test_verb_in_manuedo
74
- str = "(('((/aaa/))'))"
75
- res = @raf.parse(str)
76
- assert_kind_of Raf::Verb, res[0]
77
- assert_equal '<Verb>((/aaa/))</Verb>', res[0].apply
78
- end
79
-
80
- def test_verb_in_erb
81
- str = "(('<%= aaa %>'))"
82
- res = @raf.parse(str)
83
- assert_kind_of Raf::Verb, res[0]
84
- assert_equal '<Verb><%= aaa %></Verb>', res[0].apply
85
- end
86
- end
data/test/ts_block.rb DELETED
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # = ts_block
3
- require "test_headline"
4
- require "test_paragraph"
5
- require "test_quoteblock"
6
- require "test_reference"
7
- require "test_itemlistblock"
8
- require "test_numlistblock"
9
- require "test_tableblock"
10
- require "test_footnote"
data/test/ts_inline.rb DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # = ts_inline
3
- require "test_emphasis"
4
- require "test_italic"
5
- require "test_strike"
6
- require "test_ruby"
7
- require "test_verb"
8
- require "test_image"
data/test/ts_rafparser.rb DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # = ts_rafparser.rb
3
- require "ts_inline"
4
- require "ts_block"