mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
only use GEMNAME if defined in assert.rb
Check if the constant GEMNAME is defined before use in `assert.rb`. This is added to prevent an undefined constant error when using `assert.rb` in other environments - for example, testing CRuby.
This commit is contained in:
+3
-1
@@ -56,7 +56,9 @@ def assertion_string(err, str, iso=nil, e=nil, bt=nil)
|
||||
msg = "#{err}#{str}"
|
||||
msg += " [#{iso}]" if iso && !iso.empty?
|
||||
msg += " => #{e}" if e && !e.to_s.empty?
|
||||
msg += " (#{GEMNAME == 'mruby-test' ? 'core' : "mrbgems: #{GEMNAME}"})"
|
||||
if Object.const_defined?(:GEMNAME)
|
||||
msg += " (#{GEMNAME == 'mruby-test' ? 'core' : "mrbgems: #{GEMNAME}"})"
|
||||
end
|
||||
if $mrbtest_assert
|
||||
$mrbtest_assert.each do |idx, assert_msg, diff|
|
||||
msg += "\n - Assertion[#{idx}]"
|
||||
|
||||
Reference in New Issue
Block a user