Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
10719e1c
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 搜索 >>
提交
10719e1c
编写于
5月 28, 2015
作者:
R
Rafael Mendonça França
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #20267 from kaspth/fix-minitest-constant-clashing
Avoid E constant clashing with Minitest defined version.
上级
57f51f09
afb6a2c0
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
45 addition
and
43 deletion
+45
-43
activesupport/test/autoloading_fixtures/a/c/e/f.rb
activesupport/test/autoloading_fixtures/a/c/e/f.rb
+0
-2
activesupport/test/autoloading_fixtures/a/c/em/f.rb
activesupport/test/autoloading_fixtures/a/c/em/f.rb
+2
-0
activesupport/test/autoloading_fixtures/d.rb
activesupport/test/autoloading_fixtures/d.rb
+2
-0
activesupport/test/autoloading_fixtures/e.rb
activesupport/test/autoloading_fixtures/e.rb
+0
-2
activesupport/test/autoloading_fixtures/em.rb
activesupport/test/autoloading_fixtures/em.rb
+2
-0
activesupport/test/caching_test.rb
activesupport/test/caching_test.rb
+8
-8
activesupport/test/core_ext/marshal_test.rb
activesupport/test/core_ext/marshal_test.rb
+16
-16
activesupport/test/dependencies_test.rb
activesupport/test/dependencies_test.rb
+15
-15
未找到文件。
activesupport/test/autoloading_fixtures/a/c/e/f.rb
已删除
100644 → 0
浏览文件 @
57f51f09
class
A::C::E::F
end
\ No newline at end of file
activesupport/test/autoloading_fixtures/a/c/em/f.rb
0 → 100644
浏览文件 @
10719e1c
class
A::C::EM::F
end
\ No newline at end of file
activesupport/test/autoloading_fixtures/d.rb
0 → 100644
浏览文件 @
10719e1c
class
D
end
\ No newline at end of file
activesupport/test/autoloading_fixtures/e.rb
已删除
100644 → 0
浏览文件 @
57f51f09
class
E
end
\ No newline at end of file
activesupport/test/autoloading_fixtures/em.rb
0 → 100644
浏览文件 @
10719e1c
class
EM
end
\ No newline at end of file
activesupport/test/caching_test.rb
浏览文件 @
10719e1c
...
...
@@ -636,37 +636,37 @@ module AutoloadingCacheBehavior
include
DependenciesTestHelpers
def
test_simple_autoloading
with_autoloading_fixtures
do
@cache
.
write
(
'foo'
,
E
.
new
)
@cache
.
write
(
'foo'
,
E
M
.
new
)
end
remove_constants
(
:E
)
remove_constants
(
:E
M
)
ActiveSupport
::
Dependencies
.
clear
with_autoloading_fixtures
do
assert_kind_of
E
,
@cache
.
read
(
'foo'
)
assert_kind_of
E
M
,
@cache
.
read
(
'foo'
)
end
remove_constants
(
:E
)
remove_constants
(
:E
M
)
ActiveSupport
::
Dependencies
.
clear
end
def
test_two_classes_autoloading
with_autoloading_fixtures
do
@cache
.
write
(
'foo'
,
[
E
.
new
,
ClassFolder
.
new
])
@cache
.
write
(
'foo'
,
[
E
M
.
new
,
ClassFolder
.
new
])
end
remove_constants
(
:E
,
:ClassFolder
)
remove_constants
(
:E
M
,
:ClassFolder
)
ActiveSupport
::
Dependencies
.
clear
with_autoloading_fixtures
do
loaded
=
@cache
.
read
(
'foo'
)
assert_kind_of
Array
,
loaded
assert_equal
2
,
loaded
.
size
assert_kind_of
E
,
loaded
[
0
]
assert_kind_of
E
M
,
loaded
[
0
]
assert_kind_of
ClassFolder
,
loaded
[
1
]
end
remove_constants
(
:E
,
:ClassFolder
)
remove_constants
(
:E
M
,
:ClassFolder
)
ActiveSupport
::
Dependencies
.
clear
end
end
...
...
activesupport/test/core_ext/marshal_test.rb
浏览文件 @
10719e1c
...
...
@@ -8,7 +8,7 @@ class MarshalTest < ActiveSupport::TestCase
def
teardown
ActiveSupport
::
Dependencies
.
clear
remove_constants
(
:E
,
:ClassFolder
)
remove_constants
(
:E
M
,
:ClassFolder
)
end
test
"that Marshal#load still works"
do
...
...
@@ -22,14 +22,14 @@ def teardown
test
"that a missing class is autoloaded from string"
do
dumped
=
nil
with_autoloading_fixtures
do
dumped
=
Marshal
.
dump
(
E
.
new
)
dumped
=
Marshal
.
dump
(
E
M
.
new
)
end
remove_constants
(
:E
)
remove_constants
(
:E
M
)
ActiveSupport
::
Dependencies
.
clear
with_autoloading_fixtures
do
assert_kind_of
E
,
Marshal
.
load
(
dumped
)
assert_kind_of
E
M
,
Marshal
.
load
(
dumped
)
end
end
...
...
@@ -50,16 +50,16 @@ def teardown
test
"that more than one missing class is autoloaded"
do
dumped
=
nil
with_autoloading_fixtures
do
dumped
=
Marshal
.
dump
([
E
.
new
,
ClassFolder
.
new
])
dumped
=
Marshal
.
dump
([
E
M
.
new
,
ClassFolder
.
new
])
end
remove_constants
(
:E
,
:ClassFolder
)
remove_constants
(
:E
M
,
:ClassFolder
)
ActiveSupport
::
Dependencies
.
clear
with_autoloading_fixtures
do
loaded
=
Marshal
.
load
(
dumped
)
assert_equal
2
,
loaded
.
size
assert_kind_of
E
,
loaded
[
0
]
assert_kind_of
E
M
,
loaded
[
0
]
assert_kind_of
ClassFolder
,
loaded
[
1
]
end
end
...
...
@@ -67,10 +67,10 @@ def teardown
test
"that a real missing class is causing an exception"
do
dumped
=
nil
with_autoloading_fixtures
do
dumped
=
Marshal
.
dump
(
E
.
new
)
dumped
=
Marshal
.
dump
(
E
M
.
new
)
end
remove_constants
(
:E
)
remove_constants
(
:E
M
)
ActiveSupport
::
Dependencies
.
clear
assert_raise
(
NameError
)
do
...
...
@@ -84,10 +84,10 @@ class SomeClass
end
with_autoloading_fixtures
do
dumped
=
Marshal
.
dump
([
E
.
new
,
SomeClass
.
new
])
dumped
=
Marshal
.
dump
([
E
M
.
new
,
SomeClass
.
new
])
end
remove_constants
(
:E
)
remove_constants
(
:E
M
)
self
.
class
.
send
(
:remove_const
,
:SomeClass
)
ActiveSupport
::
Dependencies
.
clear
...
...
@@ -96,8 +96,8 @@ class SomeClass
Marshal
.
load
(
dumped
)
end
assert_nothing_raised
(
"E failed to load while we expect only SomeClass to fail loading"
)
do
E
.
new
assert_nothing_raised
(
"E
M
failed to load while we expect only SomeClass to fail loading"
)
do
E
M
.
new
end
assert_raise
(
NameError
,
"We expected SomeClass to not be loaded but it is!"
)
do
...
...
@@ -109,15 +109,15 @@ class SomeClass
test
"loading classes from files trigger autoloading"
do
Tempfile
.
open
(
"object_serializer_test"
)
do
|
f
|
with_autoloading_fixtures
do
Marshal
.
dump
(
E
.
new
,
f
)
Marshal
.
dump
(
E
M
.
new
,
f
)
end
f
.
rewind
remove_constants
(
:E
)
remove_constants
(
:E
M
)
ActiveSupport
::
Dependencies
.
clear
with_autoloading_fixtures
do
assert_kind_of
E
,
Marshal
.
load
(
f
)
assert_kind_of
E
M
,
Marshal
.
load
(
f
)
end
end
end
...
...
activesupport/test/dependencies_test.rb
浏览文件 @
10719e1c
...
...
@@ -187,7 +187,7 @@ def test_module_loading
assert_kind_of
Module
,
A
assert_kind_of
Class
,
A
::
B
assert_kind_of
Class
,
A
::
C
::
D
assert_kind_of
Class
,
A
::
C
::
E
::
F
assert_kind_of
Class
,
A
::
C
::
E
M
::
F
end
end
...
...
@@ -552,24 +552,24 @@ module A
def
test_const_missing_in_anonymous_modules_loads_top_level_constants
with_autoloading_fixtures
do
# class_eval STRING pushes the class to the nesting of the eval'ed code.
klass
=
Class
.
new
.
class_eval
"E"
assert_equal
E
,
klass
klass
=
Class
.
new
.
class_eval
"E
M
"
assert_equal
E
M
,
klass
end
ensure
remove_constants
(
:E
)
remove_constants
(
:E
M
)
end
def
test_const_missing_in_anonymous_modules_raises_if_the_constant_belongs_to_Object
with_autoloading_fixtures
do
require_dependency
'e'
require_dependency
'e
m
'
mod
=
Module
.
new
e
=
assert_raise
(
NameError
)
{
mod
::
E
}
assert_equal
'E cannot be autoloaded from an anonymous class or module'
,
e
.
message
assert_equal
:E
,
e
.
name
e
=
assert_raise
(
NameError
)
{
mod
::
E
M
}
assert_equal
'E
M
cannot be autoloaded from an anonymous class or module'
,
e
.
message
assert_equal
:E
M
,
e
.
name
end
ensure
remove_constants
(
:E
)
remove_constants
(
:E
M
)
end
def
test_removal_from_tree_should_be_detected
...
...
@@ -664,19 +664,19 @@ def test_application_should_special_case_application_controller
def
test_preexisting_constants_are_not_marked_as_autoloaded
with_autoloading_fixtures
do
require_dependency
'e'
assert
ActiveSupport
::
Dependencies
.
autoloaded?
(
:E
)
require_dependency
'e
m
'
assert
ActiveSupport
::
Dependencies
.
autoloaded?
(
:E
M
)
ActiveSupport
::
Dependencies
.
clear
end
Object
.
const_set
:E
,
Class
.
new
Object
.
const_set
:E
M
,
Class
.
new
with_autoloading_fixtures
do
require_dependency
'e'
assert
!
ActiveSupport
::
Dependencies
.
autoloaded?
(
:E
),
"E
shouldn't be marked autoloaded!"
require_dependency
'e
m
'
assert
!
ActiveSupport
::
Dependencies
.
autoloaded?
(
:E
M
),
"EM
shouldn't be marked autoloaded!"
ActiveSupport
::
Dependencies
.
clear
end
ensure
remove_constants
(
:E
)
remove_constants
(
:E
M
)
end
def
test_constants_in_capitalized_nesting_marked_as_autoloaded
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录