- From: James Graham <jgraham@opera.com>
- Date: Mon, 06 Dec 2010 14:02:36 +0100
- To: Maciej Stachowiak <mjs@apple.com>
- CC: "'public-html-testsuite@w3.org'" <public-html-testsuite@w3.org>
On 12/01/2010 12:54 PM, James Graham wrote: > So an API improvement to make writing the kind of test in your example > easier would be satisfactory? Rather than making specific API for the > run-a-test-with-a-single-assert-and-no-other-code case, a possibility > would be to have a generate_tests() function. You would pass this a > function, and an array containing parameters to pass to the function > call e.g. > > generate_tests(assert_equals, [ > [1+1,2], > [2+3,5]]) > > This would generalize better since one could pass in a custom written > function that did more than a simple assert_* FWIW I made a simple implementation of this and used it to write some tests that did indeed have more to them than a simple assert_ but could be (trivially) factored into a form where they differed only in the input parameters to a function. It seemed pretty usable to me, but I may not be the best judge of code/api aesthetics.
Received on Monday, 6 December 2010 13:03:17 UTC