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

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

[nongnu] elpa/org-mime 7bcb075550 060/118: CI and TDD, fixed some minor


From: ELPA Syncer
Subject: [nongnu] elpa/org-mime 7bcb075550 060/118: CI and TDD, fixed some minor bug. bump 0.1.2
Date: Wed, 5 Jan 2022 07:58:47 -0500 (EST)

branch: elpa/org-mime
commit 7bcb075550d2b9ea6010997dec135db0c73154f6
Author: Chen Bin <chenbin.sh@gmail.com>
Commit: Chen Bin <chenbin.sh@gmail.com>

    CI and TDD, fixed some minor bug. bump 0.1.2
---
 .travis.yml            | 30 +++++++++++++++++++++
 Makefile               | 15 +++++++++++
 README.org             |  2 +-
 org-mime.el            | 28 +++++++++----------
 test/org-mime-tests.el | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 132 insertions(+), 16 deletions(-)

diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000000..09ff39cc7c
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,30 @@
+language: generic
+
+env:
+  global:
+    - CURL="curl -fsSkL --retry 9 --retry-delay 9"
+  matrix:
+  - EMACS_VERSION=24.4
+  - EMACS_VERSION=24.5
+  - EMACS_VERSION=25.3
+  - EMACS_VERSION=26.1
+  - EMACS_VERSION=master
+
+matrix:
+  allow_failures:
+    - env: EMACS_VERSION=master
+
+install:
+  - $CURL -O 
https://github.com/npostavs/emacs-travis/releases/download/bins/emacs-bin-${EMACS_VERSION}.tar.gz
+  - tar -xaf emacs-bin-${EMACS_VERSION}.tar.gz -C /
+  - export EMACS=/tmp/emacs/bin/emacs
+
+script:
+  - $EMACS --version
+  - emacs=$EMACS make test
+
+notifications:
+  email:
+    # Default is change, but that includes a new branch's 1st success.
+    on_success: never
+    on_failure: always
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000000..dd10b063fa
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,15 @@
+SHELL = /bin/sh
+EMACS ?= emacs
+PROFILER =
+
+.PHONY: test
+
+# Delete byte-compiled files etc.
+clean:
+       rm -f *~
+       rm -f \#*\#
+       rm -f *.elc
+
+# Run tests.
+test: clean
+       $(EMACS) -batch -Q -l org-mime.el -l test/org-mime-tests.el
diff --git a/README.org b/README.org
index e5c0a15f73..6e318ce21c 100644
--- a/README.org
+++ b/README.org
@@ -1,4 +1,4 @@
-* org-mime v0.1.1
+* org-mime v0.1.2
 org-mime can be used to send HTML email using Org-mode HTML export.
 
 This approximates a WYSiWYG HTML mail editor from within Emacs, and can be 
useful for sending tables, fontified source code, and inline images in email.
diff --git a/org-mime.el b/org-mime.el
index e30fc26483..810076fd41 100644
--- a/org-mime.el
+++ b/org-mime.el
@@ -6,7 +6,7 @@
 ;; Maintainer: Chen Bin (redguardtoo)
 ;; Keywords: mime, mail, email, html
 ;; Homepage: http://github.com/org-mime/org-mime
-;; Version: 0.1.1
+;; Version: 0.1.2
 ;; Package-Requires: ((emacs "24.4") (cl-lib "0.5"))
 
 ;; This file is not part of GNU Emacs.
@@ -162,7 +162,7 @@ This could be used for example to post-process html 
elements.")
 (defvar org-mime-pre-html-hook nil
   "Hook to run before html export.
 Functions should take no arguments and will be run in a
-buffer holdin the text to be exported.")
+buffer holding the text to be exported.")
 
 (defvar org-mime-send-buffer-hook nil
   "Hook to run in the Org-mode file before export.")
@@ -461,24 +461,22 @@ If called with an active region only export that region, 
otherwise entire body."
   "Create mail BODY in FILE with TO, SUBJECT, HEADERS.
 If SUBTREEP is t, curret org node is subtree."
   ;; start composing mail
-  (unless (featurep 'message)
-    (require 'message))
-  (message-mail to subject headers nil)
-  (message-goto-body)
-
-  ;; insert text
-  (let* ((str (with-temp-buffer
+  (let* ((export-opts (org-mime-get-export-options subtreep))
+         str)
+    (unless (featurep 'message)
+      (require 'message))
+    (message-mail to subject headers nil)
+    (message-goto-body)
+    (setq str (with-temp-buffer
                 (insert body)
                 (goto-char (point-min))
                 (run-hooks 'org-mime-pre-html-hook)
-                (buffer-string))))
-    (org-mime-insert-html-content body
-                                  file
-                                  str
-                                  (org-mime-get-export-options subtreep))))
+                (buffer-string)))
+    ;; insert text
+    (org-mime-insert-html-content body file str export-opts)))
 
 (defun org-mime-extract-keywords ()
-  "Extract keyword from "
+  "Extract keywords."
   (cond
    ((>= (org-mime-org-major-version) 9)
     (org-element-map (org-element-parse-buffer) 'keyword
diff --git a/test/org-mime-tests.el b/test/org-mime-tests.el
new file mode 100644
index 0000000000..41e8019d93
--- /dev/null
+++ b/test/org-mime-tests.el
@@ -0,0 +1,73 @@
+;; counsel-etags-tests.el --- unit tests for counsel-etags -*- coding: utf-8 
-*-
+
+;; Author: Chen Bin <chenbin DOT sh AT gmail DOT com>
+
+;;; License:
+
+;; This file is not part of GNU Emacs.
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, write to the Free Software
+;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+;;; Commentary:
+
+(require 'ert)
+(require 'org-mime)
+(require 'message)
+
+(defconst mail-header '("To: myname@mail.com\n"
+                       "Subject: test subject\n"
+                       "From: My Name <myname@yahoo.com>\n"
+                       "--text follows this line--\n"))
+(defconst mail-footer '("--\n"
+                        "Yous somebody\n\n"
+                        "--\n"
+                        "Some quote\n"))
+
+(ert-deftest test-org-mime-htmlize ()
+  (let* (str)
+    (with-temp-buffer
+      (apply #'insert mail-header)
+      (insert "* hello\n"
+              "** world\n"
+              "#+begin_src javascript\n"
+              "console.log('hello world');"
+              "#+end_src\n")
+      (apply #'insert mail-footer)
+      (message-mode)
+      (goto-char (point-min))
+      (org-mime-htmlize)
+      (setq str (buffer-string)))
+    (should (string-match "<#multipart" str))))
+
+(ert-deftest test-org-mime-org-subtree-htmlize ()
+  (let* (str opts)
+    (with-temp-buffer
+      (insert "* hello\n"
+              "** world\n"
+              "#+begin_src javascript\n"
+              "console.log('hello world');"
+              "#+end_src\n")
+      (org-mode)
+      (goto-char (point-min))
+      (setq opts (org-mime-get-export-options t))
+      (should opts)
+      (org-mime-org-subtree-htmlize)
+      (switch-to-buffer (car (message-buffers)))
+      (setq str (buffer-string)))
+    (should (string-match "^\* world" str))
+    (should (string-match "Subject: hello" str))
+    (should (string-match "<#multipart" str))))
+
+(ert-run-tests-batch-and-exit)
\ No newline at end of file



reply via email to

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