diff --git a/tests/scripts/data.txt b/tests/scripts/data.txt new file mode 100644 index 0000000..29c358c --- /dev/null +++ b/tests/scripts/data.txt @@ -0,0 +1,4 @@ +Cloud +Linux +Fedora +Fedoraaa diff --git a/tests/scripts/run_tests.sh b/tests/scripts/run_tests.sh new file mode 100755 index 0000000..faf256a --- /dev/null +++ b/tests/scripts/run_tests.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +check_pkg() { + local pkg=$1 + if rpm -q $pkg + then + echo "PASS" + else + echo "FAIL" + fi +} + +check_dict() { + if [ -f "/usr/share/myspell/de_DE.dic" ] + then + echo "PASS" + else + echo "FAIL" + fi +} + +check_misspelled_word() { + VAR1="Fedoraaa" + VAR2=$(hunspell -l data.txt) + if [ "$VAR1" = "$VAR2" ]; then + echo "PASS" + else + echo "FAIL" + fi +} + +check_misspelled_line() { + VAR1="Fedoraaa" + VAR2=$(hunspell -L data.txt) + if [ "$VAR1" = "$VAR2" ]; then + echo "PASS" + else + echo "FAIL" + fi +} + +check_correct_word() { + VAR1="Cloud\nLinux\nFedora" + VAR1=$(echo -e "$VAR1") + VAR2=$(hunspell -G data.txt) + if [ "$VAR1" = "$VAR2" ]; then + echo "PASS" + else + echo "FAIL" + fi +} + +check_pkg "hunspell" +check_pkg "hunspell-de" +check_dict +check_misspelled_word +check_misspelled_line +check_correct_word + diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..63054d2 --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,12 @@ +- hosts: localhost + tags: + - classic + roles: + - role: standard-test-basic + required_packages: + - hunspell + - hunspell-de + tests: + - simple: + dir: scripts + run: ./run_tests.sh