File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ WHEREAMI=$( dirname " $( realpath " $0 " ) " )
4+ export CABIN_TERM_COLOR=' never'
5+
6+ test_description=' Test the init command'
7+
8+ . $WHEREAMI /sharness.sh
9+
10+ test_expect_success ' cabin init' '
11+ OUT=$(mktemp -d) &&
12+ test_when_finished "rm -rf $OUT" &&
13+ mkdir $OUT/pkg &&
14+ cd $OUT/pkg &&
15+ "$WHEREAMI"/../build/cabin init 2>actual &&
16+ cat >expected <<-EOF &&
17+ Created binary (application) \`pkg\` package
18+ EOF
19+ test_cmp expected actual &&
20+ test -f cabin.toml
21+ '
22+
23+ test_expect_success ' cabin init existing' '
24+ OUT=$(mktemp -d) &&
25+ test_when_finished "rm -rf $OUT" &&
26+ mkdir $OUT/pkg &&
27+ cd $OUT/pkg &&
28+ "$WHEREAMI"/../build/cabin init 2>actual &&
29+ cat >expected <<-EOF &&
30+ Created binary (application) \`pkg\` package
31+ EOF
32+ test_cmp expected actual &&
33+ test -f cabin.toml
34+ test_must_fail "$WHEREAMI"/../build/cabin init 2>actual &&
35+ cat >expected <<-EOF &&
36+ Error: cannot initialize an existing cabin package
37+ Error: ' \' ' cabin init' \' ' failed with exit code \`1\`
38+ EOF
39+ test_cmp expected actual &&
40+ test -f cabin.toml
41+ '
42+
43+ test_done
You can’t perform that action at this time.
0 commit comments