Debian Codegraph @

tests/xdg-mime/t.13-notexist_mime_uninstall

raw
1 #!/bin/bash
2
3 ## Include utility functions.
4 . "$XDG_TEST_DIR/include/testassertions.sh"
5
6 . "$XDG_TEST_DIR/include/testcontrol.sh"
7
8 ## Test function
9 test_notexist_mime_uninstall() {
10 # TODO: should follow the filename tests.
11 QUERY_FILE="testfile.xdgtest"
12
13 ## Begin the test.
14 test_start "$FUNCNAME: uninstall mime type that is not present"
15
16 # Dependencies section
17 test_init
18
19 require_notroot
20
21 use_file "$XDG_TEST_DIR/xdg-mime/data/testmime.xml" INPUT_FILE
22 edit_file "$INPUT_FILE" "x-xdg-testpattern" TEST_MIME "x-$XDG_TEST_ID"
23 assert_file $INPUT_FILE
24
25 echo "Some text." > $QUERY_FILE
26 assert_file "$QUERY_FILE"
27
28 # Install & verify mime type is installed
29 assert_exit 0 xdg-mime query filetype "$QUERY_FILE" >mimesave.expected
30
31 # Test steps section
32 test_procedure
33
34 assert_exit 0 xdg-mime uninstall --mode user "$INPUT_FILE"
35 assert_nostdout
36 assert_nostderr
37
38 ## Verify no change
39 assert_exit 0 xdg-mime query filetype "$QUERY_FILE"
40 assert_stdout mimesave.expected
41
42 test_result
43 }
44 run_test test_notexist_mime_uninstall