[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/markdown-mode 799a8e9 3/8: Fix tests
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/markdown-mode 799a8e9 3/8: Fix tests |
Date: |
Thu, 21 Oct 2021 20:57:50 -0400 (EDT) |
branch: elpa/markdown-mode
commit 799a8e91d878d81643627edbb4a30daa9130124e
Author: Shohei YOSHIDA <syohex@gmail.com>
Commit: Shohei YOSHIDA <syohex@gmail.com>
Fix tests
---
.gitignore | 1 +
tests/markdown-test.el | 45 +++++++++++++++++++---------------
tests/wiki/pr666/Foo.md | 0
tests/wiki/pr666/jump_wiki_link.md | 1 +
tests/wiki/pr666/wiki_link_in_table.md | 1 +
5 files changed, 28 insertions(+), 20 deletions(-)
diff --git a/.gitignore b/.gitignore
index d24783d..3db2449 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
*.elc
index.text
+*~
diff --git a/tests/markdown-test.el b/tests/markdown-test.el
index f0a08fd..4c7d92a 100644
--- a/tests/markdown-test.el
+++ b/tests/markdown-test.el
@@ -1558,32 +1558,37 @@ the opening bracket of [^2], and then subsequent
functions would kill [^2])."
(markdown-footnote-kill)
(should (string-equal (current-kill 0) "foo\n")))))
-(ert-deftest test-markdown-do/jump-wikilink ()
+(ert-deftest test-markdown-do/jump-wiki-link ()
"Test `markdown-do' jumps to wiki links"
- (markdown-test-string
- "[[Foo]]"
- (goto-char 3) ; Foo
- (markdown-do) ; open Foo.md
- (should (string= (buffer-string) ""))))
+ (with-current-buffer (find-file-noselect "wiki/pr666/jump_wiki_link.md")
+ (let ((markdown-enable-wiki-links t))
+ (goto-char 3)
+ (markdown-do)
+ (should (string= (buffer-name) "Foo.md")))))
(ert-deftest test-markdown-do/jump-link ()
"Test `markdown-do' jumps to markdown links"
- (markdown-test-string
- "[bar](https://duckduckgo.com)"
- (goto-char 3) ; Foo
- (markdown-do) ; open browser
- (should (string= (buffer-string) ""))))
+ (markdown-test-string "[bar](https://duckduckgo.com)"
+ (let* ((opened-url nil)
+ (browse-url-browser-function
+ (lambda (url &rest _args) (setq opened-url url))))
+ (goto-char 3)
+ (markdown-do)
+ (should (string= opened-url "https://duckduckgo.com")))))
-(ert-deftest test-markdown-do/wikilink-in-table ()
+(ert-deftest test-markdown-do/wiki-link-in-table ()
"Test `markdown-do' jumps to markdown links"
- (markdown-test-string
- "| [[Foo]] |"
- (goto-char 1) ; Table cell
- (markdown-do) ; align
- (should (string= (buffer-string) "| [[Foo]] |"))
- (goto-char 4) ; Foo
- (markdown-do) ; open Foo.md
- (should (string= (buffer-string) "| [[Foo]] |"))))
+ (with-current-buffer (find-file-noselect "wiki/pr666/wiki_link_in_table.md")
+ (let ((markdown-enable-wiki-links t))
+ ;; alignment
+ (markdown-do)
+ (should (string= (buffer-string) "| [[Foo]] |\n"))
+
+ (forward-char 4)
+
+ ;; wiki link
+ (markdown-do)
+ (should (string= (buffer-name) "Foo.md")))))
(ert-deftest test-markdown-footnote-reference/jump ()
"Test `markdown-do' for footnotes and reference links."
diff --git a/tests/wiki/pr666/Foo.md b/tests/wiki/pr666/Foo.md
new file mode 100644
index 0000000..e69de29
diff --git a/tests/wiki/pr666/jump_wiki_link.md
b/tests/wiki/pr666/jump_wiki_link.md
new file mode 100644
index 0000000..ea8532e
--- /dev/null
+++ b/tests/wiki/pr666/jump_wiki_link.md
@@ -0,0 +1 @@
+[[Foo]]
diff --git a/tests/wiki/pr666/wiki_link_in_table.md
b/tests/wiki/pr666/wiki_link_in_table.md
new file mode 100644
index 0000000..df6742f
--- /dev/null
+++ b/tests/wiki/pr666/wiki_link_in_table.md
@@ -0,0 +1 @@
+| [[Foo]] |
- [nongnu] elpa/markdown-mode updated (7360efc -> c3c2f0d), ELPA Syncer, 2021/10/21
- [nongnu] elpa/markdown-mode d917e71 1/8: extend markdown-do to follow links, ELPA Syncer, 2021/10/21
- [nongnu] elpa/markdown-mode fc729ea 2/8: WIP: fix+add tests for markdown-do link jump, ELPA Syncer, 2021/10/21
- [nongnu] elpa/markdown-mode 799a8e9 3/8: Fix tests,
ELPA Syncer <=
- [nongnu] elpa/markdown-mode 0a9ee2b 4/8: Update Changes, ELPA Syncer, 2021/10/21
- [nongnu] elpa/markdown-mode 1c459f7 7/8: Merge pull request #667 from jrblevin/markdown-do-follow-links, ELPA Syncer, 2021/10/21
- [nongnu] elpa/markdown-mode 981e48c 5/8: Test following wiki link to nonexistent file works, ELPA Syncer, 2021/10/21
- [nongnu] elpa/markdown-mode bf7c4d8 6/8: Update CHANGES.md, ELPA Syncer, 2021/10/21
- [nongnu] elpa/markdown-mode c3c2f0d 8/8: Merge pull request #668 from edrex/test-wiki-link-follow-new-file, ELPA Syncer, 2021/10/21