summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2008-11-30 11:00:28 +0100
committerChristian Neukirchen <chneukirchen@gmail.com>2008-11-30 11:00:28 +0100
commitb473f201b54ebbe5c8cd1a59ee8571d74bf2a7ed (patch)
treec5925d209234b32d22db9a2c65a94c856da3dc78
parent8055e791eae194733fc31cc3687b9a30b8413515 (diff)
downloadbacon-b473f201b54ebbe5c8cd1a59ee8571d74bf2a7ed.tar.gz
bacon-b473f201b54ebbe5c8cd1a59ee8571d74bf2a7ed.tar.xz
bacon-b473f201b54ebbe5c8cd1a59ee8571d74bf2a7ed.zip
Add Knock output
-rwxr-xr-xbin/bacon3
-rw-r--r--lib/bacon.rb17
2 files changed, 20 insertions, 0 deletions
diff --git a/bin/bacon b/bin/bacon
index c76701e..104c887 100755
--- a/bin/bacon
+++ b/bin/bacon
@@ -49,6 +49,9 @@ opts = OptionParser.new("", 24, '  ') { |opts|
   opts.on("-p", "--tap",     "do TAP (Test Anything Protocol) output") {
     output = 'TapOutput'
   }
+  opts.on("-k", "--knock",   "do Knock output") {
+    output = 'KnockOutput'
+  }
 
   opts.on("-o", "--output FORMAT",
           "do FORMAT (SpecDox/TestUnit/Tap) output") { |format|
diff --git a/lib/bacon.rb b/lib/bacon.rb
index b9774f7..c1e1647 100644
--- a/lib/bacon.rb
+++ b/lib/bacon.rb
@@ -97,6 +97,23 @@ module Bacon
     end
   end
 
+  module KnockOutput
+    def handle_specification(name)  yield  end
+
+    def handle_requirement(description)
+      ErrorLog.replace ""
+      error = yield
+      if error.empty?
+        puts "ok - %s" % [description]
+      else
+        puts "not ok - %s: %s" % [description, error]
+        puts ErrorLog.strip.gsub(/^/, '# ')  if Backtraces
+      end
+    end
+
+    def handle_summary;  end
+  end
+
   extend SpecDoxOutput          # default
 
   class Error < RuntimeError