cram icon indicating copy to clipboard operation
cram copied to clipboard

Add simple shell variable expansion to the test case output

Open jan-matejka opened this issue 7 years ago • 1 comments

hi, I have not given this much thought yet but it would probably be nice to have a simple shell expansion in the test case.

For example when tesing a command based on git I have a test case like

  $ . ${TESTDIR}/setup
  $ my-cmd
  Initialized empty Git repository in /tmp/cramtests*/git-wc/.git/ (glob)

while with the available expansion I could have

  $ . ${TESTDIR}/setup
  $ my-cmd
  Initialized empty Git repository in ${GIT_WORK_TREE}/.git/

or possibly

  $ . ${TESTDIR}/setup
  $ my-cmd
  Initialized empty Git repository in ${GIT_WORK_TREE}/.git/ (expand)

note, in this case GIT_WORK_TREE is exported by the ${TESTDIR}/setup command as an input variable for my-cmd

In general I expect this to be helpfull wherever the command output is based on an env variable and supporting only the most basic expansion like ${VAR}, no ${VAR:-foo} etc would go a long way.

jan-matejka avatar May 12 '17 18:05 jan-matejka

how should Cram deal with multiline values?

roman-neuhauser avatar Nov 10 '20 07:11 roman-neuhauser