index-webjump: insist on completions being available
[conkeror.git] / tests / simple / utils.js
blob467a8cf237c3ba71ee82168d0324a29d777d7d57
2 require('walnut.js');
4 walnut_run({
5     test_remove_duplicates_filter_1: function () {
6         var ar = [1, 2, 3, 3];
7         assert_objects_equal(ar.filter(remove_duplicates_filter()), [1, 2, 3]);
8     },
9     test_get_home_directory_1: function () {
10         assert(get_home_directory() instanceof Ci.nsIFile);
11     },
12     test_make_uri_1: function () {
13         assert(make_uri("http://example.com/") instanceof Ci.nsIURI);
14     },
15     test_make_uri_2: function () {
16         assert(make_uri(make_file("/a/b/c")) instanceof Ci.nsIURI);
17     },
18     test_make_uri_3: function () {
19         assert_equals(make_uri(make_file("/a/b/c")).spec.substr(0,5), "file:");
20     },
21     test_splice_range_1: function () {
22         assert_objects_equal(splice_range([[1,3],[4,6],[7,10]], 2, 8),
23                              [[1,10]]);
24     }
25 });
27 walnut_run({
28     test_string_format_1: function () {
29         assert_equals(string_format("", {}),
30                       "");
31     },
32     test_string_format_2: function () {
33         assert_equals(string_format("%a", {a: 'hello'}),
34                       "hello");
35     },
36     test_string_format_3: function () {
37         assert_equals(string_format("%a%a", {a: 'hello'}),
38                       "hellohello");
39     }
40 });