[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/toc-org b4dbeb936c 024/128: simply require ert
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/toc-org b4dbeb936c 024/128: simply require ert |
Date: |
Sun, 2 Jan 2022 09:59:07 -0500 (EST) |
branch: elpa/toc-org
commit b4dbeb936c0c1503095492fb62ea9f4fcf1030c1
Author: Sergei Nosov <sergei.nosov@gmail.com>
Commit: Sergei Nosov <sergei.nosov@gmail.com>
simply require ert
---
org-toc.el | 120 +++++++++++++++++++++++++++++--------------------------------
1 file changed, 57 insertions(+), 63 deletions(-)
diff --git a/org-toc.el b/org-toc.el
index 101112a122..5ad797a057 100644
--- a/org-toc.el
+++ b/org-toc.el
@@ -42,6 +42,8 @@
;;; Code:
+(require 'ert)
+
(defgroup org-toc nil
"org-toc is a utility to have an up-to-date table of contents
in the org files without exporting (useful primarily for readme
@@ -95,37 +97,35 @@ tags."
(buffer-substring-no-properties
(point-min) (point-max)))))
-(eval-after-load "ert-autoloads"
- (when (require 'ert nil t)
- (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 hre [...]
- "* About\n* Installation\n** via package.el\n** Manual\n* Use\n*
Different href styles\n* Example\n"))))
+(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"))
(defun org-toc-hrefify-gh (str)
"Given a heading, transform it into a href using the GitHub
@@ -135,13 +135,11 @@ rules."
(special-chars-fix (replace-regexp-in-string
org-toc-special-chars-regexp "" upcase-fix t)))
(concat "#" special-chars-fix)))
-(eval-after-load "ert-autoloads"
- (when (require 'ert nil t)
- (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")))))
+(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
@@ -181,13 +179,11 @@ each heading into a link."
(buffer-substring-no-properties
(point-min) (point-max))))
-(eval-after-load "ert-autoloads"
- (when (require 'ert nil t)
- (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")))))
+(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'."
@@ -203,24 +199,22 @@ each heading into a link."
(buffer-substring-no-properties
(point-min) (point-max))))
-(eval-after-load "ert-autoloads"
- (when (require 'ert nil t)
- (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")))))
+(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 35781c6313 126/128: Merge pull request #82 from skangas/add-license, (continued)
- [nongnu] elpa/toc-org 35781c6313 126/128: Merge pull request #82 from skangas/add-license, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 08ed3f0883 061/128: Merge pull request #30 from snosov1/fix-28, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 56b48ec37b 033/128: rename to toc-org, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 11ce8a843f 052/128: strip priorities (fixes #18), ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org a19c3f5f94 091/128: test quote functionality, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 32975071df 039/128: mention former name in description, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org c662f96040 090/128: add quote functionality, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 4cd71edc29 082/128: bump emacs25 version, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 827dc448e0 013/128: push .travis.yml, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 11be82816a 019/128: Merge pull request #4 from ardumont/add-tag-setup, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org b4dbeb936c 024/128: simply require ert,
ELPA Syncer <=
- [nongnu] elpa/toc-org 3dd30029b6 043/128: strip TODO and DONE states, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 7eb2874ed3 041/128: require org, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 3e0bdb5a29 054/128: fix properties handling (see #20), ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 7c54f809d6 058/128: Merge pull request #23 from snosov1/fix-eof-toc, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org b0cac21cdf 059/128: handle statistics cookies and #+OPTIONS: todo:t, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 44c2e17543 070/128: Merge pull request #36 from snosov1/move-tests, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 421956e9cc 078/128: remove opening space in each toc item, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 379b457fcf 107/128: fix subheading link in readme, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org f0b94e07bb 075/128: Merge pull request #39 from snosov1/add-noexport-support, ELPA Syncer, 2022/01/02
- [nongnu] elpa/toc-org 274e821fd4 079/128: update emacs to 25 for travis testing, ELPA Syncer, 2022/01/02