Merge branch 'xmlgen-bug-fixes'
[ShellArchive.git] / bookmarker.etest
blob00b12443d946b89cce9858f951a4f01182b133eb
1 (etest
2  ("Basic, no replacement"
3   (like (with-mock
4           (stub bookmarker-get-bookmarks => '(("One" . "http://www.one.com")))
5           (bookmarker-expand-url "One"))
6         "http://www.one.com"
7         "No replacement occurs"))
8  ("Replacements"
9   (like (with-mock
10           (stub read-from-minibuffer => "a string")
11           (stub bookmarker-get-bookmarks => '(("One" . "http://www.one.com?q=%{first}")))
12           (bookmarker-expand-url "One"))
13         "http://www.one.com\\?q=a%20string"
14         "One, simple replacement works")
15   (like (with-mock
16           (stub read-from-minibuffer => "a string")
17           (stub bookmarker-get-bookmarks => '(("One" . "http://www.one.com?q=%{first}&j=%{blah}")))
18           (bookmarker-expand-url "One"))
19         "http://www.one.com\\?q=a%20string&j=a%20string"
20         "Two replacements work"))
21  ("Bad replacement"
22   (like (with-mock
23           (stub read-from-minibuffer => "HELLO WORLD")
24           (stub bookmarker-get-bookmarks => '(("One" . "http://www.one.com?q=%{first}&j=%{blah}")))
25           (bookmarker-expand-url "One"))
26         "http://www.one.com\\?q=HELLO%20WORLD&j=HELLO%20WORLD"
27         "Once failing test case works")))