RFR: 8270836: Foolproof JavadocTester.checkOutput [v2]

Jonathan Gibbons jjg at openjdk.java.net
Fri Jul 16 14:44:27 UTC 2021


On Fri, 16 Jul 2021 14:40:36 GMT, Pavel Rappo <prappo at openjdk.org> wrote:

>> When searching output for multiple strings it is easy to misexpress your intent, which could make a failing test pass. Such cases can be caught and reported to the programmer.
>> 
>> For example, for this search to succeed it is sufficient for the output to consist only of the `"error: bad"` string:
>> 
>> 
>> checkOutput(..., "error:", "error: bad", ...)
>
> Pavel Rappo has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Improve the test

test/langtools/jdk/javadoc/lib/javadoc/tester/JavadocTester.java line 568:

> 566:         }
> 567:         return false;
> 568:     }

Interesting trade off in performance:
* either create sorted array and do `o(N)` scan 
* or just do `o(N^2)` scan

test/langtools/jdk/javadoc/lib/javadoc/tester/JavadocTester.java line 579:

> 577:         return i == a.length();
> 578:     }
> 579: 

Why not `String.startsWith` ?

-------------

PR: https://git.openjdk.java.net/jdk/pull/4811


More information about the javadoc-dev mailing list