OLD | NEW |
(Empty) | |
| 1 #!/bin/bash |
| 2 |
| 3 ## Include utility functions. |
| 4 . "$XDG_TEST_DIR/include/testassertions.sh" |
| 5 . "$XDG_TEST_DIR/include/testcontrol.sh" |
| 6 |
| 7 ## Test function |
| 8 test_double_mime_install() { |
| 9 # TODO: should follow the filename tests. |
| 10 |
| 11 ## Begin the test. |
| 12 test_start "$FUNCNAME: verify installing an existing mime type is OK" |
| 13 |
| 14 # Dependencies section |
| 15 test_init |
| 16 |
| 17 require_notroot |
| 18 |
| 19 use_file "$XDG_TEST_DIR/xdg-mime/data/testmime.xml" INPUT_FILE |
| 20 edit_file "$INPUT_FILE" "x-xdg-testpattern" TEST_MIME "x-$XDG_TEST_ID" |
| 21 assert_file "$INPUT_FILE" |
| 22 echo "text/$TEST_MIME" >testmime.expected |
| 23 |
| 24 echo "Some text." >testfile.xdgtest |
| 25 assert_file testfile.xdgtest |
| 26 |
| 27 # Verify the test type is not installed already. |
| 28 assert_exit 0 xdg-mime install --mode user "$INPUT_FILE" |
| 29 assert_exit 0 xdg-mime query filetype testfile.xdgtest |
| 30 assert_stdout testmime.expected |
| 31 |
| 32 # Test steps section |
| 33 test_procedure |
| 34 |
| 35 assert_exit 0 xdg-mime install --mode user "$INPUT_FILE" |
| 36 assert_nostdout |
| 37 assert_nostderr |
| 38 |
| 39 assert_exit 0 xdg-mime query filetype testfile.xdgtest |
| 40 assert_stdout testmime.expected |
| 41 assert_nostderr |
| 42 |
| 43 # this is a cleanup step |
| 44 xdg-mime uninstall --mode user "$INPUT_FILE" >/dev/null 2>&1 |
| 45 |
| 46 test_result |
| 47 } |
| 48 run_test test_double_mime_install |
OLD | NEW |