Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Are "here documents" supported? #46

Open
srasku opened this issue Jun 15, 2022 · 1 comment
Open

Are "here documents" supported? #46

srasku opened this issue Jun 15, 2022 · 1 comment

Comments

@srasku
Copy link

srasku commented Jun 15, 2022

This didn't work but maybe I setup something wrong.

$ cat test/here-doc.t
  $ ls -a
  .
  ..
  $ cat >> config <<-EOF
        [section]
        name=value
  EOF
  $ cat config
  [section]
  name=value


$ cram -i test/here-doc.t
!
--- test/here-doc.t
+++ test/here-doc.t.err
@@ -4,7 +4,4 @@
   $ cat >> config <<-EOF
        [section]
        name=value
-  EOF
   $ cat config
-  [section]
-  name=value
Accept this change? [yN]

I have version 0.7 installed via pip

$ cram --version
Cram CLI testing framework (version 0.7)

Copyright (C) 2010-2016 Brodie Rao <[email protected]> and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
@tsibley
Copy link

tsibley commented Jul 22, 2022

@srasku Ran across this and have an answer for you since I'd figured out heredocs in cram a while back.

$ cat /tmp/heredoc.t 
Heredocs are supported, but you must still use cram's command continuation char (>):

  $ cat >config <<-EOF
  > [section]
  > name=value
  > EOF

  $ cat config
  [section]
  name=value
$ cram /tmp/heredoc.t 
.
# Ran 1 tests, 0 skipped, 0 failed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants