aiiie / cram

Functional tests for command line applications
GNU General Public License v2.0
199 stars 51 forks source link

How to test for a command output line that matches the shell pattern? #33

Open meepyx opened 5 years ago

meepyx commented 5 years ago

I need to test for a line of command output that starts with "$ ". But this is exactly the pattern that cram uses to run commands in a shell. How do I do it?

Perhaps cram needs to be taught to make an exception for lines starting with two spaces then "$ " and ending with something like "(nocmd)", so it treats them as command output as well rather than trying to run them as shell commands?

roman-neuhauser commented 4 years ago

Dram (https://git.sr.ht/~rne/dram) provides a workaround, and I intend to make the prompts configurable.

$ printf '$ ugh\n'
[$] ugh (glob)