From: chris@... (Christian Neukirchen) Date: 2009-04-04T21:24:26+09:00 Subject: Re: [Ann] Verify, a very basic testing tool. Without proper announce, I'd like to show that I had something similar for quite some time now, as part of my knock project: % cat t.tb require 'knock' include Knock testing "various expectances" do expect(42) { 6 * 7 } expect(nil) { nil } expect(NameError) { abcdefghijk } is 42, 6*7 ok 42 == 6*7 end testing "that the universe is ok" do testing "this only shows in error reports" do 1 / 0 end end % ruby t.rb ok - various expectances - expecting value 42 ok - various expectances - expecting value nil ok - various expectances - expecting exception NameError ok - various expectances ok - various expectances not ok - /Users/chris/mess/current/t.rb:14 - that the universe is ok - this only shows in error reports - RAISED: divided by 0 # /Users/chris/mess/current/t.rb:15:in `/' # /Users/chris/mess/current/t.rb:15 # /Users/chris/mess/current/t.rb:14 # /Users/chris/mess/current/t.rb:13 % ruby t.rb | kn-agg not ok - 6 tests, 1 failed (83.3333% succeeded) The expect API is a rip-off from http://expectations.rubyforge.org/, but simplified to its core: % wc -l knock.rb kn-agg 61 knock.rb 10 kn-agg Sources can be found at http://github.com/chneukirchen/knock/tree/master There are implementations for C, Ruby, sh/bash/zsh, and it is trivial to implement in any language that supports "puts" in some way. -- Christian Neukirchen http://chneukirchen.org