laziness, impatience, and hubris | |
PerlMonks |
Solved: Testing an interactive script with EOF on inputby mamawe (Sexton) |
on Oct 12, 2011 at 08:09 UTC ( [id://930929]=perlquestion: print w/replies, xml ) | Need Help?? |
mamawe has asked for the wisdom of the Perl Monks concerning the following question: Hi all, The solution I've taken is in my comment further down. I have a module that contains an interactive script. For this script I would like to write a regression test for the behaviour on EOF of the input (it should exit cleanly with a defined output). My first idea was, to use IPC::Open2 as written in perlipc. But then I would have to implement some timer to make sure the script exits at all. My next idea was, to try something with Expect. But I can't see a way to close stdin for the process within Expect. So that's where I am, any hints/suggestions appreciated. Mathias Update. To make it more clear here is some code. Given this scriptand this test I get mostly what I want. I see the following problems:
Back to
Seekers of Perl Wisdom
|
|