[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/toc-org 501f36db68 021/128: Merge pull request #5 from ard
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/toc-org 501f36db68 021/128: Merge pull request #5 from ardumont/wrap-tests-definition |
Date: |
Sun, 2 Jan 2022 09:59:06 -0500 (EST) |
branch: elpa/toc-org
commit 501f36db6873967d01c0e848948c672ce54f5c77
Merge: 11be82816a f13f79737a
Author: Sergei Nosov <sergei.nosov@gmail.com>
Commit: Sergei Nosov <sergei.nosov@gmail.com>
Merge pull request #5 from ardumont/wrap-tests-definition
Wrap test calls with `(eval-after-load "ert-autoloads"...)
---
org-toc.el | 114 ++++++++++++++++++++++++++++++++-----------------------------
1 file changed, 59 insertions(+), 55 deletions(-)
diff --git a/org-toc.el b/org-toc.el
index aae3ee60b8..f90461ac3b 100644
--- a/org-toc.el
+++ b/org-toc.el
@@ -95,35 +95,36 @@ tags."
(buffer-substring-no-properties
(point-min) (point-max)))))
-(ert-deftest org-toc-test-raw-toc ()
- "Test the `org-toc-raw-toc' function"
-
- (defun org-toc-test-raw-toc-gold-test (content gold)
- (should (equal
- (with-temp-buffer
- (insert content)
- (org-toc-raw-toc))
- gold)))
-
- (let ((beg "* About\n:TOC:\n drawer\n:END:\n\norg-toc is a utility to have
an up-to-date table of contents in the\norg files without exporting (useful
primarily for readme files on\nGitHub).\n\nIt is similar to the
[[https://github.com/ardumont/markdown-toc][markdown-toc]] package, but works
for org files.\n:TOC:\n drawer\n:END:\n\n* Table of Contents
")
- (gold "* About\n"))
-
- ;; different TOC styles
- (org-toc-test-raw-toc-gold-test (concat beg ":TOC:" ) gold)
- (org-toc-test-raw-toc-gold-test (concat beg ":TOC_1:" ) gold)
- (org-toc-test-raw-toc-gold-test (concat beg ":TOC_1_qqq:" ) gold)
- (org-toc-test-raw-toc-gold-test (concat beg ":TOC@1:" ) gold)
- (org-toc-test-raw-toc-gold-test (concat beg ":TOC@1@cxv:" ) gold)
- (org-toc-test-raw-toc-gold-test (concat beg ":TOC@1_hello:" ) gold)
-
- ;; trailing symbols
- (org-toc-test-raw-toc-gold-test (concat beg ":TOC@1_hello:" "\n\n\n") gold)
- (org-toc-test-raw-toc-gold-test (concat beg ":TOC@1_hello:" "\n\n\nsdfd")
gold))
-
- ;; more complex case
- (org-toc-test-raw-toc-gold-test
- "* About\n:TOC:\n drawer\n:END:\n\norg-toc is a utility to have an
up-to-date table of contents in the\norg files without exporting (useful
primarily for readme files on\nGitHub).\n\nIt is similar to the
[[https://github.com/ardumont/markdown-toc][markdown-toc]] package, but works
for org files.\n:TOC:\n drawer\n:END:\n\n* Table of Contents
:TOC:\n - [[#about][About]]\n -
[[#use][Use]]\n - [[#different-href-styles][Different href st [...]
- "* About\n* Installation\n** via package.el\n** Manual\n* Use\n* Different
href styles\n* Example\n"))
+(eval-after-load "ert-autoloads"
+ (ert-deftest org-toc-test-raw-toc ()
+ "Test the `org-toc-raw-toc' function"
+
+ (defun org-toc-test-raw-toc-gold-test (content gold)
+ (should (equal
+ (with-temp-buffer
+ (insert content)
+ (org-toc-raw-toc))
+ gold)))
+
+ (let ((beg "* About\n:TOC:\n drawer\n:END:\n\norg-toc is a utility to have
an up-to-date table of contents in the\norg files without exporting (useful
primarily for readme files on\nGitHub).\n\nIt is similar to the
[[https://github.com/ardumont/markdown-toc][markdown-toc]] package, but works
for org files.\n:TOC:\n drawer\n:END:\n\n* Table of Contents
")
+ (gold "* About\n"))
+
+ ;; different TOC styles
+ (org-toc-test-raw-toc-gold-test (concat beg ":TOC:" ) gold)
+ (org-toc-test-raw-toc-gold-test (concat beg ":TOC_1:" ) gold)
+ (org-toc-test-raw-toc-gold-test (concat beg ":TOC_1_qqq:" ) gold)
+ (org-toc-test-raw-toc-gold-test (concat beg ":TOC@1:" ) gold)
+ (org-toc-test-raw-toc-gold-test (concat beg ":TOC@1@cxv:" ) gold)
+ (org-toc-test-raw-toc-gold-test (concat beg ":TOC@1_hello:" ) gold)
+
+ ;; trailing symbols
+ (org-toc-test-raw-toc-gold-test (concat beg ":TOC@1_hello:" "\n\n\n")
gold)
+ (org-toc-test-raw-toc-gold-test (concat beg ":TOC@1_hello:"
"\n\n\nsdfd") gold))
+
+ ;; more complex case
+ (org-toc-test-raw-toc-gold-test
+ "* About\n:TOC:\n drawer\n:END:\n\norg-toc is a utility to have an
up-to-date table of contents in the\norg files without exporting (useful
primarily for readme files on\nGitHub).\n\nIt is similar to the
[[https://github.com/ardumont/markdown-toc][markdown-toc]] package, but works
for org files.\n:TOC:\n drawer\n:END:\n\n* Table of Contents
:TOC:\n - [[#about][About]]\n -
[[#use][Use]]\n - [[#different-href-styles][Different href [...]
+ "* About\n* Installation\n** via package.el\n** Manual\n* Use\n*
Different href styles\n* Example\n")))
(defun org-toc-hrefify-gh (str)
"Given a heading, transform it into a href using the GitHub
@@ -133,11 +134,12 @@ rules."
(special-chars-fix (replace-regexp-in-string
org-toc-special-chars-regexp "" upcase-fix t)))
(concat "#" special-chars-fix)))
-(ert-deftest org-toc-test-hrefify-gh ()
- "Test the `org-toc-hrefify-gh' function"
- (should (equal (org-toc-hrefify-gh "About") "#about"))
- (should (equal (org-toc-hrefify-gh "!h@#$%^&*(){}|][:;\"'/?.>,<`~") "#h"))
- (should (equal (org-toc-hrefify-gh "!h@#$% ^&*(S){}|][:;\"'/?.>,<`~")
"#h-s")))
+(eval-after-load "ert-autoloads"
+ (ert-deftest org-toc-test-hrefify-gh ()
+ "Test the `org-toc-hrefify-gh' function"
+ (should (equal (org-toc-hrefify-gh "About") "#about"))
+ (should (equal (org-toc-hrefify-gh "!h@#$%^&*(){}|][:;\"'/?.>,<`~") "#h"))
+ (should (equal (org-toc-hrefify-gh "!h@#$% ^&*(S){}|][:;\"'/?.>,<`~")
"#h-s"))))
(defun org-toc-hrefify-org (str)
"Given a heading, transform it into a href using the org-mode
@@ -177,11 +179,12 @@ each heading into a link."
(buffer-substring-no-properties
(point-min) (point-max))))
-(ert-deftest org-toc-test-hrefify-toc ()
- (should (equal (org-toc-hrefify-toc "* About\n" 'upcase)
- " - [[ABOUT][About]]\n"))
- (should (equal (org-toc-hrefify-toc "* About\n* Installation\n** via
package.el\n** Manual\n* Use\n* Different href styles\n* Example\n" 'upcase)
- " - [[ABOUT][About]]\n - [[INSTALLATION][Installation]]\n
- [[VIA PACKAGE.EL][via package.el]]\n - [[MANUAL][Manual]]\n -
[[USE][Use]]\n - [[DIFFERENT HREF STYLES][Different href styles]]\n -
[[EXAMPLE][Example]]\n")))
+(eval-after-load "ert-autoloads"
+ (ert-deftest org-toc-test-hrefify-toc ()
+ (should (equal (org-toc-hrefify-toc "* About\n" 'upcase)
+ " - [[ABOUT][About]]\n"))
+ (should (equal (org-toc-hrefify-toc "* About\n* Installation\n** via
package.el\n** Manual\n* Use\n* Different href styles\n* Example\n" 'upcase)
+ " - [[ABOUT][About]]\n - [[INSTALLATION][Installation]]\n
- [[VIA PACKAGE.EL][via package.el]]\n - [[MANUAL][Manual]]\n -
[[USE][Use]]\n - [[DIFFERENT HREF STYLES][Different href styles]]\n -
[[EXAMPLE][Example]]\n"))))
(defun org-toc-flush-subheadings (toc max-depth)
"Flush subheadings of the raw `toc' deeper than `max-depth'."
@@ -197,22 +200,23 @@ each heading into a link."
(buffer-substring-no-properties
(point-min) (point-max))))
-(ert-deftest org-toc-test-flush-subheadings ()
- (should (equal (org-toc-flush-subheadings "* About\n" 0)
- ""))
- (should (equal (org-toc-flush-subheadings "* About\n" 1)
- "* About\n"))
- (should (equal (org-toc-flush-subheadings "* About\n" 2)
- "* About\n"))
-
- (should (equal (org-toc-flush-subheadings "* About\n* Installation\n** via
package.el\n** Manual\n* Use\n* Different href styles\n* Example\n" 0)
- ""))
- (should (equal (org-toc-flush-subheadings "* About\n* Installation\n** via
package.el\n** Manual\n* Use\n* Different href styles\n* Example\n" 1)
- "* About\n* Installation\n* Use\n* Different href styles\n*
Example\n"))
- (should (equal (org-toc-flush-subheadings "* About\n* Installation\n** via
package.el\n** Manual\n* Use\n* Different href styles\n* Example\n" 2)
- "* About\n* Installation\n** via package.el\n** Manual\n*
Use\n* Different href styles\n* Example\n"))
- (should (equal (org-toc-flush-subheadings "* About\n* Installation\n** via
package.el\n** Manual\n* Use\n* Different href styles\n* Example\n" 3)
- "* About\n* Installation\n** via package.el\n** Manual\n*
Use\n* Different href styles\n* Example\n")))
+(eval-after-load "ert-autoloads"
+ (ert-deftest org-toc-test-flush-subheadings ()
+ (should (equal (org-toc-flush-subheadings "* About\n" 0)
+ ""))
+ (should (equal (org-toc-flush-subheadings "* About\n" 1)
+ "* About\n"))
+ (should (equal (org-toc-flush-subheadings "* About\n" 2)
+ "* About\n"))
+
+ (should (equal (org-toc-flush-subheadings "* About\n* Installation\n** via
package.el\n** Manual\n* Use\n* Different href styles\n* Example\n" 0)
+ ""))
+ (should (equal (org-toc-flush-subheadings "* About\n* Installation\n** via
package.el\n** Manual\n* Use\n* Different href styles\n* Example\n" 1)
+ "* About\n* Installation\n* Use\n* Different href styles\n*
Example\n"))
+ (should (equal (org-toc-flush-subheadings "* About\n* Installation\n** via
package.el\n** Manual\n* Use\n* Different href styles\n* Example\n" 2)
+ "* About\n* Installation\n** via package.el\n** Manual\n*
Use\n* Different href styles\n* Example\n"))
+ (should (equal (org-toc-flush-subheadings "* About\n* Installation\n** via
package.el\n** Manual\n* Use\n* Different href styles\n* Example\n" 3)
+ "* About\n* Installation\n** via package.el\n** Manual\n*
Use\n* Different href styles\n* Example\n"))))
(defun org-toc-insert-toc ()
"Looks for a headline with the TOC tag and updates it with the
- [nongnu] elpa/toc-org da99c5d801 023/128: require ert, (continued)
- [nongnu] elpa/toc-org da99c5d801 023/128: require ert, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 63a0144afa 031/128: fix documentation, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org cfb309e8ab 035/128: fix typo, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 1a213baa8a 048/128: don't alter the type and path if we don't recognize it as a TOC entry, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org d23140d604 056/128: Merge pull request #21 from snosov1/fix-properties-handling, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 17c6cf1d1a 060/128: add tests, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 01cb78ead6 063/128: Use `delete-region` instead of kill-line while creating the TOC, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org d3d3503b34 062/128: Delete trailing whitespaces from links, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 4d076d1e9d 118/128: Respect the file-local value of org-list-indent-offset., ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org f3218fdaf1 123/128: Add license and copyright header to toc-org-test.el, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 501f36db68 021/128: Merge pull request #5 from ardumont/wrap-tests-definition,
ELPA Syncer <=
- [nongnu] elpa/toc-org 658c03111b 017/128: add some more tests and fix wording, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org d3677cd8c8 022/128: make compile-command run the tests, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 0dee7197c8 026/128: fix byte-compilation check, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 242eecba19 034/128: add a note about previous name, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 90894242a6 046/128: treat org-list-indent-offset properly, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 4c0b28da59 037/128: add more tags for easier search, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org e38e81af3f 088/128: Merge pull request #57 from JAremko/master, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org cda8f73640 073/128: Merge pull request #37 from snosov1/handle-comment, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org ee70dd23e1 104/128: resolve missing functions warnings, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org d52f95fae8 105/128: Handle trailing #'s, ELPA Syncer, 2022/01/02