Skip to content

only use GEMNAME if defined in assert.rb#5020

Merged
matz merged 1 commit intomruby:masterfrom
mddelk:master
Jun 8, 2020
Merged

only use GEMNAME if defined in assert.rb#5020
matz merged 1 commit intomruby:masterfrom
mddelk:master

Conversation

@mddelk
Copy link
Copy Markdown
Contributor

@mddelk mddelk commented Jun 8, 2020

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.

Before

ruby -I test -r assert -e "assert('w') { assert_true true; assert_true false }; report"
Traceback (most recent call last):
        2: from -e:1:in `<main>'
        1: from /home/user/mruby/test/assert.rb:107:in `assert'
/home/user/mruby/test/assert.rb:59:in `assertion_string': uninitialized constant GEMNAME (NameError)
        3: from -e:1:in `<main>'
        2: from /home/user/mruby/test/assert.rb:119:in `assert'
        1: from /home/user/mruby/test/assert.rb:125:in `rescue in assert'
/home/user/mruby/test/assert.rb:59:in `assertion_string': uninitialized constant GEMNAME (NameError)

After

ruby -I test -r assert -e "assert('w') { assert_true true; assert_true false }; report"
F
Fail: w
 - Assertion[2]
    Expected false to be true.
  Total: 1
     OK: 0
     KO: 1
  Crash: 0
Warning: 0
   Skip: 0
   Time: 0.0 seconds

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.
@mddelk mddelk marked this pull request as ready for review June 8, 2020 05:37
@matz matz merged commit 2098ace into mruby:master Jun 8, 2020
@matz
Copy link
Copy Markdown
Member

matz commented Jun 8, 2020

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants