diff options
| author | Mark Delk <[email protected]> | 2020-06-08 00:15:33 -0500 |
|---|---|---|
| committer | Mark Delk <[email protected]> | 2020-06-08 00:30:46 -0500 |
| commit | 3157efa57c412865e828d8cd87cf5c3dcbb3afac (patch) | |
| tree | d7990a8f331ccd6c827fa2e3297b3fcd95a3e390 /test | |
| parent | 613e0bee5e500963ac79bc3eb0ca23c8f3df8cb7 (diff) | |
| download | mruby-3157efa57c412865e828d8cd87cf5c3dcbb3afac.tar.gz mruby-3157efa57c412865e828d8cd87cf5c3dcbb3afac.zip | |
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.
Diffstat (limited to 'test')
| -rw-r--r-- | test/assert.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/test/assert.rb b/test/assert.rb index b4029f175..73382fb1c 100644 --- a/test/assert.rb +++ b/test/assert.rb @@ -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}]" |
