るりまサーチ

最速Rubyリファレンスマニュアル検索!
4件ヒット [1-4件を表示] (0.010秒)
トップページ > クエリ:assert[x] > クエリ:assert_equal[x]

別のキーワード

  1. mkmf try_static_assert
  2. kernel try_static_assert
  3. try_static_assert kernel
  4. try_static_assert mkmf
  5. minitest/unit assert_equal

ライブラリ

クラス

モジュール

キーワード

検索結果

MiniTest::Assertions#assert_equal(expected, actual, message = nil) -> true (27202.0)

与えられた期待値と実際の値が等しい場合、検査にパスしたことになります。

...セージを指定します。
文字列か Proc を指定します。Proc である場合は Proc#call した
結果を使用します。

@raise MiniTest::Assertion 与えられた期待値と実際の値が等しくない場合に発生します。

@see Object#==...

minitest/unit (24.0)

ユニットテストを行うためのライブラリです。

...end
# teardown はあまり使わない
def teardown
@foo = nil
end

def test_foo
assert_equal
"foo", @foo.foo
end

def test_bar
assert_equal
"bar", @foo.bar
end
end

または MiniTest::Unit.autorun を省略して以下のように書くこ...
...Started
F.
Finished in 0.000940 seconds.

1) Failure:
test_bar(TestFoo) [test_foo.rb:20]:
Expected "bar", not "foo".

2 tests, 2 assertions, 1 failures, 0 errors, 0 skips

test_bar だけテストしたい場合は以下のようなオプションを与えます。

$ ruby test_...
...Started
F
Finished in 0.000820 seconds.

1) Failure:
test_bar(TestFoo) [test_foo.rb:20]:
Expected "bar", not "foo".

1 tests, 1 assertions, 1 failures, 0 errors, 0 skips

コンソールを使った testrunner のみ提供されています。
またヘルプを表示すること...

test/unit (24.0)

ユニットテストを行うためのライブラリです。

...ase
def setup
@obj = Foo.new
end

# def teardown
# end

def test_foo
assert_equal
("foo", @obj.foo)
end
def test_bar
assert_equal
("bar", @obj.bar)
end
end

テストを実行するには上で用意した test_foo.rb を実...
...23 seconds.

1) Failure:
test_bar(TC_Foo) [test_foo.rb:16]:
<"bar"> expected but was
<"foo">.

2 tests, 2 assertions, 1 failures, 0 errors, 0 skips

test_bar だけテストしたい場合は以下のようなオプションを与えます。

$ ruby...
...73 seconds.

1) Failure:
test_bar(TC_Foo) [test_foo.rb:16]:
<"bar"> expected but was
<"foo">.

1 tests, 1 assertions, 1 failures, 0 errors, 0 skips

--name=test_barのような指定は行えません。

以下のようにすると help も表示されま...

Object#must_equal(expected) -> true (12.0)

自身が比較対象のオブジェクトと等しい場合、検査にパスしたことになります。

...しい場合、検査にパスしたことになります。

@param expected 比較対象のオブジェクトを指定します。

@raise MiniTest::Assertion 与えられた期待値と実際の値が等しくない場合に発生します。

@see Object#==, MiniTest::Assertions#assert_equal...