For Programmers: Free Programming Magazines  


Home > Archive > PHP Questions and Answers > June 2007 > Re: [PHP-QA] Updates to the QA web site









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PHP-QA] Updates to the QA web site
Antony Dovgal

2007-06-04, 7:58 am

On 04.06.2007 14:28, Zoe Slattery wrote:
> Hi all
>
> I recently spent some time understanding (with a lot of help from Marcus
> :-)) how to use the --CLEAN-- section in run-tests.php. I fell into a
> couple traps on the way and wanted to document them on the qa web site
> so I've added a section on cleaning up after running tests. Please would
> you review it and let me know if you would like any changes before I
> commit it?
>
> The draft is in here:
>
> http://zoe.soal.org/write-test.php


I personally don't really like the part that tells how to use basename() - IMO it's a bit overcomplicated.
I believe it's much easier to write "fred.tmp" twice than strip suffixes and do other magical stuff just to save few keystrokes.
So I'd propose to avoid frightening people with this stuff and go the easiest route =)

The other parts look fine, here is the diff:
http://dev.daylessday.org/diff/write_tests_clean.diff

--
Wbr,
Antony Dovgal
Zoe Slattery

2007-06-04, 6:58 pm

Antony Dovgal wrote:
>
> I personally don't really like the part that tells how to use
> basename() - IMO it's a bit overcomplicated. I believe it's much
> easier to write "fred.tmp" twice than strip suffixes and do other
> magical stuff just to save few keystrokes.
> So I'd propose to avoid frightening people with this stuff and go the
> easiest route =)

Yes - I admit that I wasn't sure about that, although I wasn't trying to
save keystrokes. The logic for puttting it in was that (a) it was
suprisingly hard to work out how to do it and if I wanted to I guess
someone else might, (b) if all test cases generate "fred.tmp" it will be
a pain trying to find out which of them has not removed it correctly :-)

I think you are right since it's not a construct that is partucularly
easy to understand if you are trying to read someone else's test. How
about I remove the example but add some text suggesting that people
call the temporary files by some name that relates them to the test case?

I guess if there is a re-write of run-tests.php it might be nice if this
was a little easier to do?
>
> The other parts look fine, here is the diff:
> http://dev.daylessday.org/diff/write_tests_clean.diff
>

Thanks!
Antony Dovgal

2007-06-04, 6:58 pm

On 04.06.2007 18:48, Zoe Slattery wrote:
> Antony Dovgal wrote:
> Yes - I admit that I wasn't sure about that, although I wasn't trying to
> save keystrokes. The logic for puttting it in was that (a) it was
> suprisingly hard to work out how to do it and if I wanted to I guess
> someone else might, (b) if all test cases generate "fred.tmp" it will be
> a pain trying to find out which of them has not removed it correctly :-)
>
> I think you are right since it's not a construct that is partucularly
> easy to understand if you are trying to read someone else's test. How
> about I remove the example but add some text suggesting that people
> call the temporary files by some name that relates them to the test case?


Sounds ok to me.
(for me it's obvious, but ok, I'm not an average user..)

--
Wbr,
Antony Dovgal
Zoe Slattery

2007-06-04, 6:58 pm

Antony Dovgal wrote:
>
> Sounds ok to me.
> (for me it's obvious, but ok, I'm not an average user..)
>

Indeed :-)

I'll go ahead - thanks for your help.

Zoe Slattery
IBM
Antony Dovgal

2007-06-04, 6:58 pm

On 04.06.2007 23:56, Zoe Slattery wrote:
> Antony Dovgal wrote:
> Indeed :-)
>
> I'll go ahead - thanks for your help.


No, thanks to *you* =)

--
Wbr,
Antony Dovgal
Marcus Boerger

2007-06-04, 6:58 pm

Hello Zoe,

"not particular easy to understand".... that's why sometimes we write
documentation. As much as simply use a hardcoded filename is pretty nice it
comes with some small risks - copy'n'paste. And actually if you tell people
to use the same two lines in their code it is in the same way easy enough.
So the issue here with hardcoded names is that you might run more than
one test and then get with your results and intermediate files.

best regards
marcus

Monday, June 4, 2007, 4:48:50 PM, you wrote:

> Antony Dovgal wrote:
> Yes - I admit that I wasn't sure about that, although I wasn't trying to
> save keystrokes. The logic for puttting it in was that (a) it was
> suprisingly hard to work out how to do it and if I wanted to I guess
> someone else might, (b) if all test cases generate "fred.tmp" it will be
> a pain trying to find out which of them has not removed it correctly


> I think you are right since it's not a construct that is partucularly
> easy to understand if you are trying to read someone else's test. How
> about I remove the example but add some text suggesting that people
> call the temporary files by some name that relates them to the test case?


> I guess if there is a re-write of run-tests.php it might be nice if this
> was a little easier to do?
> Thanks!





Best regards,
Marcus
Zoe Slattery

2007-06-07, 7:58 am

Marcus Boerger wrote:
> Hello Zoe,
>
> "not particular easy to understand".... that's why sometimes we write
> documentation. As much as simply use a hardcoded filename is pretty nice it
> comes with some small risks - copy'n'paste. And actually if you tell people
> to use the same two lines in their code it is in the same way easy enough.
> So the issue here with hardcoded names is that you might run more than
> one test and then get with your results and intermediate files.
>
> best regards
> marcus
>
>

I compromised. I took out the example that Tony objected to - honestly I
think it was ugly code - but I added a paragraph that suggests that
people use temporary file names that are in some way related to the test
case. I also refer to the run-tests.php --keep option so if anyone does
go the route that I initially went to name temporay files they know how
to debug it when it doesn't work :-)

I hope this meets both your and Tony's concerns, let me know if not.

My next plan is to add something about test case dependency on loaded
extensions. I noticed that (at least) on of ours depends on SPL and so I
think it needs something in the --SKIPIF--. I also noticed that Tony
corrected another one where we'd missed a similar check.

Zoe Slattery
IBM
Marcus Boerger

2007-06-08, 3:58 am

Hello Zoe,

Thursday, June 7, 2007, 12:17:48 PM, you wrote:

> Marcus Boerger wrote:
> I compromised. I took out the example that Tony objected to - honestly I
> think it was ugly code - but I added a paragraph that suggests that
> people use temporary file names that are in some way related to the test
> case. I also refer to the run-tests.php --keep option so if anyone does
> go the route that I initially went to name temporay files they know how
> to debug it when it doesn't work


> I hope this meets both your and Tony's concerns, let me know if not.


I just read your changes and they are perfectly fine with me.

thx for the work.

Best regards,
Marcus
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com