Re: run-tests.php , %a and diff files.

From: Date: Wed, 26 Sep 2007 21:39:23 +0000
Subject: Re: run-tests.php , %a and diff files.
References: 1  Groups: php.qa 
Request: Send a blank email to php-qa+get-47849@lists.php.net to get a copy of this message
Hi, I'm aware that the current diff algorithm is not very smart. And I'm also aware that it can become very annoying (I also write many tests myself).. Anyway I don't have much time to work on that. If you feel brave, please try to come up with a patch an we'll review it. If not, well, you can wait until my next time slot for these kind of things (not soon though). Nuno ----- Original Message ----- From: "Zoe Slattery" <zoe.slattery@googlemail.com> To: <helly@php.net>; <nlopess@php.net> Cc: <qa@lists.php.net> Sent: Wednesday, September 26, 2007 5:33 PM Subject: run-tests.php , %a and diff files.
Hi Marcus & Nuno I think that there might be one more small piece of fixing up that could be done to run-tests.php to go with the %a option. The problem is in the code that is run to generate the diff file (generate_array_diff and comp_line). Because these functions do a line-by-line comparision each %a matches one line and any further lines are assumed to be incorrect and added to the diff file. Here is a simple example. The only reason that this test fails is that I've added an extra space after the word reiger on line one of the PHP code. --TEST-- tiger test --FILE-- <?php echo "there was a young lady from reiger \n"; echo "who went for a ride on a tiger\n"; echo "they came back from the ride\n"; echo "with the lady inside\n"; echo "and a smile on the face of the tiger\n"; ?> --EXPECTF-- there was a young lady from reiger who went for a ride on a tiger %a and a smile on the face of the tiger The diff file that is produced looks like this: 001+ there was a young lady from reiger 001- there was a young lady from reiger 004+ with the lady inside The line 004+ appears because the %a matches line 3 and line 4 is assumed to be an error. This doesn't matter too much in a small test but if %a is matching a lot of lines and has been used more than once in the test case the diff file looks pretty wild. I'm not sure about the best way to fix this - I think it will affect a small number of people but when it does happen it's very hard to see what is really wrong with the test case. Thoughts? Zoe Slattery


« previous php.qa (#47849) next »