emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* ERT test for checking HTML export: void-variable org-export-filters-alist
@ 2015-01-30 14:38 Sebastien Vauban
  2015-01-30 14:54 ` Sebastien Vauban
  0 siblings, 1 reply; 4+ messages in thread
From: Sebastien Vauban @ 2015-01-30 14:38 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hello,

I try to define an ERT test so that I can check that the new export of
some test file gives me the same HTML output (to the byte!) than the
export done in the past (and present onto disk).

Here is my code to do so:

--8<---------------cut here---------------start------------->8---
(require 'ox)

(defun compare-org-html-export-files (orgfile)
  "Compare current export of ORGFILE with HTML file already present on disk."
  (let* ((base-name
          (concat (file-name-directory orgfile) (file-name-base orgfile)))
         (htmlfile (concat base-name ".html"))
         htmlcontents)
    (should
     (equal
      ;; new export
      (with-temp-buffer
        (insert-file-contents orgfile)
        (setq htmlcontents (org-export-as 'html))
        (delete-region (point-min) (point-max))
        (insert htmlcontents)
        (buffer-string))
      ;; old export
      (with-temp-buffer
        (insert-file-contents htmlfile)
        (buffer-string))))))

(ert-deftest org-export/export-html-test-file ()
  (compare-org-html-export-files "~/test.org"))
--8<---------------cut here---------------end--------------->8---

I don't understand, though, the error that I always get:

--8<---------------cut here---------------start------------->8---
Selector: org-export/export-html-test-file
Passed:  0
Failed:  1 (1 unexpected)
Skipped: 0
Total:   1/1

Started at:   2015-01-30 15:30:56+0100
Finished.
Finished at:  2015-01-30 15:30:56+0100

F

F org-export/export-html-test-file
    Compare current export of ORGFILE with HTML file already present on disk.
    (void-variable org-export-filters-alist)
--8<---------------cut here---------------end--------------->8---

Any idea why the variable `org-export-filters-alist' is said to be void,
while I explicitly load both `ox' (where it's defined) and `ox-html'?

Best regards,
  Seb

-- 
Sebastien Vauban

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ERT test for checking HTML export: void-variable org-export-filters-alist
  2015-01-30 14:38 ERT test for checking HTML export: void-variable org-export-filters-alist Sebastien Vauban
@ 2015-01-30 14:54 ` Sebastien Vauban
  2015-02-05 13:28   ` Sebastien Vauban
  0 siblings, 1 reply; 4+ messages in thread
From: Sebastien Vauban @ 2015-01-30 14:54 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hello,

Sebastien Vauban wrote:
> Here is my code to do so:
>
> (require 'ox)
>
> (defun compare-org-html-export-files (orgfile)
>   "Compare current export of ORGFILE with HTML file already present on disk."
>   (let* ((base-name
>           (concat (file-name-directory orgfile) (file-name-base orgfile)))
>          (htmlfile (concat base-name ".html"))
>          htmlcontents)
>     (should
>      (equal
>       ;; new export
>       (with-temp-buffer
>         (insert-file-contents orgfile)
>         (setq htmlcontents (org-export-as 'html))
>         (delete-region (point-min) (point-max))
>         (insert htmlcontents)
>         (buffer-string))
>       ;; old export
>       (with-temp-buffer
>         (insert-file-contents htmlfile)
>         (buffer-string))))))
>
> Any idea why the variable `org-export-filters-alist' is said to be void,
> while I explicitly load both `ox' (where it's defined) and `ox-html'?

And adding the require of `ox' and/or `ox-html' inside the test (or the
defun `compare-org-html-export-files') does not change anything.

Best regards,
  Seb

-- 
Sebastien Vauban

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ERT test for checking HTML export: void-variable org-export-filters-alist
  2015-01-30 14:54 ` Sebastien Vauban
@ 2015-02-05 13:28   ` Sebastien Vauban
  2015-02-06  9:06     ` Nicolas Goaziou
  0 siblings, 1 reply; 4+ messages in thread
From: Sebastien Vauban @ 2015-02-05 13:28 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hello,

May I bump up this thread?

Sebastien Vauban wrote:
> Here is my code to do so:
>
> (require 'ox)
>
> (defun compare-org-html-export-files (orgfile)
>   "Compare current export of ORGFILE with HTML file already present on disk."
>   (let* ((base-name
>           (concat (file-name-directory orgfile) (file-name-base orgfile)))
>          (htmlfile (concat base-name ".html"))
>          htmlcontents)
>     (should
>      (equal
>       ;; new export
>       (with-temp-buffer
>         (insert-file-contents orgfile)
>         (setq htmlcontents (org-export-as 'html))
>         (delete-region (point-min) (point-max))
>         (insert htmlcontents)
>         (buffer-string))
>       ;; old export
>       (with-temp-buffer
>         (insert-file-contents htmlfile)
>         (buffer-string))))))
>
> Any idea why the variable `org-export-filters-alist' is said to be void,
> while I explicitly load both `ox' (where it's defined) and `ox-html'?
>
> And adding the require of `ox' and/or `ox-html' inside the test (or the
> defun `compare-org-html-export-files') does not change anything.

Best regards,
  Seb

-- 
Sebastien Vauban

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ERT test for checking HTML export: void-variable org-export-filters-alist
  2015-02-05 13:28   ` Sebastien Vauban
@ 2015-02-06  9:06     ` Nicolas Goaziou
  0 siblings, 0 replies; 4+ messages in thread
From: Nicolas Goaziou @ 2015-02-06  9:06 UTC (permalink / raw)
  To: Sebastien Vauban; +Cc: public-emacs-orgmode-mXXj517/zsQ



Hello,

Sebastien Vauban <sva-news-D0wtAvR13HarG/iDocfnWg@public.gmane.org>
writes:

>> Here is my code to do so:
>>
>> (require 'ox)
>>
>> (defun compare-org-html-export-files (orgfile)
>>   "Compare current export of ORGFILE with HTML file already present on disk."
>>   (let* ((base-name
>>           (concat (file-name-directory orgfile) (file-name-base orgfile)))
>>          (htmlfile (concat base-name ".html"))
>>          htmlcontents)
>>     (should
>>      (equal
>>       ;; new export
>>       (with-temp-buffer
>>         (insert-file-contents orgfile)
>>         (setq htmlcontents (org-export-as 'html))
>>         (delete-region (point-min) (point-max))
>>         (insert htmlcontents)
>>         (buffer-string))
>>       ;; old export
>>       (with-temp-buffer
>>         (insert-file-contents htmlfile)
>>         (buffer-string))))))
>>
>> Any idea why the variable `org-export-filters-alist' is said to be void,
>> while I explicitly load both `ox' (where it's defined) and `ox-html'?
>>
>> And adding the require of `ox' and/or `ox-html' inside the test (or the
>> defun `compare-org-html-export-files') does not change anything.

I cannot reproduce it.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-02-06  9:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-30 14:38 ERT test for checking HTML export: void-variable org-export-filters-alist Sebastien Vauban
2015-01-30 14:54 ` Sebastien Vauban
2015-02-05 13:28   ` Sebastien Vauban
2015-02-06  9:06     ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).