new module to enable editing and deleting of bookmarks
[conkeror/arlinius.git] / tests / simple / uri.js
blob21ab4179294b233c94165a8ee124c6ca51f57a4b
2 require('walnut.js');
4 walnut_run({
5     test_make_uri_1: function () {
6         assert(make_uri("chrome://conkeror/content/conkeror.js"));
7     },
8     test_make_uri_2: function () {
9         assert(make_uri("http://www.example.com/"));
10     },
11     test_make_uri_3: function () {
12         assert_error(function () { make_uri("chrome://conkeror"); });
13     },
14     test_make_uri_4: function () {
15         assert(make_uri("http://example.com/") instanceof Ci.nsIURI);
16     },
17     test_make_uri_5: function () {
18         assert(make_uri(make_file("/a/b/c")) instanceof Ci.nsIURI);
19     },
20     test_make_uri_6: function () {
21         assert_equals(make_uri(make_file("/a/b/c")).spec.substr(0,5), "file:");
22     }
23 });
25 walnut_run({
26     test_compute_up_url_1: function () {
27         assert_equals(compute_up_url(make_uri("http://example.com/")),
28                       "http://example.com/");
29     },
30     test_compute_up_url_2: function () {
31         assert_equals(compute_up_url(make_uri("http://example.com/foo")),
32                       "http://example.com/");
33     },
34     test_compute_up_url_3: function () {
35         assert_equals(compute_up_url(make_uri("about:config")),
36                       "about:config");
37     },
38     test_compute_up_url_4: function () {
39         assert_equals(compute_up_url(make_uri("http://example.com/foo#bar")),
40                       "http://example.com/foo");
41     },
42     test_compute_up_url_5: function () {
43         assert_equals(compute_up_url(make_uri("http://example.com/foo?baz=quux#bar")),
44                       "http://example.com/foo?baz=quux");
45     },
46     test_compute_up_url_6: function () {
47         assert_equals(compute_up_url(make_uri("http://example.com/foo?baz=quux")),
48                       "http://example.com/foo");
49     }
50 });