

Test-driving your Javascript for fun and profit - mattbaker
http://eng.wealthfront.com/2011/01/test-driving-your-javascript-for-fun.html

======
demallien
_The first thing you’ll notice is that magical comment at the top of our test.
jsTestDriver takes a comment beginning with ":DOC +=" and adds the contents of
the comment as a DOM fragment to the page, allowing us to test against it.
It’s a simple and effective way of providing DOM fixtures to test any code
that does DOM manipulation._

OK, that is just gratuitous "magic". Nobody picking up that code to look at is
going to realise that the _comment_ is meaningful and necessary for the test.
What is the advantage of doing that instead of calling a function to do the
work, passing the DOM fragment as a parameter. Even if the parser that
currently uses the comment has to identify the function call and treat it in
the same way as the comment, at least by doing it as a function call, you have
signalled to any user that the comment is _significant_.

/rant

~~~
wccrawford
I agree. If you can change or delete comments the code stops working, there's
something wrong. It's totally unexpected.

