2016年9月14日水曜日

開発環境

Head First Ruby (Jay McGavren (著)、O'Reilly Media)のChapter 13.(Unit Testing: Code Quality Assurance)、MiniTest: Ruby's standard unit-testing library、EXERCISE(No. 6704)を取り組んでみる。

EXERCISE(No. 6704)

コード(Emacs)

#!/usr/bin/env ruby2.3
# -*- coding: utf-8 -*-

require 'minitest/autorun'

class TestMath < Minitest::Test
  def test_truth
    assert(2 + 2 == 4)
  end
  def test_fallacy
    assert(2 + 2 == 5)
  end  
end

入出力結果(Terminal)

$ ./sample1.rb
Run options: --seed 34862

# Running:

.F

Finished in 0.003830s, 522.1505 runs/s, 522.1505 assertions/s.

  1) Failure:
TestMath#test_fallacy [./sample1.rb:11]:
Failed assertion, no message given.

2 runs, 2 assertions, 1 failures, 0 errors, 0 skips
$

0 コメント:

コメントを投稿