Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- Fixes for maglev.

[git-p4: depot-paths = "//src/ZenTest/dev/": change = 8159]
  • Loading branch information...
commit 6c96ec85bac6c7c8d505e3e248134d32bbbc8c9d 1 parent 201cf70
@zenspider zenspider authored
Showing with 19 additions and 19 deletions.
  1. +10 −12 lib/zentest.rb
  2. +1 −1  test/test_autotest.rb
  3. +8 −6 test/test_zentest.rb
View
22 lib/zentest.rb
@@ -4,8 +4,14 @@
end
$stdlib = {}
-ObjectSpace.each_object(Module) do |m|
- $stdlib[m.name] = true if m.respond_to? :name
+if ObjectSpace.respond_to?(:loaded_classes, true) then
+ ObjectSpace.loaded_classes(true).each do |m|
+ $stdlib[m.name] = true if m.respond_to? :name
+ end
+else
+ ObjectSpace.each_object(Module) do |m|
+ $stdlib[m.name] = true if m.respond_to? :name
+ end
end
require 'zentest_mapping'
@@ -96,21 +102,13 @@ def load_file(file)
end
end
- # obtain the class klassname, either from Module or
- # using ObjectSpace to search for it.
+ # obtain the class klassname
def get_class(klassname)
+ klass = nil
begin
klass = klassname.split(/::/).inject(Object) { |k,n| k.const_get n }
puts "# found class #{klass.name}" if $DEBUG
rescue NameError
- ObjectSpace.each_object(Class) do |cls|
- if cls.name =~ /(^|::)#{klassname}$/ then
- klass = cls
- klassname = cls.name
- break
- end
- end
- puts "# searched and found #{klass.name}" if klass and $DEBUG
end
if klass.nil? and not $TESTING then
View
2  test/test_autotest.rb
@@ -34,7 +34,7 @@ class TestAutotest < MiniTest::Unit::TestCase
alias :deny :refute
- RUBY = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name']) unless defined? RUBY
+ RUBY = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'])
def setup
@test_class = 'TestBlah'
View
14 test/test_zentest.rb
@@ -33,9 +33,9 @@ def overridden; end
end
class LowlyOne < SuperDuper # ZenTest SKIP
- def self.cls_extended; end
+ def self.cls_xtended; end
def overridden; end
- def extended; end
+ def xtended; end # renamed because maglev defines it globally :/
def pretty_print; end
def pretty_print_cycle; end
end
@@ -408,9 +408,9 @@ def test_get_inherited_methods_for_superclass_full
def test_get_methods_for_subclass
expect = {
- "self.cls_extended" => true,
+ "self.cls_xtended" => true,
"overridden" => true,
- "extended" => true
+ "xtended" => true
}
result = @tester.get_methods_for("LowlyOne")
@@ -420,9 +420,9 @@ def test_get_methods_for_subclass
def test_get_methods_for_subclass_full
expect = {
"self.cls_inherited" => true,
- "self.cls_extended" => true,
+ "self.cls_xtended" => true,
"overridden" => true,
- "extended" => true
+ "xtended" => true
}
result = @tester.get_methods_for("LowlyOne", true)
@@ -556,6 +556,8 @@ def test_testcase8
end
def test_testcase9
+ skip "doesn't define to_s on TrueClass?!?" if maglev?
+
# stupid YAML is breaking my tests. Enters via Test::Rails. order dependent.
if defined? YAML then
TrueClass.send :remove_method, :taguri, :taguri=, :to_yaml rescue nil
Please sign in to comment.
Something went wrong with that request. Please try again.