5 #include "test-utils.h"
6 #include "rb-file-helpers.h"
11 test_get_short_path_name (const char *in
, const char *expected
)
15 out
= rb_uri_get_short_path_name (in
);
16 rb_debug ("extracting short path from \"%s\", expecting \"%s\", got \"%s\"", in
, expected
, out
);
17 fail_unless (strcmp (out
, expected
) == 0);
21 START_TEST (test_rb_uri_get_short_path_name
)
28 out
= rb_uri_get_short_path_name (in
);
29 fail_unless (out
== NULL
);
32 /* just a file name */
33 test_get_short_path_name ("something.ogg", "something.ogg");
35 /* relative file name */
36 test_get_short_path_name ("x/something.ogg", "something.ogg");
39 test_get_short_path_name ("/var/lib/something.ogg", "something.ogg");
41 /* URI with a single path component */
42 test_get_short_path_name ("file://something.ogg", "something.ogg");
44 /* URI with multiple path components */
45 test_get_short_path_name ("file:///home/nobody/something.ogg", "something.ogg");
47 /* URI with query string */
48 test_get_short_path_name ("http://example.com/something.ogg?q=z&h=w", "something.ogg");
50 /* non-standard URI protocol */
51 test_get_short_path_name ("daap://10.0.0.1:3523/databases/1/items/46343.ogg", "46343.ogg");
53 /* non-standard URI protocol with query string */
54 test_get_short_path_name ("daap://10.0.0.1:3523/databases/1/items/46383.ogg?session=2463435", "46383.ogg");
57 test_get_short_path_name ("/usr/share/nothing/", "nothing");
62 rb_file_helpers_suite ()
64 Suite
*s
= suite_create ("rb-file-helpers");
65 TCase
*tc_chain
= tcase_create ("rb-file-helpers-core");
67 suite_add_tcase (s
, tc_chain
);
69 tcase_add_test (tc_chain
, test_rb_uri_get_short_path_name
);
75 main (int argc
, char **argv
)
81 rb_profile_start ("rb-file-helpers test suite");
85 gtk_init (&argc
, &argv
);
88 rb_file_helpers_init ();
93 s
= rb_file_helpers_suite ();
94 sr
= srunner_create (s
);
95 srunner_run_all (sr
, CK_NORMAL
);
96 ret
= srunner_ntests_failed (sr
);
99 rb_file_helpers_shutdown ();
100 gnome_vfs_shutdown ();
102 rb_profile_end ("rb-file-helpers test suite");