emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/toc-org f13f79737a 020/128: Wrap test call with `(eval-aft


From: ELPA Syncer
Subject: [nongnu] elpa/toc-org f13f79737a 020/128: Wrap test call with `(eval-after-load "ert-autoloads"...)
Date: Sun, 2 Jan 2022 09:59:06 -0500 (EST)

branch: elpa/toc-org
commit f13f79737add47bbcfa6afca8dc4645079f99e3a
Author: Antoine R. Dumont <antoine.romain.dumont@gmail.com>
Commit: Antoine R. Dumont <antoine.romain.dumont@gmail.com>

    Wrap test call 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]