madx / mtest
- Source
- Commits
- Network (0)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Tree:
be0d28e
mtest / README
| 8a631523 » | madx | 2008-06-04 | 1 | ||
| 3358cb43 » | madx | 2008-06-04 | 2 | ‘‘ MTest ’’ | |
| 8a631523 » | madx | 2008-06-04 | 3 | ||
| 2a6b1646 » | madx | 2008-06-05 | 4 | ||
| 2ec46aee » | madx | 2008-06-04 | 5 | MTest (stands for MicroTest) is a tiny and fast TDD framework. | |
| 8a631523 » | madx | 2008-06-04 | 6 | ||
| 7 | It provides the Kernel#MTest method that takes an array of test as a parameter. | ||||
| 8 | |||||
| 9 | Need an example? Right. | ||||
| 10 | |||||
| 2a6b1646 » | madx | 2008-06-05 | 11 | ||
| 8a631523 » | madx | 2008-06-04 | 12 | require 'mtest' | |
| 13 | |||||
| 14 | tests = [ | ||||
| 15 | "This is a simple test", | ||||
| 16 | ["Sum 40+2", proc { | ||||
| 17 | 40 + 2 | ||||
| 18 | }, 42] | ||||
| 19 | ] | ||||
| 20 | |||||
| 21 | MTest(tests) | ||||
| 2a6b1646 » | madx | 2008-06-05 | 22 | ||
| 8a631523 » | madx | 2008-06-04 | 23 | ||
| 24 | MTests returns a hash that represents the results of a test. Example! | ||||
| 25 | |||||
| 2a6b1646 » | madx | 2008-06-05 | 26 | ||
| 8a631523 » | madx | 2008-06-04 | 27 | tests = [ | |
| 28 | "This is a simple test", | ||||
| 2a6b1646 » | madx | 2008-06-05 | 29 | ["Sum 40+2", proc { 40 + 2 }, 42], | |
| 30 | |||||
| 8a631523 » | madx | 2008-06-04 | 31 | "This one fails", | |
| 2ec46aee » | madx | 2008-06-04 | 32 | ["FAIL", proc { true }, false] | |
| 8a631523 » | madx | 2008-06-04 | 33 | ] | |
| 34 | |||||
| 35 | res = MTest(tests) | ||||
| 36 | |||||
| 37 | res # => {:pass => 1, :err => 0, :fail => 1} | ||||
| 2ec46aee » | madx | 2008-06-04 | 38 | ||
| 2a6b1646 » | madx | 2008-06-05 | 39 | ||
| 2ec46aee » | madx | 2008-06-04 | 40 | ** Contributing ** | |
| 41 | |||||
| 42 | Everyone is welcome to contribute to MTest. The only restriction is that | ||||
| 43 | mtest.rb must be less than 51 lines long. | ||||
| 44 | |||||
| 45 | But feel free to submit your own tools, examples, hacks, etc. | ||||
