Skip to content

could not work with unit test #116

Description

@yishilin

First, It works in my ruby script, but it does not work in my unit test script:

test.rb:

require 'test/unit'

class SolutionTest < Test::Unit::TestCase 
  def test_case_1
    a = 12
    puts a.wrong
  end
end

Below is the output of the rescue command:

 ➜  rescue test.rb
Loaded suite /local/code/trie_tree/test
Started
E
====================================
/local/code/trie_tree/test.rb:7:in `test_case_1'
     4: 
     5:   def test_case_1
     6:     a = 12
  => 7:     puts a.wrong
     8:   end
     9: end
Error: test_case_1(SolutionTest): NoMethodError: undefined method `wrong' for 12:Integer
===================================

Finished in 0.002424 seconds.
-------------------------------
1 tests, 0 assertions, 0 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications
0% passed
--------------------------------
412.54 tests/s, 0.00 assertions/s


➜   ruby -v
ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-darwin17]

➜   rbenv versions
  system
* 2.5.3 (set by /Users/rick/.rbenv/version)

➜   gem list | grep test
minitest (5.10.3)
test-unit (3.2.7)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions