forked from robin/chitsheet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_unit.yml
31 lines (31 loc) · 3.06 KB
/
test_unit.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
---
test_unit: "Ruby - Test::Unit\n\
===============================================================================\n\
Basic Usage:\n\n require 'test/unit'\n\n class Test_SomethingToTest < Test::Unit::TestCase\n def setup\n #will be run prior to each test\n end\n\n # Replace this with your real tests.\n def test_truth\n assert true\n end\n end\n\n\n\
Assertions:\n\
===============================================================================\n\
All assertions also take an optional argument of failure message.\n\n\
> assert(boolean,[msg])\t \n Ensures that the object/expression is true.\n\n\
> assert_block([msg]) { block }\n Most basic assertion\n\n\
> assert_equal(obj1, obj2, [msg])\n Ensures that obj1 == obj2 is true.\n\n\
> assert_in_delta(expecting, actual, delta, [msg])\n Ensures that the numbers expecting and actual are within delta of each other.\n \n\
> assert_instance_of(class, obj, [msg])\n Ensures that obj is of the class type.\n\n\
> assert_kind_of(class, obj, [msg])\n Ensures that obj is or descends from class.\n\n\
> assert_match(regexp, string, [msg])\n Ensures that a string matches the regular expression.\n\n\
> assert_nil(obj, [msg])\n Ensures that obj.nil? is true.\n\n\
> assert_no_match(regexp, string, [msg])\n Ensures that a string doesn\xE2\x80\x99t matches the regular expression.\n \n\
> assert_not_equal(obj1, obj2, [msg])\t \n Ensures that obj1 == obj2 is false.\n\n\
> assert_not_nil(obj, [msg])\n Ensures that obj.nil? is false.\n\n\
> assert_not_same((obj1, obj2, [msg])\n Ensures that obj1.equal?(obj2) is false.\n\n\
> assert_nothing_raised(exception1, ...) { block }\n Ensures that the given block doesn\xE2\x80\x99t raise one of the given exceptions.\n \n\
> assert_nothing_thrown([msg]) { block }\n Passes if block does not throw anything \n\n\
> assert_operator(obj1, operator, obj2, [msg])\n Ensures that obj1.operator(obj2) is true.\n\n\
> assert_raise(except1, except2, ...) { block }\n Ensures that the given block raises one of the given exceptions.\n\n\
> assert_respond_to(obj, symbol, [msg])\n Ensures that obj has a method called symbol.\n\n\
> assert_same(obj1, obj2, [msg])\n Ensures that obj1.equal?(obj2) is true.\n \n\
> assert_send(array, [msg])\n Ensures that executing the method listed in array[1] on the object in\n array[0] with the parameters of array[2 and up] is true. This one is weird eh?\n\n\
> assert_throws(symbol, [msg]) { block }\n Ensures that the given block throws the symbol.\n \n\
> flunk([msg])\n Ensures failure. This is useful to explicitly mark a test that isn\xE2\x80\x99t \n finished yet.\n\n\
===============================================================================\n\
Updated by: Adam G.\n\
Updated at: 2010-04-22"