Skip to content

Commit

Permalink
test: Add tests for 'ocitools generate' and --output
Browse files Browse the repository at this point in the history
Signed-off-by: W. Trevor King <wking@tremily.us>
  • Loading branch information
wking committed Aug 3, 2016
1 parent 8cacd9e commit 0156c14
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ And read the `Makefile` source to find other useful targets

0 - Global ocitools options.

1 - `ocitools generate`.

## Dependencies

* [GNU Core Utilities][coreutils] for [`cat`][cat.1],
Expand Down
26 changes: 26 additions & 0 deletions test/t1000-generate-output.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/sh

test_description='Test generate output'

. ./sharness.sh

test_expect_success CAT,HEAD 'Test ocitools generate writing to stdout' "
ocitools generate | head -n2 >actual &&
cat <<EOF >expected &&
{
\"ociVersion\": \"1.0.0-rc1\",
EOF
test_cmp expected actual
"

test_expect_success CAT,HEAD 'Test ocitools generate --output' "
ocitools generate --output config.json &&
head -n2 config.json >actual &&
cat <<EOF >expected &&
{
\"ociVersion\": \"1.0.0-rc1\",
EOF
test_cmp expected actual
"

test_done

0 comments on commit 0156c14

Please sign in to comment.