Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
3c9eedec
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
3c9eedec
编写于
9月 21, 2008
作者:
M
Manfred Stienstra
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move multibyte test helpers to a separate file and make the conformance tests run again.
上级
85c05b53
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
26 addition
and
22 deletion
+26
-22
activesupport/test/multibyte_chars_test.rb
activesupport/test/multibyte_chars_test.rb
+4
-21
activesupport/test/multibyte_conformance.rb
activesupport/test/multibyte_conformance.rb
+5
-1
activesupport/test/multibyte_test_helpers.rb
activesupport/test/multibyte_test_helpers.rb
+17
-0
未找到文件。
activesupport/test/multibyte_chars_test.rb
浏览文件 @
3c9eedec
# encoding: utf-8
require
'abstract_unit'
module
MultibyteTest
UNICODE_STRING
=
'こにちわ'
ASCII_STRING
=
'ohayo'
BYTE_STRING
=
"
\270\236\010\210\245
"
def
chars
(
str
)
ActiveSupport
::
Multibyte
::
Chars
.
new
(
str
)
end
def
inspect_codepoints
(
str
)
str
.
to_s
.
unpack
(
"U*"
).
map
{
|
cp
|
cp
.
to_s
(
16
)
}.
join
(
' '
)
end
def
assert_equal_codepoints
(
expected
,
actual
,
message
=
nil
)
assert_equal
(
inspect_codepoints
(
expected
),
inspect_codepoints
(
actual
),
message
)
end
end
require
'multibyte_test_helpers'
class
String
def
__method_for_multibyte_testing_with_integer_result
;
1
;
end
...
...
@@ -27,7 +10,7 @@ def __method_for_multibyte_testing!; 'result'; end
end
class
MultibyteCharsTest
<
Test
::
Unit
::
TestCase
include
MultibyteTest
include
MultibyteTest
Helpers
def
setup
@proxy_class
=
ActiveSupport
::
Multibyte
::
Chars
...
...
@@ -113,7 +96,7 @@ def test_concatenate_should_return_proxy_instance
end
class
MultibyteCharsUTF8BehaviourTest
<
Test
::
Unit
::
TestCase
include
MultibyteTest
include
MultibyteTest
Helpers
def
setup
@chars
=
UNICODE_STRING
.
dup
.
mb_chars
...
...
@@ -445,7 +428,7 @@ def test_acts_like_string
# for the implementation of these features should run on all Ruby versions and shouldn't be tested
# through the proxy methods.
class
MultibyteCharsExtrasTest
<
Test
::
Unit
::
TestCase
include
MultibyteTest
include
MultibyteTest
Helpers
if
RUBY_VERSION
>=
'1.9'
def
test_tidy_bytes_is_broken_on_1_9_0
...
...
activesupport/test/multibyte_conformance.rb
浏览文件 @
3c9eedec
# encoding: utf-8
require
'abstract_unit'
require
'multibyte_test_helpers'
require
'fileutils'
require
'open-uri'
require
'tmpdir'
...
...
@@ -22,7 +26,7 @@ def self.download(from, to)
end
class
MultibyteConformanceTest
<
Test
::
Unit
::
TestCase
include
MultibyteTest
include
MultibyteTest
Helpers
UNIDATA_URL
=
"http://www.unicode.org/Public/
#{
ActiveSupport
::
Multibyte
::
UNICODE_VERSION
}
/ucd"
UNIDATA_FILE
=
'/NormalizationTest.txt'
...
...
activesupport/test/multibyte_test_helpers.rb
0 → 100644
浏览文件 @
3c9eedec
module
MultibyteTestHelpers
UNICODE_STRING
=
'こにちわ'
ASCII_STRING
=
'ohayo'
BYTE_STRING
=
"
\270\236\010\210\245
"
def
chars
(
str
)
ActiveSupport
::
Multibyte
::
Chars
.
new
(
str
)
end
def
inspect_codepoints
(
str
)
str
.
to_s
.
unpack
(
"U*"
).
map
{
|
cp
|
cp
.
to_s
(
16
)
}.
join
(
' '
)
end
def
assert_equal_codepoints
(
expected
,
actual
,
message
=
nil
)
assert_equal
(
inspect_codepoints
(
expected
),
inspect_codepoints
(
actual
),
message
)
end
end
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录