On Jan 18, 2008, at 19:39 PM, Phlip wrote:
> Eric Hodel wrote:
>> Is all this XML necessary?  I don't see any nested markup, and  
>> having to figure out XPATH plus RDoc to add new tests seems like  
>> overkill.  Testing RDoc::Generator::HtmlMethod#markup_code directly  
>> without any XML/XPATH will be much simpler and easier to understand  
>> by anyone who wants to expand the tests.
>
> Testing HTML via XPath is a best practice.

It also involves around 4x more code than assert_equal, which is the  
simplest thing that could possibly work.

> As your HTML gets sicker, you can write sicker XPaths to match it.

YAGNI says assert_equal will work just fine for this case.

>> That said, I'm really not sure what is being tested here.  The  
>> test's class is RDocFormatTest, and there's a test_format method,  
>> but there's no other mention of formats anywhere.  It appears to me  
>> you're testing HTMLMethod#markup_code, but I could be wrong.  Maybe  
>> with all the parsing stuff, you're really testing the parser?
>
> Per the Subject line, I was researching how to set up the objects to  
> convert arbitrary Ruby into its pretty-printed output. (And I am  
> aware there are real pretty-printers out there.)

So, maybe this should go in sample/rdoc instead?