diff options
| author | Alasdair Armstrong | 2020-09-27 02:10:52 +0100 |
|---|---|---|
| committer | GitHub | 2020-09-27 02:10:52 +0100 |
| commit | 882850db49cffef75e11eef8cf00364611e54e19 (patch) | |
| tree | 9601d70612d61b1144bc0c41106eee01e9beecf0 /test/test_helpers.sh | |
| parent | b73aaf6d7209d693e295abcc499fa2f759cb877e (diff) | |
| parent | cd32009738e05e4eb7f7e0e25ccf700525a7badb (diff) | |
Merge pull request #96 from arichardson/add-latex-tests-and-allow-external-links
Add latex tests and allow external links
Diffstat (limited to 'test/test_helpers.sh')
| -rw-r--r-- | test/test_helpers.sh | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/test_helpers.sh b/test/test_helpers.sh new file mode 100644 index 00000000..40d66f10 --- /dev/null +++ b/test/test_helpers.sh @@ -0,0 +1,36 @@ +RED='\033[0;91m' +GREEN='\033[0;92m' +YELLOW='\033[0;93m' +NC='\033[0m' + +pass=0 +fail=0 +XML="" + +function green { + (( pass += 1 )) + printf "%s: ${GREEN}$2${NC}\n" "$1" + XML+=" <testcase name=\"$1\"/>\n" +} + +function yellow { + (( fail += 1 )) + printf "%s: ${YELLOW}$2${NC}\n" "$1" + XML+=" <testcase name=\"$1\">\n <error message=\"$2\">$2</error>\n </testcase>\n" +} + +function red { + (( fail += 1 )) + printf "%s: ${RED}$2${NC}\n" "$1" + XML+=" <testcase name=\"$1\">\n <error message=\"$2\">$2</error>\n </testcase>\n" +} + +function finish_suite { + printf "%s: Passed ${pass} out of $(( pass + fail ))\n\n" "$1" + XML=" <testsuite name=\"$1\" tests=\"$(( pass + fail ))\" failures=\"${fail}\" timestamp=\"$(date)\">\n$XML </testsuite>\n" + # Note: we use echo -e to escape \n characters + echo -e "$XML" >> "$DIR/tests.xml" + XML="" + pass=0 + fail=0 +} |
