File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed
Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -8,3 +8,5 @@ __pycache__
88.DS_STORE
99.pytest_cache
1010/out /
11+ /tmp /
12+ * .log
Original file line number Diff line number Diff line change 1+ # /usr/bin/env bash
2+ set -e
3+ # set -x
4+
5+ echo " These tests expect cfengine CLI to be installed globally or in venv"
6+
7+ echo " Looking for CFEngine CLI:"
8+ which cfengine
9+
10+ echo " Check that input and expected files exist:"
11+ ls -al tests/format/* .input.cf
12+ ls -al tests/format/* .expected.cf
13+
14+ mkdir -p tmp
15+
16+ echo " Check that input files match expected files:"
17+ ls tests/format/* .input.cf > tmp/format-input-files.log
18+ ls tests/format/* .expected.cf > tmp/format-expected-files.log
19+ sed s/.input.cf/.cf/g tmp/format-input-files.log > tmp/a.log
20+ sed s/.expected.cf/.cf/g tmp/format-expected-files.log > tmp/b.log
21+ diff -u tmp/a.log tmp/b.log
22+
23+ echo " Run formatting tests:"
24+ for file in tests/format/* .input.cf; do
25+ expected=" $( echo $file | sed s/.input.cf/.expected.cf/g) "
26+ output=" $( echo $file | sed s/.input.cf/.output.cf/g) "
27+ echo " TODO: Implement formatting on stdin / stdout in cfengine format"
28+ cat $file | cfengine format - > $output
29+ diff -u $expected $output
30+ echo " OK: $file - $expected "
31+ done
32+
33+ echo " All formatting tests successful!"
You can’t perform that action at this time.
0 commit comments