| #!/bin/bash |
| # |
| |
| # Simple test for `example_suggestions`. |
| |
| source googletest.sh || exit 1 |
| |
| # Find input files |
| TEST_BINARY="${TEST_SRCDIR}//sandbox/example_suggestions" |
| |
| AFFIX_FILE="${TEST_SRCDIR}//tests/base.aff" |
| readonly AFFIX_FILE |
| DICT_FILE="${TEST_SRCDIR}//tests/base.dic" |
| readonly DICT_FILE |
| INPUT_FILE="${TEST_TMPDIR}/input.txt" |
| readonly INPUT_FILE |
| OUTPUT_FILE="${TEST_TMPDIR}/output.txt" |
| readonly OUTPUT_FILE |
| |
| echo "hlleo" > ${INPUT_FILE} |
| |
| ${TEST_BINARY} \ |
| --affix_file="${AFFIX_FILE}" \ |
| --dict_file="${DICT_FILE}" \ |
| --in_file="${INPUT_FILE}" 2> "${OUTPUT_FILE}" || die "Failed example_suggestions" |
| |
| grep -q "hello" "${OUTPUT_FILE}" || die "Unable to find corrected word" |
| |
| echo "PASS" |