On Wednesday 13 October 2004 09:19 pm, Nathaniel Talbott wrote:
| Well, the current plan is to let you to do something like this:
|
|    class Adder
|      include Testing
|
|      # Adds two numbers
|      example { assert_equal(2, Adder.new.add(1, 1)) }
|      def add(a, b)
|        a + b
|      end
|    end

Well, I say, I like the general idea of sub('::', '/') and all --making 
testing a dialect, if you will. But I can't say that I would want to use the 
above b/c
  
  1. Adds a performance hit (albeit small).
  2. Detracts from the code itself.
  3. Not really an example, but a test.
  4. There can be tens to hundreds of tests.
  5. How does it know that example goes to that method,
     other then occurring before it.
  6. I would prefer to see improvement in test 
     "comprehension" over other changes.

To offer some contrast, here's is a sample concept inspired a bit by my AOP 
work.

    class Adder
      # Adds two numbers
      def add(a, b)
        a + b
      end
    end

    class Testing::Adder < Adder
      def add
        assert("add failure") { _equal 2, super(1, 1) }
      end
    end

Notice I did not have to specify 'include Testing'. It may be able to be can 
be automatically included "behind the scenes" simply be using the Testing:: 
namespace.

It's not dialectic, but it does integrate better while still allowing good 
SOC.

Just some thoughts,
T.