rutils 0.2.5 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +9 -0
- data/Manifest.txt +22 -15
- data/README.txt +54 -41
- data/Rakefile.rb +9 -26
- data/TODO.txt +2 -3
- data/WHAT_HAS_CHANGED.txt +44 -0
- data/init.rb +20 -2
- data/lib/countries/countries.rb +1 -0
- data/lib/datetime/datetime.rb +1 -0
- data/lib/gilenson/bluecloth_extra.rb +7 -0
- data/lib/gilenson/gilenson.rb +39 -30
- data/lib/gilenson/helper.rb +34 -0
- data/lib/gilenson/maruku_extra.rb +19 -0
- data/lib/gilenson/rdiscount_extra.rb +7 -0
- data/lib/gilenson/redcloth_extra.rb +42 -0
- data/lib/integration/integration.rb +1 -11
- data/lib/integration/rails_date_helper_override.rb +103 -105
- data/lib/integration/rails_pre_filter.rb +1 -0
- data/lib/pluralizer/pluralizer.rb +14 -13
- data/lib/rutils.rb +15 -25
- data/lib/transliteration/bidi.rb +15 -72
- data/lib/transliteration/simple.rb +1 -0
- data/lib/transliteration/transliteration.rb +11 -9
- data/lib/version.rb +5 -0
- data/test/extras/integration_bluecloth.rb +13 -0
- data/test/extras/integration_maruku.rb +15 -0
- data/test/{test_rails_filter.rb → extras/integration_rails_filter.rb} +3 -1
- data/test/extras/integration_rails_gilenson_helpers.rb +80 -0
- data/test/{test_rails_helpers.rb → extras/integration_rails_helpers.rb} +15 -3
- data/test/extras/integration_rdiscount.rb +15 -0
- data/test/extras/integration_redcloth3.rb +18 -0
- data/test/extras/integration_redcloth4.rb +19 -0
- data/test/run_tests.rb +2 -2
- data/test/{t_datetime.rb → test_datetime.rb} +1 -2
- data/test/{t_gilenson.rb → test_gilenson.rb} +15 -6
- data/test/test_integration.rb +22 -0
- data/test/test_integration_flag.rb +18 -0
- data/test/{t_pluralize.rb → test_pluralize.rb} +3 -2
- data/test/{t_rutils_base.rb → test_rutils_base.rb} +1 -0
- data/test/test_transliteration.rb +53 -0
- metadata +35 -26
- data/lib/integration/blue_cloth_override.rb +0 -12
- data/lib/integration/red_cloth_four.rb +0 -24
- data/lib/integration/red_cloth_override.rb +0 -7
- data/lib/integration/red_cloth_three.rb +0 -25
- data/test/t_integration.rb +0 -46
- data/test/t_transliteration.rb +0 -109
- data/test/test_integration_bluecloth.rb +0 -17
- data/test/test_integration_redcloth3.rb +0 -31
- data/test/test_integration_redcloth4.rb +0 -31
data/lib/transliteration/bidi.rb
CHANGED
@@ -1,78 +1,21 @@
|
|
1
|
-
#
|
2
|
-
#
|
3
|
-
# любым другим алфавитом на земле кроме русского и латинского. К примеру можете таких пользователей лично истребить.
|
4
|
-
#
|
5
|
-
# Перед тем как использовать этот модуль подумайте - скорее всего вы строите приложение в котором Юникод использован
|
6
|
-
# неправильно или не полностью. Честно.
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
# ++DEPRECATED++ Этот модуль удален и присутствует только для выдачи сообщения об ошибке.
|
7
3
|
module RuTils::Transliteration::BiDi
|
8
|
-
|
9
|
-
"А"=>"A","Б"=>"B","В"=>"V","Г"=>"G","Д"=>"D",
|
10
|
-
"Е"=>"E","Ё"=>"JO","Ж"=>"ZH","З"=>"Z","И"=>"I",
|
11
|
-
"Й"=>"JJ","К"=>"K","Л"=>"L","М"=>"M","Н"=>"N",
|
12
|
-
"О"=>"O","П"=>"P","Р"=>"R","С"=>"S","Т"=>"T",
|
13
|
-
"У"=>"U","Ф"=>"F","Х"=>"KH","Ц"=>"C","Ч"=>"CH",
|
14
|
-
"Ш"=>"SH","Щ"=>"SHH","Ъ"=>"_~","Ы"=>"Y","Ь"=>"_'",
|
15
|
-
"Э"=>"EH","Ю"=>"JU","Я"=>"JA","а"=>"a","б"=>"b",
|
16
|
-
"в"=>"v","г"=>"g","д"=>"d","е"=>"e","ё"=>"jo",
|
17
|
-
"ж"=>"zh","з"=>"z","и"=>"i","й"=>"jj","к"=>"k",
|
18
|
-
"л"=>"l","м"=>"m","н"=>"n","о"=>"o","п"=>"p",
|
19
|
-
"р"=>"r","с"=>"s","т"=>"t","у"=>"u","ф"=>"f",
|
20
|
-
"х"=>"kh","ц"=>"c","ч"=>"ch","ш"=>"sh","щ"=>"shh",
|
21
|
-
"ъ"=>"~","ы"=>"y","ь"=>"'","э"=>"eh","ю"=>"ju",
|
22
|
-
"я"=>"ja",
|
23
|
-
# " "=>"__","_"=>"__"
|
24
|
-
# так сразу не получится, будут проблемы с "Ь"=>"_'"
|
25
|
-
}.sort do |one, two|
|
26
|
-
two[1].split(//).size <=> one[1].split(//).size
|
27
|
-
end
|
28
|
-
|
29
|
-
TABLE_FROM = TABLE_TO.unshift([" ","__"]).clone
|
30
|
-
TABLE_TO.unshift(["_","__"])
|
31
|
-
|
32
|
-
#:startdoc:
|
4
|
+
ERR = "Equivalent bidirectional transliteration for URLs is malpractive. BiDi translit has been removed from RuTils"
|
33
5
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
lang_fr.each do |fr|
|
40
|
-
TABLE_TO.each do | translation |
|
41
|
-
fr.gsub!(/#{translation[0]}/, translation[1])
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
lang_sr = s.scan(/[0-9A-Za-z\_\-\.\/\']+/)
|
46
|
-
|
47
|
-
string = ""
|
48
|
-
if s =~ /\A[А-ёЁ ]/
|
49
|
-
lang_fr, lang_sr = lang_sr, lang_fr
|
50
|
-
string = "+"
|
51
|
-
end
|
52
|
-
|
53
|
-
0.upto([lang_fr.length, lang_sr.length].min-1) do |x|
|
54
|
-
string += lang_sr[x] + "+" + lang_fr[x] + "+";
|
55
|
-
end
|
56
|
-
|
57
|
-
if (lang_fr.length < lang_sr.length)
|
58
|
-
string += lang_sr[lang_sr.length-1]
|
59
|
-
else
|
60
|
-
string[0, string.length-1]
|
61
|
-
end
|
6
|
+
extend self
|
7
|
+
|
8
|
+
# ++DEPRECATED++
|
9
|
+
def translify(str, allow_slashes = true)
|
10
|
+
bail!
|
62
11
|
end
|
63
12
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
strings[x].gsub!(/#{translation[1]}/, translation[0])
|
72
|
-
end
|
73
|
-
end
|
74
|
-
out << slash << strings.to_s
|
75
|
-
end
|
76
|
-
out[slash.length, out.length-slash.length]
|
13
|
+
# ++DEPRECATED++
|
14
|
+
def detranslify(str, allow_slashes = true)
|
15
|
+
bail!
|
16
|
+
end
|
17
|
+
|
18
|
+
def bail! #:nodoc:
|
19
|
+
raise RuTils::RemovedFeature, ERR
|
77
20
|
end
|
78
21
|
end
|
@@ -1,11 +1,13 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
1
2
|
module RuTils
|
2
3
|
module Transliteration #:nodoc:
|
3
4
|
end
|
4
5
|
end
|
5
6
|
|
6
7
|
require File.join(File.dirname(__FILE__), 'simple')
|
7
|
-
require File.join(File.dirname(__FILE__), 'bidi')
|
8
8
|
|
9
|
+
# Заглушка
|
10
|
+
require File.join(File.dirname(__FILE__), 'bidi')
|
9
11
|
|
10
12
|
# Реализует транслитерацию любого объекта, реализующего String или to_s
|
11
13
|
module RuTils::Transliteration::StringFormatting
|
@@ -25,24 +27,24 @@ module RuTils::Transliteration::StringFormatting
|
|
25
27
|
RuTils::Transliteration::Simple::dirify(self.to_s)
|
26
28
|
end
|
27
29
|
|
28
|
-
#
|
30
|
+
# ++DEPRECATED++ Вызывает ошибку
|
29
31
|
def bidi_translify(allow_slashes = true)
|
30
|
-
RuTils::Transliteration::BiDi
|
32
|
+
RuTils::Transliteration::BiDi.bail!
|
31
33
|
end
|
32
34
|
|
33
|
-
#
|
35
|
+
# ++DEPRECATED++ Вызывает ошибку
|
34
36
|
def bidi_translify!(allow_slashes = true)
|
35
|
-
|
37
|
+
RuTils::Transliteration::BiDi.bail!
|
36
38
|
end
|
37
39
|
|
38
|
-
#
|
40
|
+
# ++DEPRECATED++ Вызывает ошибку
|
39
41
|
def bidi_detranslify!(allow_slashes = true)
|
40
|
-
|
42
|
+
RuTils::Transliteration::BiDi.bail!
|
41
43
|
end
|
42
44
|
|
43
|
-
#
|
45
|
+
# ++DEPRECATED++ Вызывает ошибку
|
44
46
|
def bidi_detranslify(allow_slashes = true)
|
45
|
-
RuTils::Transliteration::BiDi
|
47
|
+
RuTils::Transliteration::BiDi.bail!
|
46
48
|
end
|
47
49
|
end
|
48
50
|
|
data/lib/version.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require 'bluecloth'
|
3
|
+
|
4
|
+
# Интеграция с BlueCloth - Markdown
|
5
|
+
# Сам Markdown никакой обработки типографики не производит (это делает RubyPants, но вряд ли его кто-то юзает на практике)
|
6
|
+
class BlueclothIntegrationTest < Test::Unit::TestCase
|
7
|
+
C = RuTils::Gilenson::BlueClothExtra
|
8
|
+
|
9
|
+
def test_integration_markdown
|
10
|
+
assert_equal "<p>И вот «они пошли туда», и шли шли шли</p>",
|
11
|
+
C.new('И вот "они пошли туда", и шли шли шли').to_html
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require 'maruku'
|
3
|
+
|
4
|
+
# Интеграция с BlueCloth - Markdown
|
5
|
+
# Сам Markdown никакой обработки типографики не производит (это делает RubyPants, но вряд ли его кто-то юзает на практике)
|
6
|
+
class MarukuIntegrationTest < Test::Unit::TestCase
|
7
|
+
C = RuTils::Gilenson::MarukuExtra
|
8
|
+
|
9
|
+
def test_integration_maruku
|
10
|
+
|
11
|
+
assert_equal "<p>И вот «они пошли туда», и шли шли шли</p>",
|
12
|
+
C.new('И вот "они пошли туда", и шли шли шли').to_html
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
@@ -1,5 +1,7 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require 'action_controller'
|
1
3
|
require 'action_controller/test_process'
|
2
|
-
require File.dirname(__FILE__) + '
|
4
|
+
require File.dirname(__FILE__) + '/../../init.rb'
|
3
5
|
|
4
6
|
ActionController::Routing::Routes.draw { |map| map.connect ':controller/:action/:id' }
|
5
7
|
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
require 'action_controller'
|
4
|
+
require 'action_view'
|
5
|
+
|
6
|
+
require 'action_controller/test_process'
|
7
|
+
require File.dirname(__FILE__) + '/../../init.rb'
|
8
|
+
|
9
|
+
# Перегрузка helper'ов Rails
|
10
|
+
class RailsGilensonHelpersTest < Test::Unit::TestCase
|
11
|
+
|
12
|
+
class Kontroller < ActionController::Base
|
13
|
+
def action_with_gilensize
|
14
|
+
render :inline => "<%= gilensize('Они пришли -- туда -- к А. П. Чехову') %>"
|
15
|
+
end
|
16
|
+
|
17
|
+
def action_with_gilensize_and_options
|
18
|
+
render :inline => "<%= gilensize('Они пришли -- туда -- к А. П. Чехову', :raw_output => true) %>"
|
19
|
+
end
|
20
|
+
|
21
|
+
def action_with_textilize
|
22
|
+
render :inline => "<%= textilize('Они пришли -- туда -- к А. П. Чехову') %>"
|
23
|
+
end
|
24
|
+
|
25
|
+
def action_with_textilize_without_overrides
|
26
|
+
RuTils.overrides = false
|
27
|
+
render :inline => "<%= textilize('Они пришли -- туда -- к А. П. Чехову') %>"
|
28
|
+
end
|
29
|
+
|
30
|
+
def action_with_markdown
|
31
|
+
render :inline => "<%= markdown('Они пришли -- туда -- к А. П. Чехову') %>"
|
32
|
+
end
|
33
|
+
|
34
|
+
def action_with_markdown_without_overrides
|
35
|
+
RuTils.overrides = false
|
36
|
+
render :inline => "<%= markdown('Они пришли -- туда -- к А. П. Чехову') %>"
|
37
|
+
end
|
38
|
+
|
39
|
+
def rescue_action(e)
|
40
|
+
raise e
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def setup
|
45
|
+
@request = ActionController::TestRequest.new
|
46
|
+
@response = ActionController::TestResponse.new
|
47
|
+
@controller = Kontroller.new
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_action_with_gilensize
|
51
|
+
get :action_with_gilensize
|
52
|
+
assert_equal 'Они пришли — туда — к А.П. Чехову', @response.body
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_action_with_gilensize_and_options
|
56
|
+
get :action_with_gilensize_and_options
|
57
|
+
assert_equal "Они пришли — туда — к А.П. Чехову", @response.body
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_action_with_textilize
|
61
|
+
get :action_with_textilize
|
62
|
+
assert_equal "<p>Они пришли — туда — к А.П. Чехову</p>", @response.body
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_action_with_textilize_without_overrides
|
66
|
+
get :action_with_textilize_without_overrides
|
67
|
+
assert_equal "<p>Они пришли — туда — к А. П. Чехову</p>", @response.body, "Initials should not be formatted"
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_action_with_markdown
|
71
|
+
get :action_with_markdown
|
72
|
+
assert_equal "<p>Они пришли — туда — к А.П. Чехову</p>", @response.body
|
73
|
+
end
|
74
|
+
|
75
|
+
def test_action_with_markdown_without_overrides
|
76
|
+
get :action_with_markdown_without_overrides
|
77
|
+
assert_equal "<p>Они пришли -- туда -- к А. П. Чехову</p>", @response.body
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
@@ -1,8 +1,21 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
require 'action_controller'
|
4
|
+
require 'action_view'
|
5
|
+
|
6
|
+
require 'action_controller/test_process'
|
7
|
+
require File.dirname(__FILE__) + '/../../init.rb'
|
8
|
+
require 'action_pack/version'
|
9
|
+
|
10
|
+
ma, mi, ti = ActionPack::VERSION::MAJOR, ActionPack::VERSION::MINOR, ActionPack::VERSION::TINY
|
11
|
+
|
12
|
+
raise LoadError, "RuTils is not 2.2.2 compat" if (ma >= 2 && mi >= 2 && ti >= 1)
|
3
13
|
|
4
14
|
# Перегрузка helper'ов Rails
|
5
15
|
class RailsHelpersOverrideTest < Test::Unit::TestCase
|
16
|
+
TEST_DATE = Date.parse("1983-10-15") # coincidentially...
|
17
|
+
TEST_TIME = Time.local(1983, 10, 15, 12, 15) # also coincidentially...
|
18
|
+
|
6
19
|
# Вспомогательный класс для тестирования перегруженного DateHelper
|
7
20
|
class HelperStub
|
8
21
|
# для тестирования to_datetime_select_tag
|
@@ -21,7 +34,6 @@ class RailsHelpersOverrideTest < Test::Unit::TestCase
|
|
21
34
|
assert_equal "20 минут", @stub.distance_of_time_in_words(Time.now - 20.minutes, Time.now)
|
22
35
|
end
|
23
36
|
|
24
|
-
# TODO - TextMate это не хайлайтит, и это _крайне_ достает
|
25
37
|
def test_select_month
|
26
38
|
assert_match /июль/, @stub.select_month(TEST_DATE),
|
27
39
|
"Месяц в выборе месяца должен быть указан в именительном падеже"
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require 'rdiscount'
|
3
|
+
|
4
|
+
# Интеграция с BlueCloth - Markdown
|
5
|
+
# Сам Markdown никакой обработки типографики не производит (это делает RubyPants, но вряд ли его кто-то юзает на практике)
|
6
|
+
class RdiscountIntegrationTest < Test::Unit::TestCase
|
7
|
+
C = RuTils::Gilenson::RDiscountExtra
|
8
|
+
|
9
|
+
def test_integration_markdown
|
10
|
+
|
11
|
+
assert_equal "<p>И вот «они пошли туда», и шли шли шли</p>",
|
12
|
+
C.new('И вот "они пошли туда", и шли шли шли').to_html
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require 'redcloth'
|
3
|
+
raise LoadError, "need RedCloth 3.x" unless RedCloth::VERSION.to_s =~ /^3/
|
4
|
+
|
5
|
+
# Интеграция с RedCloth - Textile.
|
6
|
+
# Нужно иметь в виду что Textile осуществляет свою обработку типографики, которую мы подменяем!
|
7
|
+
class Redcloth3IntegrationTest < Test::Unit::TestCase
|
8
|
+
C = RuTils::Gilenson::RedClothExtra
|
9
|
+
def test_integration_with_redcloth_3
|
10
|
+
|
11
|
+
assert_equal "<p>И вот «они пошли туда», и шли шли шли</p>",
|
12
|
+
C.new('И вот "они пошли туда", и шли шли шли').to_html
|
13
|
+
|
14
|
+
assert_equal '<p><strong>strong text</strong> and <em>emphasized text</em></p>',
|
15
|
+
C.new("*strong text* and _emphasized text_").to_html,
|
16
|
+
"Spaces should be preserved"
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require 'redcloth'
|
3
|
+
raise LoadError, "need RedCloth 4.x" unless RedCloth::VERSION.to_s =~ /^4/
|
4
|
+
|
5
|
+
# Интеграция с RedCloth 4 - Textile.
|
6
|
+
class Redcloth4IntegrationTest < Test::Unit::TestCase
|
7
|
+
C = RuTils::Gilenson::RedClothExtra
|
8
|
+
|
9
|
+
def test_integration_with_redcloth_4
|
10
|
+
|
11
|
+
assert_equal "<p>И вот «они пошли туда», и шли шли шли</p>",
|
12
|
+
C.new('И вот "они пошли туда", и шли шли шли').to_html
|
13
|
+
|
14
|
+
assert_equal '<p><strong>strong text</strong> and <em>emphasized text</em></p>',
|
15
|
+
C.new("*strong text* and _emphasized text_").to_html,
|
16
|
+
"Spaces should be preserved"
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
data/test/run_tests.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
1
2
|
$KCODE = 'u'
|
2
3
|
require 'test/unit'
|
3
4
|
require File.dirname(__FILE__) + '/../lib/rutils'
|
@@ -116,7 +117,6 @@ class StrftimeTest < Test::Unit::TestCase
|
|
116
117
|
RuTils::overrides = true
|
117
118
|
sleep(rand(10)/200.0)
|
118
119
|
assert_equal "11 декабря", Time.local(1985, "dec", 11).strftime("%d %B")
|
119
|
-
RuTils::overrides = false
|
120
120
|
end
|
121
121
|
end
|
122
122
|
|
@@ -125,7 +125,6 @@ class StrftimeTest < Test::Unit::TestCase
|
|
125
125
|
RuTils::overrides = false
|
126
126
|
sleep(rand(10)/200.0)
|
127
127
|
assert_equal "11 December", Time.local(1985, "dec", 11).strftime("%d %B")
|
128
|
-
RuTils::overrides = true
|
129
128
|
end
|
130
129
|
end
|
131
130
|
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
1
2
|
$KCODE = 'u'
|
2
3
|
require 'test/unit'
|
3
4
|
require File.dirname(__FILE__) + '/../lib/rutils'
|
@@ -63,10 +64,23 @@ class GilensonOwnTest < Test::Unit::TestCase
|
|
63
64
|
assert_equal '" & ' > <   § © « ® ° ± · » – — ‘ ’ “ ” „ • … ™ −', '" & ' > < § © « ® ° ± · » – — ‘ ’ “ ” „ • … ™ −'.gilensize
|
64
65
|
end
|
65
66
|
|
66
|
-
def
|
67
|
+
def test_non_displayable_entities_replace1 # not_correct_number
|
67
68
|
assert_equal '„ … ' “ ” • – — ™', '„ … ’ “ ” • – — ™'.gilensize
|
68
69
|
end
|
70
|
+
|
71
|
+
def test_non_displayable_entities_replace2 # copy&paste
|
72
|
+
@gilenson.configure!(:copypaste => true)
|
73
|
+
assert_equal '«   » § © ® ° ± ¶ · – — ‘ ’ “ ” „ • … № ™ −   ″', @gilenson.process('« » § © ® ° ± ¶ · – — ‘ ’ “ ” „ • … № ™ − ″')
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_nbsp_removed_on_anchor_start
|
77
|
+
assert_equal 'abcd', @gilenson.process(' abcd')
|
78
|
+
end
|
69
79
|
|
80
|
+
def test_nbsp_removed_on_anchor_end
|
81
|
+
assert_equal 'abcd', @gilenson.process('abcd ')
|
82
|
+
end
|
83
|
+
|
70
84
|
def test_specials
|
71
85
|
assert_equal '© 2002, © 2003, © 2004, © 2005 — тоже без пробелов: ©2002, ©Кукуц. однако: варианты (а) и (с)', '(с) 2002, (С) 2003, (c) 2004, (C) 2005 -- тоже без пробелов: (с)2002, (c)Кукуц. однако: варианты (а) и (с)'.gilensize
|
72
86
|
assert_equal '+5°С, +7°C, –5°F', '+5^С, +17^C, -275^F'.gilensize
|
@@ -347,11 +361,6 @@ class GilensonConfigurationTest < Test::Unit::TestCase
|
|
347
361
|
@gilenson.process('скажи ,мне, ведь не даром !Москва, клеймённая пожаром .Французу отдана')
|
348
362
|
end
|
349
363
|
|
350
|
-
def test_ugly_entities_replace2 # copy&paste
|
351
|
-
@gilenson.configure!(:copypaste => true)
|
352
|
-
assert_equal '  « » § © ® ° ± ¶ · – — ‘ ’ “ ” „ • … № ™ −   ″', @gilenson.process(' « » § © ® ° ± ¶ · – — ‘ ’ “ ” „ • … № ™ − ″')
|
353
|
-
end
|
354
|
-
|
355
364
|
def test_raise_on_unknown_setting
|
356
365
|
assert_raise(RuTils::Gilenson::UnknownSetting) { @gilenson.configure!(:bararara => true) }
|
357
366
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$KCODE = 'u'
|
3
|
+
require 'test/unit'
|
4
|
+
|
5
|
+
require File.dirname(__FILE__) + '/../lib/rutils'
|
6
|
+
|
7
|
+
# Load all the prereqs
|
8
|
+
integration_tests = ['rubygems', 'multi_rails_init'] + Dir.glob(File.dirname(__FILE__) + '/extras/integration_*.rb')
|
9
|
+
|
10
|
+
# Specifically for Ruby 1.9.1 (too early at this point)
|
11
|
+
if ENV['NO_RAILS'] || RUBY_VERSION =~ /^1\.9/
|
12
|
+
STDERR.puts "Skipping Rails tests - NO_RAILS set in ENV or running on Ruby 1.9+"
|
13
|
+
integration_tests.reject! {|t| t.include?("rails") }
|
14
|
+
end
|
15
|
+
|
16
|
+
integration_tests.each do | integration_test |
|
17
|
+
begin
|
18
|
+
require integration_test
|
19
|
+
rescue LoadError => e
|
20
|
+
STDERR.puts "Skipping integration test #{File.basename(integration_test)} - deps not met (#{e.message})"
|
21
|
+
end
|
22
|
+
end
|