| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
. "$XDG_TEST_DIR/include/testassertions.sh" |
| 4 |
. "$XDG_TEST_DIR/include/testcontrol.sh" |
| 5 |
|
| 6 |
test_query_text_plain() { |
| 7 |
# TODO: expand to cover file weirdness. |
| 8 |
INPUT_FILE='testfile.txt' |
| 9 |
|
| 10 |
test_start "$FUNCNAME: verify a query against $INPUT_FILE returns 'text/plain'" |
| 11 |
test_purpose "Verify that the basic query (text/plain) is working." |
| 12 |
|
| 13 |
## Check dependencies |
| 14 |
test_init |
| 15 |
|
| 16 |
require_notroot |
| 17 |
|
| 18 |
echo 'This is some text.' > $INPUT_FILE |
| 19 |
assert_file "$INPUT_FILE" |
| 20 |
|
| 21 |
echo 'text/plain' > out.plain |
| 22 |
|
| 23 |
## Main test |
| 24 |
test_procedure |
| 25 |
|
| 26 |
assert_exit 0 xdg-mime query filetype "$INPUT_FILE" |
| 27 |
assert_stdout out.plain |
| 28 |
assert_nostderr |
| 29 |
|
| 30 |
|
| 31 |
test_result |
| 32 |
} |
| 33 |
|
| 34 |
run_test test_query_text_plain |