How to test script that uses $EDITOR ?

B

bill

I have a script that at one point fires up $EDITOR (which can be
assumed to be Emacs for the purpose of this question) and gets some
deathless prose from the user. I have no idea how to write a test
script that could automate this interaction. Any suggestions would
be much appreciated.

By the way, what's the best way to write a command-line script so
that it is easily testable with test scripts? As I have it written
now, my test script would have to mess around with pipes, but I
imagine that I could conceivably (maybe) do something with require
and -t ?

-bill
 
B

Ben Morrow

Quoth bill said:
I have a script that at one point fires up $EDITOR (which can be
assumed to be Emacs for the purpose of this question) and gets some
deathless prose from the user. I have no idea how to write a test
script that could automate this interaction. Any suggestions would
be much appreciated.

Set $ENV{EDITOR} to a shell script that simply puts some text in the
file for the purposes of the test script.

Ben
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top