Commits

Anonymous committed dca34ad

added dissection reporter

  • Participants
  • Parent commits 5e7713c

Comments (0)

Files changed (4)

examples/console.scm

-(use veritas-console veritas-quickcheck data-generators)
+(use veritas-console veritas-quickcheck data-generators veritas-dissection-reporter)
 
 (use-documentation-formatter)
 ;(use-short-formatter)
   ;; reported only once
   (verify subj (is > 0)))
 
-(verify 3.0 (is 3.01))
+(meta (dissect: #t)
+   (verify 3.0 (is 3.01)))
 
 ;; Grouping
 (group "Root"

reporters/dissection.scm

-;; add a reporter that halts at each failure and
-;; starts the dissector with subject
+(module veritas-dissection-reporter
+  ()
+  (import chicken scheme)
+  (use veritas veritas-base-reporter dissector)
+
+  (define dissect-every-failure (make-parameter #f))
+
+  (define (failure-handler result)
+    (let ((subject (verification-result-subject result)))
+      (when (or (dissect-every-failure) (meta-data-get subject 'dissect))
+        (parameterize ((dissection-prompt "Dissector>> "))
+          (dissect (force (verification-subject-expression-promise subject)))))))
+
+  (add-failure-listener failure-handler))
  (category testing)
  (license "MIT")
  (doc-from-wiki)
- (needs fmt matchable kvlists)
+ (needs fmt matchable kvlists dissector)
  (test-depends test))
 (compile -s -d0 -O3 -S reporters/console.scm -j veritas-console-reporter -o veritas-console-reporter.so)
 (compile -s -d0 -O3 veritas-console-reporter.import.scm)
 
+(compile -s -d0 -O3 -S reporters/dissection.scm -j veritas-dissection-reporter -o veritas-dissection-reporter.so)
+(compile -s -d0 -O3 veritas-dissection-reporter.import.scm)
+
 (compile -s -d0 -O3 -S veritas-repl -j veritas-repl -o veritas-repl.so)
 (compile -s -d0 -O3 veritas-repl.import.scm)
 
   `((version ,version)))
 
 (install-extension
-  'veritas-relp-reporter
+  'veritas-repl-reporter
   '("veritas-repl-reporter.import.so" "veritas-repl-reporter.so")
   `((version ,version)))
 
   `((version ,version)))
 
 (install-extension
+  'veritas-dissection-reporter
+  '("veritas-dissection-reporter.import.so" "veritas-dissection-reporter.so")
+  `((version ,version)))
+
+(install-extension
   'veritas-repl
   '("veritas-repl.import.so" "veritas-repl.so")
   `((version ,version)))