Skip to content

Commit

Permalink
Two fixes to make tests pass in Rubinius:
Browse files Browse the repository at this point in the history
1. rbx doesn't handle dup'ed classes correctly.
   We'll get the same behaviour with subclasses

2. Allow the filename to be in any position in the
   backtrace when an exception is raised.
  • Loading branch information
judofyr committed Apr 13, 2011
1 parent ccd5313 commit b8587ff
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
8 changes: 4 additions & 4 deletions test/tilt_erbtemplate_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ class MockOutputVariableScope
fail 'should have raised an exception'
rescue => boom
assert_kind_of NameError, boom
line = boom.backtrace.first
line = boom.backtrace.grep(/^test\.erb:/).first
assert line, "Backtrace didn't contain test.erb"
file, line, meth = line.split(":")
assert_equal 'test.erb', file
assert_equal '13', line
end
end
Expand Down Expand Up @@ -163,9 +163,9 @@ class Scope
fail 'should have raised an exception'
rescue => boom
assert_kind_of NameError, boom
line = boom.backtrace.first
line = boom.backtrace.grep(/^test\.erb:/).first
assert line, "Backtrace didn't contain test.erb"
file, line, meth = line.split(":")
assert_equal 'test.erb', file
assert_equal '13', line
end
end
Expand Down
4 changes: 2 additions & 2 deletions test/tilt_erubistemplate_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ class MockOutputVariableScope
fail 'should have raised an exception'
rescue => boom
assert_kind_of NameError, boom
line = boom.backtrace.first
line = boom.backtrace.grep(/^test\.erubis:/).first
assert line, "Backtrace didn't contain test.erubis"
file, line, meth = line.split(":")
assert_equal 'test.erubis', file
assert_equal '13', line
end
end
Expand Down
4 changes: 2 additions & 2 deletions test/tilt_fallback_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ def self.engine_initialized?; true end
def prepare; end
end

FailTemplate2 = FailTemplate.dup
WinTemplate2 = WinTemplate.dup
FailTemplate2 = Class.new(FailTemplate)
WinTemplate2 = Class.new(WinTemplate)

def set_ivar(obj, name, value)
obj.instance_variable_set("@#{name}", value)
Expand Down
8 changes: 4 additions & 4 deletions test/tilt_hamltemplate_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ class HamlTemplateTest < Test::Unit::TestCase
fail 'should have raised an exception'
rescue => boom
assert_kind_of NameError, boom
line = boom.backtrace.first
line = boom.backtrace.grep(/^test\.haml:/).first
assert line, "Backtrace didn't contain test.haml"
file, line, meth = line.split(":")
assert_equal 'test.haml', file
assert_equal '12', line
end
end
Expand Down Expand Up @@ -108,9 +108,9 @@ class Scope
fail 'should have raised an exception'
rescue => boom
assert_kind_of NameError, boom
line = boom.backtrace.first
line = boom.backtrace.grep(/^test\.haml:/).first
assert line, "Backtrace didn't contain test.haml"
file, line, meth = line.split(":")
assert_equal 'test.haml', file
assert_equal '12', line
end
end
Expand Down
7 changes: 4 additions & 3 deletions test/tilt_stringtemplate_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ class StringTemplateTest < Test::Unit::TestCase
fail 'should have raised an exception'
rescue => boom
assert_kind_of NameError, boom
line = boom.backtrace.first
line = boom.backtrace.grep(/^test\.str:/).first
assert line, "Backtrace didn't contain test.str"
file, line, meth = line.split(":")
assert_equal 'test.str', file
assert_equal '13', line
end
end
Expand Down Expand Up @@ -135,8 +135,9 @@ class Scope
rescue => boom
assert_kind_of NameError, boom
line = boom.backtrace.first
line = boom.backtrace.grep(/^test\.str:/).first
assert line, "Backtrace didn't contain test.str"
file, line, meth = line.split(":")
assert_equal 'test.str', file
assert_equal '13', line
end
end
Expand Down

0 comments on commit b8587ff

Please sign in to comment.