The problem is that Test::More has also added my explain function. explain is very handy in tests because it lets you do this:
It's like diag(), but only outputs when the tests are run in verbose mode. Thus, if you do make test, you won't see a bunch of irrelevant information dumped to the terminal. Further, it automatically calls Data::Dumper::Dumper() on references so programmers no longer curse when they see this:
It's a very handy tool in testing, but Schwern was concerned that it was doing too much. What if you want to automatically expand the references, even when you're not in verbose mode? There's a great argument for this:
isa_ok $some_object, "Some::Class" or diag explain $some_object;
If there's a failure, you might want to see it right away. So in Test::More, explain just formats the data and you have to call one of the following:
diag explain $some_data; # always appears
note explain $some_data; # only appears in verbose mode
That covers everything. I felt that a simple explain $some_data was the common case and I wanted to optimize for that. Schwern argued that it was trying to do too much and wanted the separation of concerns. That's a very reasonable argument, but what Schwern and I both missed was what Gabor pointed out. It breaks the Test::Simple to Test::More to Test::Most upgrade path. The functions behave differently and Test::Most is no longer a drop in replacement.
So let's take this to its logical conclusion (with apologies to Schwern for this fun
diag() formats your data and outputs it to the diagnostic filehandle (typically STDERR). But wait! It's doing too much and we should separate the formatting from the displaying. Since we can't just print it (we need to make sure it goes to the correct handle), we do this:
output diag explain $some_data;
Oh, that fails. Because output() doesn't know if it's outputting TAP or diagnostics, we need this:
output diagnostics diag explain $some_data;
Shove a few colons in there and we can call this a DSL!
However, what we really want is respect. We want this from the Java programmers. So with some Acme::Dot love, we can do this:
Now those Java programmers are going to take us seriously!
I want explain $some_data; to just work.