# \[ann\] difects 3.0.0

**URL:** <https://www.ruby-forum.com/t/ann-difects-3-0-0/192153>\
**Category:** Ruby\
**Created:** [July 25, 2010, 4:37am UTC](https://www.ruby-forum.com/t/ann-difects-3-0-0/192153 "2010-07-25T04:37:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![snk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d9b06d/32.png) [@snk](https://www.ruby-forum.com/u/snk)\
**Post date:** [July 25, 2010, 4:37am UTC](https://www.ruby-forum.com/t/ann-difects-3-0-0/192153/1 "2010-07-25T04:37:17Z")

</div>

```
                          DIFECTS

            Assertion testing library for Ruby

           http://snk.tuxfamily.org/lib/difects/

```

DIFECTS is an assertion testing library for Ruby that  
emphasizes a simple assertion vocabulary, instant  
debuggability of failures, and flexibility in composing  
tests.

Version 3.0.0 (2010-07-24)

This release renames the project to “DIFECTS”, reduces cruft,  
improves the presentation and debuggability of assertion  
failures, and revises the manual. Thank you: Gavin S.  
inspired me to work on this project again! Incompatible  
changes: Rename project from “Dfect” to “DIFECTS”, which  
stands for: Describe, Inform, False, Error, Catch, True,  
Share Remove ruby-debug integration because it is only  
helpful if you run a program inside it from the very start!  
That is, you cannot start ruby-debug in the middle of a  
program and expect it to know about the call stack that lead  
up to that point in the program. Instead, we now use IRB to  
inspect program state at the point of failure only. Remove  
–quiet option because user can pipe to /dev/null instead.  
Rename run() to start() to better complement stop(). The  
run() method no longer clears test results; use reset() for  
that. Rename L() to I() as in “inform” the user. Replace  
options() with debug(). Replace report() with trace() and  
stats(). Rename the difects/full library to difects/long. Do  
not report instance variables in assertion failures. New  
features: Improve debuggability by tracking the bindings of  
all lines of code executed leading up to the point of failure  
using Ruby’s awesome set\_trace\_func facility. This allows  
block-less assertions to be debugged with the same level of  
accuracy as normal block-given assertions: x = 1 y = 3 T { x  
== y } # a block-given assertion T x == y # a block-less  
assertion In both cases, you will be able to inspect the  
local variables x and y! Add I!() method to start the  
interactive debugger anywhere in your tests. Add reset() to  
manually clear previous test results. Alias test() to D() in  
Test::Unit emulation layer. Fallback to pp() if to\_yaml()  
fails while reporting failures. Use OrderedHash library in  
Ruby versions older than 1.9 for consistent presentation of  
information in assertion failures. Show full failure details  
before starting debugger instead of omitting the backtrace  
and local variables listing. Use PP to pretty-print variable  
values in failure details. Omit unavailable information from  
failure details. Put backtrace above code listing and  
variables in failure details. Prevent empty array leaf nodes  
in execution trace. Bug fixes: Make DIFECTS module’s instance  
methods available as class methods. Always display fail trace  
before entering debugger. Always clear test execution  
internals after start(). Prevent IRB re-initialization errors  
when starting debugger. Housekeeping: Clarify how to mix-in  
modules inside insulated tests in the manual. Thanks to Gavin  
Sinclair for reporting this issue. Document methods (with  
hyperlinks to the location in the source code where they are  
defined) provided by emulation layers in manual. Talk about  
passing condition as first argument to T and F assertions and  
provide a code example in the manual. Clean up the code and  
revise the manual. Yay!

---

<div class="post-metadata">

**Author:** ![snk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d9b06d/32.png) [@snk](https://www.ruby-forum.com/u/snk)\
**Post date:** [July 25, 2010, 4:41am UTC](https://www.ruby-forum.com/t/ann-difects-3-0-0/192153/2 "2010-07-25T04:41:58Z")

</div>

Argh! Sorry for the unreadable announcement. Here is a better one.

```
                          DIFECTS

            Assertion testing library for Ruby

           http://snk.tuxfamily.org/lib/difects/

```

DIFECTS is an assertion testing library for [1]Ruby that  
emphasizes a simple assertion vocabulary, instant  
debuggability of failures, and flexibility in composing  
tests.

Version 3.0.0 (2010-07-24)

This release renames the project to “DIFECTS”, reduces cruft,  
improves the presentation and debuggability of assertion  
failures, and revises the manual.

Thank you:

```
 * Gavin S. inspired me to work on this project again!

```

Incompatible changes:

```
 * Rename project from "Dfect" to "DIFECTS", which stands
   for:

   Describe, Inform, False, Error, Catch, True, Share

 * Remove ruby-debug integration because it is only helpful
   if you run a program inside it from the very start! That
   is, you cannot start ruby-debug in the middle of a
   program and expect it to know about the call stack that
   lead up to that point in the program. Instead, we now use
   IRB to inspect program state at the point of failure
   only.

 * Remove --quiet option because user can pipe to /dev/null
   instead.

 * Rename run() to start() to better complement stop(). The
   run() method no longer clears test results; use reset()
   for that.

 * Rename L() to I() as in "inform" the user.

 * Replace options() with debug().

 * Replace report() with trace() and stats().

 * Rename the difects/full library to difects/long.

 * Do not report instance variables in assertion failures.

```

New features:

```
 * Improve debuggability by tracking the bindings of all
   lines of code executed leading up to the point of failure
   using Ruby's awesome set_trace_func facility.
   This allows block-less assertions to be debugged with the
   same level of accuracy as normal block-given assertions:

      x = 1
      y = 3
      T { x == y } # a block-given assertion
      T x == y # a block-less assertion

   In both cases, you will be able to inspect the local
   variables x and y!

 * Add I!() method to start the interactive debugger
   anywhere in your tests.

 * Add reset() to manually clear previous test results.

 * Alias test() to D() in [2]Test::Unit emulation layer.

 * Fallback to pp() if to_yaml() fails while reporting
   failures.

 * Use [3]OrderedHash library in Ruby versions older than
   1.9 for consistent presentation of information in
   assertion failures.

 * Show full failure details before starting debugger
   instead of omitting the backtrace and local variables
   listing.

 * Use PP to pretty-print variable values in failure
   details.

 * Omit unavailable information from failure details.

 * Put backtrace above code listing and variables in failure
   details.

 * Prevent empty array leaf nodes in execution trace.

```

Bug fixes:

```
 * Make DIFECTS module's instance methods available as class
   methods.

 * Always display fail trace before entering debugger.

 * Always clear test execution internals after start().

 * Prevent IRB re-initialization errors when starting
   debugger.

```

Housekeeping:

```
 * Clarify how to mix-in modules inside insulated tests in
   the manual.
   Thanks to Gavin S. for reporting this issue.

 * Document methods (with hyperlinks to the location in the
   source code where they are defined) provided by emulation
   layers in manual.

 * Talk about passing condition as first argument to T and F
   assertions and provide a code example in the manual.

 * Clean up the code and revise the manual. Yay!

```

References

1. [http://ruby-lang.org/](http://ruby-lang.org/)
2. 

[http://ruby-doc.org/stdlib/libdoc/test/unit/rdoc/classes/Test/Unit.html](http://ruby-doc.org/stdlib/libdoc/test/unit/rdoc/classes/Test/Unit.html)  
3. [orderedhash | RubyGems.org | your community gem host](http://rubygems.org/gems/orderedhash)
