scripref 0.15.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/test/test_passage.rb CHANGED
@@ -1,5 +1,6 @@
1
- # - encoding: utf-8 -
1
+ # encoding: utf-8
2
2
  require 'test_helper'
3
+ # frozen_string_literal: true
3
4
 
4
5
  class TestPassage < Test::Unit::TestCase
5
6
 
@@ -12,7 +13,7 @@ class TestPassage < Test::Unit::TestCase
12
13
 
13
14
  def test_to_a
14
15
  pass = @parser.parse('Mr 1,2-Luk 3,4').first
15
- assert_equal [41, 1, 2, 42, 3, 4], pass.to_a
16
+ assert_equal [:Mark, 1, 2, :Luke, 3, 4], pass.to_a
16
17
  end
17
18
 
18
19
  def test_spaceship_operator
@@ -66,25 +67,13 @@ class TestPassage < Test::Unit::TestCase
66
67
  end
67
68
 
68
69
  def test_start
69
- p = pass(text: '', b1: 1, c1: 2, v1: 3, b2: 4, c2: 5, v2: 6)
70
- assert_equal [1, 2, 3], p.start
70
+ p = pass(text: '', b1: :Gen, c1: 2, v1: 3, b2: :Num, c2: 5, v2: 6)
71
+ assert_equal [:Gen, 2, 3], p.start
71
72
  end
72
73
 
73
74
  def test_end
74
- p = pass(text: '', b1: 1, c1: 2, v1: 3, b2: 4, c2: 5, v2: 6)
75
- assert_equal [4, 5, 6], p.end
76
- end
77
-
78
- def test_sum
79
- p1 = pass(text: '', b1: 1, c1: 2, v1: 3, b2: 4, c2: 5, v2: 6)
80
- p2 = pass(text: '', b1: 1, c1: 1, v1: 1, b2: 1, c2: 1, v2: 1)
81
- assert_equal [2, 3, 4, 5, 6, 7], p1 + p2
82
- end
83
-
84
- def test_differenz
85
- p1 = pass(text: '', b1: 1, c1: 2, v1: 3, b2: 4, c2: 5, v2: 6)
86
- p2 = pass(text: '', b1: 1, c1: 1, v1: 1, b2: 1, c2: 1, v2: 1)
87
- assert_equal [0, 1, 2, 3, 4, 5], p2 - p1
75
+ p = pass(text: '', b1: :Gen, c1: 2, v1: 3, b2: :Num, c2: 5, v2: 6)
76
+ assert_equal [:Num, 5, 6], p.end
88
77
  end
89
78
 
90
79
  protected
@@ -1,4 +1,6 @@
1
- # - encoding: utf-8 -
1
+ # encoding: utf-8
2
+ # frozen_string_literal: true
3
+
2
4
  require 'test_helper'
3
5
 
4
6
  class TestPipelining < Test::Unit::TestCase
@@ -1,4 +1,6 @@
1
- # - encoding: utf-8 -
1
+ # encoding: utf-8
2
+ # frozen_string_literal: true
3
+
2
4
  require 'test_helper'
3
5
 
4
6
  class TestProcessorIterators < Test::Unit::TestCase
@@ -8,8 +10,8 @@ class TestProcessorIterators < Test::Unit::TestCase
8
10
 
9
11
  def setup
10
12
  @text = 'Some text Mt 1,1 and Mr 2 and so on ...'
11
- @mt = [pass(text: 'Mt 1,1 ', b1: 40, c1: 1, v1: 1, b2: 40, c2: 1, v2: 1)]
12
- @mr = [pass(text: 'Mr 2 ', b1: 41, c1: 2, b2: 41, c2: 2)]
13
+ @mt = [pass(text: 'Mt 1,1 ', b1: :Matt, c1: 1, v1: 1, b2: :Matt, c2: 1, v2: 1)]
14
+ @mr = [pass(text: 'Mr 2 ', b1: :Mark, c1: 2, b2: :Mark, c2: 2)]
13
15
  @processor = Processor.new(@text, German)
14
16
  @chunks = ['Some text ', @mt, 'and ', @mr, 'and so on ...']
15
17
  end
@@ -49,7 +51,7 @@ class TestProcessorVariousContexts < Test::Unit::TestCase
49
51
 
50
52
  def test_reference_without_other_text
51
53
  text = 'Mt 1,1'
52
- ast = [[pass(text: 'Mt 1,1 ', b1: 40, c1: 1, v1: 1, b2: 40, c2: 1, v2: 1)]]
54
+ ast = [[pass(text: 'Mt 1,1 ', b1: :Matt, c1: 1, v1: 1, b2: :Matt, c2: 1, v2: 1)]]
53
55
  processor = Processor.new(text, German)
54
56
  assert_equal ast, processor.each_ref.to_a
55
57
  assert_equal ast, processor.each.to_a
@@ -72,46 +74,46 @@ class TestProcessorVariousContexts < Test::Unit::TestCase
72
74
  def test_numerical_context
73
75
  text = '1. Mt 1,1'
74
76
  processor = Processor.new(text, German)
75
- ast = [[pass(text: text, b1: 40, c1: 1, v1: 1, b2: 40, c2: 1, v2: 1)]]
77
+ ast = [[pass(text: text, b1: :Matt, c1: 1, v1: 1, b2: :Matt, c2: 1, v2: 1)]]
76
78
  assert_equal ast, processor.each_ref.to_a
77
- ast = ['1. ', [pass(text: text, b1: 40, c1: 1, v1: 1, b2: 40, c2: 1, v2: 1)]]
79
+ ast = ['1. ', [pass(text: text, b1: :Matt, c1: 1, v1: 1, b2: :Matt, c2: 1, v2: 1)]]
78
80
  assert_equal ast, processor.each.to_a
79
81
  end
80
82
 
81
83
  def test_verse_addon_or_postfix
82
84
  text = 'Mt 1,1a'
83
85
  processor = Processor.new(text, German)
84
- ast = [[pass(text: text, b1: 40, c1: 1, v1: 1, b2: 40, c2: 1, v2: 1, a1: 'a')]]
86
+ ast = [[pass(text: text, b1: :Matt, c1: 1, v1: 1, b2: :Matt, c2: 1, v2: 1, a1: 'a')]]
85
87
  assert_equal ast, processor.each.to_a
86
88
  text = 'Mt 1,1f'
87
89
  processor = Processor.new(text, German)
88
- ast = [[pass(text: text, b1: 40, c1: 1, v1: 1, b2: 40, c2: 1, v2: :f)]]
90
+ ast = [[pass(text: text, b1: :Matt, c1: 1, v1: 1, b2: :Matt, c2: 1, v2: :f)]]
89
91
  assert_equal ast, processor.each.to_a
90
92
  text = 'Mt 1,1ff'
91
93
  processor = Processor.new(text, German)
92
- ast = [[pass(text: text, b1: 40, c1: 1, v1: 1, b2: 40, c2: 1, v2: :ff)]]
94
+ ast = [[pass(text: text, b1: :Matt, c1: 1, v1: 1, b2: :Matt, c2: 1, v2: :ff)]]
93
95
  assert_equal ast, processor.each.to_a
94
96
  end
95
97
 
96
98
  def test_verse_addon_or_postfix_for_books_with_only_one_chapter
97
99
  text = '2. Joh 5b'
98
100
  processor = Processor.new(text, German)
99
- ast = [[pass(text: text, b1: 63, c1: 1, v1: 5, b2: 63, c2: 1, v2: 5, a1: 'b')]]
101
+ ast = [[pass(text: text, b1: :'2John', c1: 1, v1: 5, b2: :'2John', c2: 1, v2: 5, a1: 'b')]]
100
102
  assert_equal ast, processor.each.to_a
101
103
  text = '2. Joh 5f'
102
104
  processor = Processor.new(text, German)
103
- ast = [[pass(text: text, b1: 63, c1: 1, v1: 5, b2: 63, c2: 1, v2: :f)]]
105
+ ast = [[pass(text: text, b1: :'2John', c1: 1, v1: 5, b2: :'2John', c2: 1, v2: :f)]]
104
106
  assert_equal ast, processor.each.to_a
105
107
  text = '2. Joh 5ff'
106
108
  processor = Processor.new(text, German)
107
- ast = [[pass(text: text, b1: 63, c1: 1, v1: 5, b2: 63, c2: 1, v2: :ff)]]
109
+ ast = [[pass(text: text, b1: :'2John', c1: 1, v1: 5, b2: :'2John', c2: 1, v2: :ff)]]
108
110
  assert_equal ast, processor.each.to_a
109
111
  end
110
112
 
111
113
  def test_verse_sep
112
114
  text = '2. Joh 5.8'
113
115
  processor = Processor.new(text, German)
114
- ast = [[pass(text: text, b1: 63, c1: 1, v1: 5, b2: 63, c2: 1, v2: 5), '.', pass(text: text, b1: 63, c1: 1, v1: 8, b2: 63, c2: 1, v2: 8)]]
116
+ ast = [[pass(text: text, b1: :'2John', c1: 1, v1: 5, b2: :'2John', c2: 1, v2: 5), '.', pass(text: text, b1: :'2John', c1: 1, v1: 8, b2: :'2John', c2: 1, v2: 8)]]
115
117
  assert_equal ast, processor.each.to_a
116
118
  end
117
119
 
@@ -121,9 +123,9 @@ class TestProcessorVariousContexts < Test::Unit::TestCase
121
123
  postfix = 'nachzulesen ...'
122
124
  text = prefix + ref + postfix
123
125
  processor = Processor.new(text, German)
124
- ast = [pass(text: 'Apg 2,3', b1: 44, c1: 2, v1: 3, b2: 44, c2: 2, v2: 3), '; ', pass(text: '4,8', b1: 44, c1: 4, v1: 8, b2: 44, c2: 4, v2: 8), '; ',
125
- pass(text: '7,55', b1: 44, c1: 7, v1: 55, b2: 44, c2: 7, v2: 55), '; ', pass(text: '8,29-39', b1: 44, c1: 8, v1: 29, b2: 44, c2: 8, v2: 39), '; ',
126
- pass(text: 'Röm 8,2-9', b1: 45, c1: 8, v1: 2, b2: 45, c2: 8, v2: 9), '; ', pass(text: 'Gal 6,8 ', b1: 48, c1: 6, v1: 8, b2: 48, c2: 6, v2: 8)]
126
+ ast = [pass(text: 'Apg 2,3', b1: :Acts, c1: 2, v1: 3, b2: :Acts, c2: 2, v2: 3), '; ', pass(text: '4,8', b1: :Acts, c1: 4, v1: 8, b2: :Acts, c2: 4, v2: 8), '; ',
127
+ pass(text: '7,55', b1: :Acts, c1: 7, v1: 55, b2: :Acts, c2: 7, v2: 55), '; ', pass(text: '8,29-39', b1: :Acts, c1: 8, v1: 29, b2: :Acts, c2: 8, v2: 39), '; ',
128
+ pass(text: 'Röm 8,2-9', b1: :Rom, c1: 8, v1: 2, b2: :Rom, c2: 8, v2: 9), '; ', pass(text: 'Gal 6,8 ', b1: :Gal, c1: 6, v1: 8, b2: :Gal, c2: 6, v2: 8)]
127
129
  assert_equal [ast], processor.each_ref.to_a
128
130
  assert_equal [prefix, ast, postfix], processor.each.to_a
129
131
  end
@@ -131,12 +133,12 @@ class TestProcessorVariousContexts < Test::Unit::TestCase
131
133
  def test_reference_ends_with_chapter_or_verse
132
134
  text = 'Joh 8.'
133
135
  processor = Processor.new(text, German)
134
- ast = [pass(text: 'Joh 8', b1: 43, c1: 8, b2: 43, c2: 8)]
136
+ ast = [pass(text: 'Joh 8', b1: :John, c1: 8, b2: :John, c2: 8)]
135
137
  assert_equal [ast], processor.each_ref.to_a
136
138
  assert_equal [ast, '.'], processor.each.to_a
137
139
  text = 'Joh 8,12.'
138
140
  processor = Processor.new(text, German)
139
- ast = [pass(text: 'Joh 8,12', b1: 43, c1: 8, v1: 12, b2: 43, c2: 8, v2: 12)]
141
+ ast = [pass(text: 'Joh 8,12', b1: :John, c1: 8, v1: 12, b2: :John, c2: 8, v2: 12)]
140
142
  assert_equal [ast], processor.each_ref.to_a
141
143
  assert_equal [ast, '.'], processor.each.to_a
142
144
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scripref
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Friedrich
@@ -66,6 +66,7 @@ files:
66
66
  - lib/scripref.rb
67
67
  - lib/scripref/basic_methods.rb
68
68
  - lib/scripref/bookname.rb
69
+ - lib/scripref/bookorder.rb
69
70
  - lib/scripref/const_reader.rb
70
71
  - lib/scripref/english.rb
71
72
  - lib/scripref/formatter.rb