scripref 0.15.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog +9 -0
- data/Rakefile +0 -10
- data/lib/scripref/basic_methods.rb +3 -1
- data/lib/scripref/bookname.rb +6 -4
- data/lib/scripref/bookorder.rb +20 -0
- data/lib/scripref/const_reader.rb +2 -1
- data/lib/scripref/english.rb +10 -6
- data/lib/scripref/formatter.rb +5 -4
- data/lib/scripref/german.rb +17 -13
- data/lib/scripref/include.rb +3 -1
- data/lib/scripref/parser.rb +17 -15
- data/lib/scripref/passage.rb +39 -45
- data/lib/scripref/pipelining.rb +2 -1
- data/lib/scripref/processor.rb +3 -2
- data/lib/scripref.rb +5 -2
- data/regtest/formatter.rb +2 -2
- data/regtest/formatter.yml +192 -192
- data/regtest/parser.yml +105 -105
- data/regtest/processor.yml +265 -265
- data/scripref.gemspec +17 -31
- data/test/test_bookname.rb +4 -2
- data/test/test_english.rb +16 -14
- data/test/test_formatter.rb +54 -52
- data/test/test_german.rb +12 -10
- data/test/test_helper.rb +3 -1
- data/test/test_integration.rb +3 -1
- data/test/test_parser.rb +66 -64
- data/test/test_passage.rb +7 -18
- data/test/test_pipelining.rb +3 -1
- data/test/test_processor.rb +20 -18
- metadata +11 -12
- data/.aspell.pws +0 -22
data/scripref.gemspec
CHANGED
@@ -1,37 +1,23 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
# This file is automatically generated by rim.
|
5
|
-
# PLEASE DO NOT EDIT IT DIRECTLY!
|
6
|
-
# Change the values in Rim.setup in Rakefile instead.
|
1
|
+
# encoding: utf-8
|
2
|
+
require_relative 'lib/scripref'
|
7
3
|
|
8
4
|
Gem::Specification.new do |s|
|
9
|
-
s.name =
|
10
|
-
s.
|
5
|
+
s.name = 'scripref'
|
6
|
+
s.summary = 'Library for parsing scripture references in real texts.'
|
7
|
+
s.version = Scripref::VERSION
|
8
|
+
s.authors = 'Jan Friedrich'
|
9
|
+
s.email = 'janfri26@gmail.com'
|
11
10
|
|
12
|
-
s.
|
13
|
-
s.
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
s.email = "janfri26@gmail.com"
|
18
|
-
s.files = ["./.aspell.pws", "Changelog", "LICENSE", "README.md", "Rakefile", "lib/scripref", "lib/scripref.rb", "lib/scripref/basic_methods.rb", "lib/scripref/bookname.rb", "lib/scripref/const_reader.rb", "lib/scripref/english.rb", "lib/scripref/formatter.rb", "lib/scripref/german.rb", "lib/scripref/include.rb", "lib/scripref/parser.rb", "lib/scripref/passage.rb", "lib/scripref/pipelining.rb", "lib/scripref/processor.rb", "regtest/formatter.rb", "regtest/formatter.yml", "regtest/parser.rb", "regtest/parser.yml", "regtest/processor.rb", "regtest/processor.yml", "scripref.gemspec", "test/test_bookname.rb", "test/test_english.rb", "test/test_formatter.rb", "test/test_german.rb", "test/test_helper.rb", "test/test_integration.rb", "test/test_parser.rb", "test/test_passage.rb", "test/test_pipelining.rb", "test/test_processor.rb"]
|
19
|
-
s.homepage = "https://github.com/janfri/scripref"
|
20
|
-
s.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
|
21
|
-
s.rubygems_version = "3.1.2"
|
22
|
-
s.summary = "Library for parsing scripture references in real texts."
|
11
|
+
s.homepage = 'https://github.com/janfri/scripref'
|
12
|
+
s.metadata = {
|
13
|
+
'homepage_uri' => s.homepage,
|
14
|
+
'source_code_uri' => s.homepage
|
15
|
+
}
|
23
16
|
|
24
|
-
|
25
|
-
|
26
|
-
end
|
17
|
+
s.require_paths = 'lib'
|
18
|
+
s.files = %w[Changelog LICENSE README.md Rakefile scripref.gemspec] + Dir['lib/**/*'] + Dir['regtest/**/*'] + Dir['test/**.*']
|
27
19
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
s.add_development_dependency(%q<regtest>, ["~> 2"])
|
32
|
-
else
|
33
|
-
s.add_dependency(%q<rake>, [">= 0"])
|
34
|
-
s.add_dependency(%q<rim>, ["~> 2.17"])
|
35
|
-
s.add_dependency(%q<regtest>, ["~> 2"])
|
36
|
-
end
|
20
|
+
s.add_development_dependency('rake', '>= 0')
|
21
|
+
s.add_development_dependency('rim', '~> 3.0')
|
22
|
+
s.add_development_dependency('regtest', '~> 2')
|
37
23
|
end
|
data/test/test_bookname.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# encoding: utf-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
require 'test_helper'
|
3
5
|
|
4
6
|
class TestBookname < Test::Unit::TestCase
|
@@ -6,7 +8,7 @@ class TestBookname < Test::Unit::TestCase
|
|
6
8
|
include Scripref
|
7
9
|
|
8
10
|
def setup
|
9
|
-
@zef = Bookname.new(%w(Zefanja Zephanja), %w(Zef Zefan Zeph Zephan))
|
11
|
+
@zef = Bookname.new(osis_id: :Zeph, names: %w(Zefanja Zephanja), abbrevs: %w(Zef Zefan Zeph Zephan))
|
10
12
|
end
|
11
13
|
|
12
14
|
def test_name
|
data/test/test_english.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# encoding: utf-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
require 'test_helper'
|
3
5
|
|
4
6
|
class TestEnglish < Test::Unit::TestCase
|
@@ -30,21 +32,21 @@ class TestEnglish < Test::Unit::TestCase
|
|
30
32
|
assert_match book_re, 'Rev'
|
31
33
|
end
|
32
34
|
|
33
|
-
def
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
35
|
+
def test_book2osis_id
|
36
|
+
assert_osis_book_id :Gen, 'Genesis'
|
37
|
+
assert_osis_book_id :Matt, 'Matthew'
|
38
|
+
assert_osis_book_id :Rev, 'Revelation'
|
39
|
+
assert_osis_book_id :Gen, 'Gen'
|
40
|
+
assert_osis_book_id :Gen, 'Ge'
|
41
|
+
assert_osis_book_id :'2Tim', '2 Tim'
|
42
|
+
assert_osis_book_id :'2Tim', '2Tim'
|
43
|
+
assert_osis_book_id :'2Tim', '2Tm'
|
44
|
+
assert_osis_book_id :Matt, 'Mat'
|
45
|
+
assert_osis_book_id :Rev, 'Rev'
|
44
46
|
end
|
45
47
|
|
46
|
-
def
|
47
|
-
assert_equal
|
48
|
+
def assert_osis_book_id id, str
|
49
|
+
assert_equal id, @parser.parse(str).first.b1
|
48
50
|
end
|
49
51
|
|
50
52
|
end
|
data/test/test_formatter.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# encoding: utf-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
require 'test_helper'
|
3
5
|
|
4
6
|
class TestFormatter < Test::Unit::TestCase
|
@@ -13,105 +15,105 @@ class TestFormatter < Test::Unit::TestCase
|
|
13
15
|
|
14
16
|
def test_only_book
|
15
17
|
text = 'Ruth'
|
16
|
-
assert_formated_text_for_ast text, [pass(text: text, b1:
|
18
|
+
assert_formated_text_for_ast text, [pass(text: text, b1: :Ruth, b2: :Ruth)]
|
17
19
|
end
|
18
20
|
|
19
21
|
def test_book_and_chapter
|
20
22
|
text = 'Ruth 2'
|
21
|
-
assert_formated_text_for_ast text, [pass(text: text, b1:
|
23
|
+
assert_formated_text_for_ast text, [pass(text: text, b1: :Ruth, c1: 2, b2: :Ruth, c2: 2)]
|
22
24
|
end
|
23
25
|
|
24
26
|
def test_book_chapter_and_verse
|
25
27
|
text = 'Ruth 2,5'
|
26
|
-
assert_formated_text_for_ast text, [pass(text: text, b1:
|
28
|
+
assert_formated_text_for_ast text, [pass(text: text, b1: :Ruth, c1: 2, v1: 5, b2: :Ruth, c2: 2, v2: 5)]
|
27
29
|
end
|
28
30
|
|
29
31
|
def test_verse_range
|
30
32
|
text = 'Ruth 2,5-11'
|
31
|
-
assert_formated_text_for_ast text, [pass(text: text, b1:
|
33
|
+
assert_formated_text_for_ast text, [pass(text: text, b1: :Ruth, c1: 2, v1: 5, b2: :Ruth, c2: 2, v2: 11)]
|
32
34
|
end
|
33
35
|
|
34
36
|
def test_chapter_verse_range
|
35
37
|
text = 'Ruth 2,5-3,7'
|
36
|
-
assert_formated_text_for_ast text, [pass(text: text, b1:
|
38
|
+
assert_formated_text_for_ast text, [pass(text: text, b1: :Ruth, c1: 2, v1: 5, b2: :Ruth, c2: 3, v2: 7)]
|
37
39
|
end
|
38
40
|
|
39
41
|
def test_chapter_range
|
40
42
|
text = 'Ruth 2-3'
|
41
|
-
assert_formated_text_for_ast text, [pass(text: text, b1:
|
43
|
+
assert_formated_text_for_ast text, [pass(text: text, b1: :Ruth, c1: 2, b2: :Ruth, c2: 3)]
|
42
44
|
end
|
43
45
|
|
44
46
|
def test_book_range
|
45
47
|
text = '1. Mose-Offenbarung'
|
46
|
-
assert_formated_text_for_ast text, [pass(text: text, b1:
|
48
|
+
assert_formated_text_for_ast text, [pass(text: text, b1: :Gen, b2: :Rev)]
|
47
49
|
end
|
48
50
|
|
49
51
|
def test_book_chapter_range
|
50
52
|
text = '1. Mose 1-Offenbarung 22'
|
51
|
-
assert_formated_text_for_ast text, [pass(text: text, b1:
|
53
|
+
assert_formated_text_for_ast text, [pass(text: text, b1: :Gen, c1: 1, b2: :Rev, c2: 22)]
|
52
54
|
end
|
53
55
|
|
54
56
|
def test_book_chapter_verse_range
|
55
57
|
text = '1. Mose 1,1-Offenbarung 22,21'
|
56
|
-
assert_formated_text_for_ast text, [pass(text: text, b1:
|
58
|
+
assert_formated_text_for_ast text, [pass(text: text, b1: :Gen, c1: 1, v1: 1, b2: :Rev, c2: 22, v2: 21)]
|
57
59
|
end
|
58
60
|
|
59
61
|
def test_one_following_verse
|
60
62
|
text = 'Ruth 2,5f'
|
61
|
-
assert_formated_text_for_ast text, [pass(text: text, b1:
|
63
|
+
assert_formated_text_for_ast text, [pass(text: text, b1: :Ruth, c1: 2, v1: 5, b2: :Ruth, c2: 2, v2: :f)]
|
62
64
|
end
|
63
65
|
|
64
66
|
def test_more_following_verse
|
65
67
|
text = 'Ruth 2,5ff'
|
66
|
-
assert_formated_text_for_ast text, [pass(text: text, b1:
|
68
|
+
assert_formated_text_for_ast text, [pass(text: text, b1: :Ruth, c1: 2, v1: 5, b2: :Ruth, c2: 2, v2: :ff)]
|
67
69
|
end
|
68
70
|
|
69
71
|
def test_first_addon
|
70
72
|
text = 'Ruth 2,5a'
|
71
|
-
assert_formated_text_for_ast text, [pass(text: text, b1:
|
73
|
+
assert_formated_text_for_ast text, [pass(text: text, b1: :Ruth, c1: 2, v1: 5, b2: :Ruth, c2: 2, v2: 5, a1: :a)]
|
72
74
|
end
|
73
75
|
|
74
76
|
def test_second_addon
|
75
77
|
text = 'Ruth 2,5-7a'
|
76
|
-
assert_formated_text_for_ast text, [pass(text: text, b1:
|
78
|
+
assert_formated_text_for_ast text, [pass(text: text, b1: :Ruth, c1: 2, v1: 5, b2: :Ruth, c2: 2, v2: 7, a2: :a)]
|
77
79
|
end
|
78
80
|
|
79
81
|
def test_both_addons
|
80
82
|
text = 'Ruth 2,5b-7a'
|
81
|
-
assert_formated_text_for_ast text, [pass(text: text, b1:
|
83
|
+
assert_formated_text_for_ast text, [pass(text: text, b1: :Ruth, c1: 2, v1: 5, b2: :Ruth, c2: 2, v2: 7, a1: :b, a2: :a)]
|
82
84
|
end
|
83
85
|
|
84
86
|
def test_reset_addons
|
85
87
|
text = 'Ruth'
|
86
|
-
assert_formated_text_for_ast text, [pass(text: text, b1:
|
88
|
+
assert_formated_text_for_ast text, [pass(text: text, b1: :Ruth, b2: :Ruth)]
|
87
89
|
end
|
88
90
|
|
89
91
|
def test_book_with_only_one_chapter
|
90
92
|
text = 'Obadja 3'
|
91
|
-
assert_formated_text_for_ast text, [pass(text: text, b1:
|
93
|
+
assert_formated_text_for_ast text, [pass(text: text, b1: :Obad, c1: 1, v1: 3, b2: :Obad, c2: 1, v2: 3)]
|
92
94
|
text = 'Obadja 1'
|
93
|
-
assert_formated_text_for_ast text, [pass(text: text, b1:
|
95
|
+
assert_formated_text_for_ast text, [pass(text: text, b1: :Obad, c1: 1, v1: 1, b2: :Obad, c2: 1, v2: 1)]
|
94
96
|
end
|
95
97
|
|
96
98
|
def test_book_with_only_one_chapter_range
|
97
99
|
text = 'Obadja 3-5'
|
98
|
-
assert_formated_text_for_ast text, [pass(text: text, b1:
|
100
|
+
assert_formated_text_for_ast text, [pass(text: text, b1: :Obad, c1: 1, v1: 3, b2: :Obad, c2: 1, v2: 5)]
|
99
101
|
text = 'Obadja 1-4'
|
100
|
-
assert_formated_text_for_ast text, [pass(text: text, b1:
|
102
|
+
assert_formated_text_for_ast text, [pass(text: text, b1: :Obad, c1: 1, v1: 1, b2: :Obad, c2: 1, v2: 4)]
|
101
103
|
end
|
102
104
|
|
103
105
|
def test_book_with_only_one_chapter_at_begin_of_range
|
104
106
|
text = 'Obadja-Jona'
|
105
|
-
assert_formated_text_for_ast text, [pass(text: text, b1:
|
107
|
+
assert_formated_text_for_ast text, [pass(text: text, b1: :Obad, c1: 1, b2: :Jonah)]
|
106
108
|
text = 'Obadja 3-Jona 2,4'
|
107
|
-
assert_formated_text_for_ast text, [pass(text: text, b1:
|
109
|
+
assert_formated_text_for_ast text, [pass(text: text, b1: :Obad, c1: 1, v1: 3, b2: :Jonah, c2: 2, v2: 4)]
|
108
110
|
end
|
109
111
|
|
110
112
|
def test_book_with_only_one_chapter_at_end_of_range
|
111
113
|
text = 'Amos 2,4-Obadja 3'
|
112
|
-
assert_formated_text_for_ast text, [pass(text: text, b1:
|
114
|
+
assert_formated_text_for_ast text, [pass(text: text, b1: :Amos, c1: 2, v1: 4, b2: :Obad, c2: 1, v2: 3)]
|
113
115
|
text = 'Amos 2,4-Obadja 1'
|
114
|
-
assert_formated_text_for_ast text, [pass(text: text, b1:
|
116
|
+
assert_formated_text_for_ast text, [pass(text: text, b1: :Amos, c1: 2, v1: 4, b2: :Obad, c2: 1, v2: 1)]
|
115
117
|
end
|
116
118
|
|
117
119
|
######################################################################
|
@@ -121,49 +123,49 @@ class TestFormatter < Test::Unit::TestCase
|
|
121
123
|
def test_two_books
|
122
124
|
text = 'Ruth; Markus'
|
123
125
|
t1, t2 = text.split(semi)
|
124
|
-
assert_formated_text_for_ast text, [pass(text: t1, b1:
|
126
|
+
assert_formated_text_for_ast text, [pass(text: t1, b1: :Ruth, b2: :Ruth), semi, pass(text: t2, b1: :Mark, b2: :Mark)]
|
125
127
|
end
|
126
128
|
|
127
129
|
def test_two_complete_refs
|
128
130
|
text = 'Ruth 2,1; Markus 4,8'
|
129
131
|
t1, t2 = text.split(semi)
|
130
|
-
assert_formated_text_for_ast text, [pass(text: t1, b1:
|
132
|
+
assert_formated_text_for_ast text, [pass(text: t1, b1: :Ruth, c1: 2, v1: 1, b2: :Ruth, c2: 2, v2: 1), semi, pass(text: t2, b1: :Mark, c1: 4, v1: 8, b2: :Mark, c2: 4, v2: 8)]
|
131
133
|
end
|
132
134
|
|
133
135
|
def test_two_refs_same_book
|
134
136
|
text = 'Ruth 2,1; 5,4'
|
135
137
|
t1, t2 = text.split(semi)
|
136
|
-
assert_formated_text_for_ast text, [pass(text: t1, b1:
|
138
|
+
assert_formated_text_for_ast text, [pass(text: t1, b1: :Ruth, c1: 2, v1: 1, b2: :Ruth, c2: 2, v2: 1), semi, pass(text: t2, b1: :Ruth, c1: 5, v1: 4, b2: :Ruth, c2: 5, v2: 4)]
|
137
139
|
end
|
138
140
|
|
139
141
|
def test_two_chapters_same_book
|
140
142
|
text = 'Ruth 2; 5'
|
141
143
|
t1, t2 = text.split(semi)
|
142
|
-
assert_formated_text_for_ast text, [pass(text: t1, b1:
|
144
|
+
assert_formated_text_for_ast text, [pass(text: t1, b1: :Ruth, c1: 2, b2: :Ruth, c2: 2), semi, pass(text: t2, b1: :Ruth, c1: 5, b2: :Ruth, c2: 5)]
|
143
145
|
end
|
144
146
|
|
145
147
|
def test_two_chapters_different_book
|
146
148
|
text = 'Ruth 2; Markus 4'
|
147
149
|
t1, t2 = text.split(semi)
|
148
|
-
assert_formated_text_for_ast text, [pass(text: t1, b1:
|
150
|
+
assert_formated_text_for_ast text, [pass(text: t1, b1: :Ruth, c1: 2, b2: :Ruth, c2: 2), semi, pass(text: t2, b1: :Mark, c1: 4, b2: :Mark, c2: 4)]
|
149
151
|
end
|
150
152
|
|
151
153
|
def test_two_verses
|
152
154
|
text = 'Ruth 2,5.11'
|
153
155
|
t1, t2 = text.split(dot)
|
154
|
-
assert_formated_text_for_ast text, [pass(text: t1, b1:
|
156
|
+
assert_formated_text_for_ast text, [pass(text: t1, b1: :Ruth, c1: 2, v1: 5, b2: :Ruth, c2: 2, v2: 5), dot, pass(text: t2, b1: :Ruth, c1: 2, v1: 11, b2: :Ruth, c2: 2, v2: 11)]
|
155
157
|
end
|
156
158
|
|
157
159
|
def test_partial_passage_after_full_passage
|
158
160
|
text = 'Ruth 2,5; 4'
|
159
161
|
t1, t2 = text.split(semi)
|
160
|
-
assert_formated_text_for_ast text, [pass(text: t1, b1:
|
162
|
+
assert_formated_text_for_ast text, [pass(text: t1, b1: :Ruth, c1: 2, v1: 5, b2: :Ruth, c2: 2, v2: 5), semi, pass(text: t2, b1: :Ruth, c1: 4, b2: :Ruth, c2: 4)]
|
161
163
|
text = 'Ruth 2,5; Markus'
|
162
164
|
t1, t2 = text.split(semi)
|
163
|
-
assert_formated_text_for_ast text, [pass(text: t1, b1:
|
165
|
+
assert_formated_text_for_ast text, [pass(text: t1, b1: :Ruth, c1: 2, v1: 5, b2: :Ruth, c2: 2, v2: 5), semi, pass(text: t2, b1: :Mark, b2: :Mark)]
|
164
166
|
text = 'Ruth 2,5; Markus 4'
|
165
167
|
t1, t2 = text.split(semi)
|
166
|
-
assert_formated_text_for_ast text, [pass(text: t1, b1:
|
168
|
+
assert_formated_text_for_ast text, [pass(text: t1, b1: :Ruth, c1: 2, v1: 5, b2: :Ruth, c2: 2, v2: 5), semi, pass(text: t2, b1: :Mark, c1: 4, b2: :Mark, c2: 4)]
|
167
169
|
end
|
168
170
|
|
169
171
|
######################################################################
|
@@ -173,61 +175,61 @@ class TestFormatter < Test::Unit::TestCase
|
|
173
175
|
def test_verse_range_and_separated_verse
|
174
176
|
text = 'Ruth 2,1-3.11'
|
175
177
|
t1, t2 = text.split(dot)
|
176
|
-
assert_formated_text_for_ast text, [pass(text: t1, b1:
|
178
|
+
assert_formated_text_for_ast text, [pass(text: t1, b1: :Ruth, c1: 2, v1: 1, b2: :Ruth, c2: 2, v2: 3), dot, pass(text: t2, b1: :Ruth, c1: 2, v1: 11, b2: :Ruth, c2: 2, v2: 11)]
|
177
179
|
end
|
178
180
|
|
179
181
|
def test_separate_verse_and_verse_range
|
180
182
|
text = 'Ruth 2,1.3-11'
|
181
183
|
t1, t2 = text.split(dot)
|
182
|
-
assert_formated_text_for_ast text, [pass(text: t1, b1:
|
184
|
+
assert_formated_text_for_ast text, [pass(text: t1, b1: :Ruth, c1: 2, v1: 1, b2: :Ruth, c2: 2, v2: 1), dot, pass(text: t2, b1: :Ruth, c1: 2, v1: 3, b2: :Ruth, c2: 2, v2: 11)]
|
183
185
|
end
|
184
186
|
|
185
187
|
def test_two_verse_ranges
|
186
188
|
text = 'Ruth 2,1-3.7-11'
|
187
189
|
t1, t2 = text.split(dot)
|
188
|
-
assert_formated_text_for_ast text, [pass(text: t1, b1:
|
190
|
+
assert_formated_text_for_ast text, [pass(text: t1, b1: :Ruth, c1: 2, v1: 1, b2: :Ruth, c2: 2, v2: 3), dot, pass(text: t2, b1: :Ruth, c1: 2, v1: 7, b2: :Ruth, c2: 2, v2: 11)]
|
189
191
|
end
|
190
192
|
|
191
193
|
def test_two_verse_range_different_books
|
192
194
|
text = 'Ruth 2,1-11; Markus 4,3-7'
|
193
195
|
t1, t2 = text.split(semi)
|
194
|
-
assert_formated_text_for_ast text, [pass(text: t1, b1:
|
196
|
+
assert_formated_text_for_ast text, [pass(text: t1, b1: :Ruth, c1: 2, v1: 1, b2: :Ruth, c2: 2, v2: 11), semi, pass(text: t2, b1: :Mark, c1: 4, v1: 3, b2: :Mark, c2: 4, v2: 7)]
|
195
197
|
end
|
196
198
|
|
197
199
|
def test_two_verse_range_different_chapters
|
198
200
|
text = 'Ruth 2,1-11; 3,10-19'
|
199
201
|
t1, t2 = text.split(semi)
|
200
|
-
assert_formated_text_for_ast text, [pass(text: t1, b1:
|
202
|
+
assert_formated_text_for_ast text, [pass(text: t1, b1: :Ruth, c1: 2, v1: 1, b2: :Ruth, c2: 2, v2: 11), semi, pass(text: t2, b1: :Ruth, c1: 3, v1: 10, b2: :Ruth, c2: 3, v2: 19)]
|
201
203
|
end
|
202
204
|
|
203
205
|
def test_book_range_and_following_book
|
204
206
|
text = 'Ruth-Markus; Johannes'
|
205
207
|
t1, t2 = text.split(semi)
|
206
|
-
assert_formated_text_for_ast text, [pass(text: t1, b1:
|
208
|
+
assert_formated_text_for_ast text, [pass(text: t1, b1: :Ruth, b2: :Mark), semi, pass(text: t2, b1: :John, b2: :John)]
|
207
209
|
end
|
208
210
|
|
209
211
|
def test_chapter_range_and_following_book
|
210
212
|
text = 'Ruth 1-2; Johannes 4'
|
211
213
|
t1, t2 = text.split(semi)
|
212
|
-
assert_formated_text_for_ast text, [pass(text: t1, b1:
|
214
|
+
assert_formated_text_for_ast text, [pass(text: t1, b1: :Ruth, c1: 1, b2: :Ruth, c2: 2), semi, pass(text: t2, b1: :John, c1: 4, b2: :John, c2: 4)]
|
213
215
|
end
|
214
216
|
|
215
217
|
def test_chapter_range_and_following_chapter
|
216
218
|
text = 'Ruth 1-2; 4'
|
217
219
|
t1, t2 = text.split(semi)
|
218
|
-
assert_formated_text_for_ast text, [pass(text: t1, b1:
|
220
|
+
assert_formated_text_for_ast text, [pass(text: t1, b1: :Ruth, c1: 1, b2: :Ruth, c2: 2), semi, pass(text: t2, b1: :Ruth, c1: 4, b2: :Ruth, c2: 4)]
|
219
221
|
end
|
220
222
|
|
221
223
|
def test_book_only_after_full_passage
|
222
224
|
text = 'Matthäus 3,4; Markus; Johannes 3,16'
|
223
225
|
t1, t2, t3 = text.split(semi)
|
224
|
-
assert_formated_text_for_ast text, [pass(text: t1, b1:
|
226
|
+
assert_formated_text_for_ast text, [pass(text: t1, b1: :Matt, c1: 3, v1: 4, b2: :Matt, c2: 3, v2: 4), semi, pass(text: t2, b1: :Mark, b2: :Mark), semi, pass(text: t3, b1: :John, c1: 3, v1: 16, b2: :John, c2: 3, v2: 16)]
|
225
227
|
end
|
226
228
|
|
227
229
|
def test_chapter_only_after_full_passage
|
228
230
|
text = 'Matthäus 3,4; 8; Johannes 3,16'
|
229
231
|
t1, t2, t3 = text.split(semi)
|
230
|
-
assert_formated_text_for_ast text, [pass(text: t1, b1:
|
232
|
+
assert_formated_text_for_ast text, [pass(text: t1, b1: :Matt, c1: 3, v1: 4, b2: :Matt, c2: 3, v2: 4), semi, pass(text: t2, b1: :Matt, c1: 8, b2: :Matt, c2: 8), semi, pass(text: t3, b1: :John, c1: 3, v1: 16, b2: :John, c2: 3, v2: 16)]
|
231
233
|
end
|
232
234
|
|
233
235
|
######################################################################
|
@@ -238,13 +240,13 @@ class TestFormatter < Test::Unit::TestCase
|
|
238
240
|
text = 'Ruth 2,1-11.15; 3,7.9-12; Markus 4; 5,3.18-21'
|
239
241
|
t1, t2, t3, t4, t5, t6, t7 = text.split(/; |\./)
|
240
242
|
ast = [
|
241
|
-
pass(text: t1, b1:
|
242
|
-
pass(text: t2, b1:
|
243
|
-
pass(text: t3, b1:
|
244
|
-
pass(text: t4, b1:
|
245
|
-
pass(text: t5, b1:
|
246
|
-
pass(text: t6, b1:
|
247
|
-
pass(text: t7, b1:
|
243
|
+
pass(text: t1, b1: :Ruth, c1: 2, v1: 1, b2: :Ruth, c2: 2, v2: 11), dot,
|
244
|
+
pass(text: t2, b1: :Ruth, c1: 2, v1: 15, b2: :Ruth, c2: 2, v2: 15), semi,
|
245
|
+
pass(text: t3, b1: :Ruth, c1: 3, v1: 7, b2: :Ruth, c2: 3, v2: 7), dot,
|
246
|
+
pass(text: t4, b1: :Ruth, c1: 3, v1: 9, b2: :Ruth, c2: 3, v2: 12), semi,
|
247
|
+
pass(text: t5, b1: :Mark, c1: 4, b2: :Mark, c2: 4), semi,
|
248
|
+
pass(text: t6, b1: :Mark, c1: 5, v1: 3, b2: :Mark, c2: 5, v2: 3), dot,
|
249
|
+
pass(text: t7, b1: :Mark, c1: 5, v1: 18, b2: :Mark, c2: 5, v2: 21)
|
248
250
|
]
|
249
251
|
assert_formated_text_for_ast text, ast
|
250
252
|
end
|
@@ -257,13 +259,13 @@ class TestFormatter < Test::Unit::TestCase
|
|
257
259
|
@german_formatter.bookformat = :abbrev
|
258
260
|
text = 'Mat 3,4; Mar; Joh 3,16'
|
259
261
|
t1, t2, t3 = text.split(semi)
|
260
|
-
assert_formated_text_for_ast text, [pass(text: t1, b1:
|
262
|
+
assert_formated_text_for_ast text, [pass(text: t1, b1: :Matt, c1: 3, v1: 4, b2: :Matt, c2: 3, v2: 4), semi, pass(text: t2, b1: :Mark, b2: :Mark), semi, pass(text: t3, b1: :John, c1: 3, v1: 16, b2: :John, c2: 3, v2: 16)]
|
261
263
|
end
|
262
264
|
|
263
265
|
def test_exception_for_unhandled_bookformat
|
264
266
|
assert_raise NoMethodError do
|
265
267
|
@german_formatter.bookformat = :unknown
|
266
|
-
@german_formatter.format [pass(text: 1, b1:
|
268
|
+
@german_formatter.format [pass(text: 1, b1: :Exod, c1: 3, v1: 4, b2: :Deut, c2: 6, v2: 7)]
|
267
269
|
end
|
268
270
|
end
|
269
271
|
private
|
data/test/test_german.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# encoding: utf-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
require 'test_helper'
|
3
5
|
|
4
6
|
class TestGerman < Test::Unit::TestCase
|
@@ -31,15 +33,15 @@ class TestGerman < Test::Unit::TestCase
|
|
31
33
|
end
|
32
34
|
|
33
35
|
def test_book2num
|
34
|
-
assert_book_num
|
35
|
-
assert_book_num
|
36
|
-
assert_book_num
|
37
|
-
assert_book_num
|
38
|
-
assert_book_num
|
39
|
-
assert_book_num
|
40
|
-
assert_book_num
|
41
|
-
assert_book_num
|
42
|
-
assert_book_num
|
36
|
+
assert_book_num :Gen, '1. Mose'
|
37
|
+
assert_book_num :Matt, 'Matthäus'
|
38
|
+
assert_book_num :Rev, 'Offenbarung'
|
39
|
+
assert_book_num :Gen, '1. Mo'
|
40
|
+
assert_book_num :Gen, '1.Mo'
|
41
|
+
assert_book_num :Gen, '1M'
|
42
|
+
assert_book_num :Matt, 'Mat'
|
43
|
+
assert_book_num :Phil, 'Phil'
|
44
|
+
assert_book_num :Rev, 'Off'
|
43
45
|
end
|
44
46
|
|
45
47
|
def assert_book_num num, str
|
data/test/test_helper.rb
CHANGED