google / compile-testing

Testing tools for javac and annotation processors
Apache License 2.0
699 stars 119 forks source link

Pretty diffs #16

Open cgruber opened 11 years ago

cgruber commented 11 years ago

Long shot, and no urgent need, but diff-ish comparisons in a few areas would be nice - In the case of partial matches in withErrorContaining() the partial match could be expressed, with the delta being called out. similarly in the case of properly named, but content-differing generated sources. Some sort of diff of the sort similar to what Assert.assertEquals(String,String) does would be the idea, from a UI perspective.

gk5885 commented 11 years ago

I had considered such a thing. The biggest issue is that equality is compared using the AST, but diffs are text-based. I'd hate to show an error that is full of differences that we don't actually use for the test. That said, we could certainly have the EqualityScanner collect and display some information about node differences.

cgruber commented 11 years ago

Yeah - node comparisons was far more what I had in mind. I didn't mean text diffs, I meant conceptual diffs.

ronshapiro commented 5 years ago

@cpovirk mentioned internally that running the code through google-java-format could be a good way to normalize for diffing