Silence byte-compiler in "testing/"

This commit is contained in:
Nicolas Goaziou 2016-06-04 21:12:30 +02:00
parent 2e04db63ea
commit 827413ef2f
5 changed files with 74 additions and 61 deletions

View File

@ -482,11 +482,11 @@ echo \"[[file:./cv.cls]]\"
echo \"[[file:./cv.cls]]\" echo \"[[file:./cv.cls]]\"
#+end_src #+end_src
" "
(flet ((next-result () (cl-flet ((next-result ()
(org-babel-next-src-block) (org-babel-next-src-block)
(org-babel-execute-src-block) (org-babel-execute-src-block)
(goto-char (org-babel-where-is-src-block-result)) (goto-char (org-babel-where-is-src-block-result))
(forward-line 1))) (forward-line 1)))
(goto-char (point-min)) (goto-char (point-min))
(next-result) (next-result)
(should (eq (org-element-type (org-element-at-point)) 'fixed-width)) (should (eq (org-element-type (org-element-at-point)) 'fixed-width))
@ -653,16 +653,16 @@ x
(should (looking-at ": 2"))))) (should (looking-at ": 2")))))
(ert-deftest test-ob/eval-header-argument () (ert-deftest test-ob/eval-header-argument ()
(flet ((check-eval (eval runp) (cl-flet ((check-eval (eval runp)
(org-test-with-temp-text (format "#+begin_src emacs-lisp :eval %s (org-test-with-temp-text (format "#+begin_src emacs-lisp :eval %s
(setq foo :evald) (setq foo :evald)
#+end_src" eval) #+end_src" eval)
(let ((foo :not-run)) (let ((foo :not-run))
(if runp (if runp
(progn (should (org-babel-execute-src-block)) (progn (should (org-babel-execute-src-block))
(should (eq foo :evald))) (should (eq foo :evald)))
(progn (should-not (org-babel-execute-src-block)) (progn (should-not (org-babel-execute-src-block))
(should-not (eq foo :evald)))))))) (should-not (eq foo :evald))))))))
(check-eval "never" nil) (check-eval "never" nil)
(check-eval "no" nil) (check-eval "no" nil)
(check-eval "never-export" t) (check-eval "never-export" t)

View File

@ -83,9 +83,8 @@
(should-error (org-attach-annex-get-maybe (expand-file-name "test-file")))) (should-error (org-attach-annex-get-maybe (expand-file-name "test-file"))))
(let ((org-attach-annex-auto-get 'ask) (let ((org-attach-annex-auto-get 'ask)
(called nil)) (called nil))
(flet ((y-or-n-p (prompt) (cl-letf (((symbol-function 'y-or-n-p)
(setq called 'was-called) (lambda (_) (setq called 'was-called) t)))
t))
(org-attach-annex-get-maybe (expand-file-name "test-file")) (org-attach-annex-get-maybe (expand-file-name "test-file"))
;; check that the file has the right contents ;; check that the file has the right contents
(with-temp-buffer (with-temp-buffer

View File

@ -1604,7 +1604,8 @@ e^{i\\pi}+1=0
(equal (equal
"127.0.0.1" "127.0.0.1"
(org-test-with-temp-text "[[http://orgmode.org]]" (org-test-with-temp-text "[[http://orgmode.org]]"
(flet ((link-translate (type path) (cons type "127.0.0.1"))) (cl-letf (((symbol-function 'link-translate)
(lambda (type _) (cons type "127.0.0.1"))))
(let ((org-link-translation-function 'link-translate)) (let ((org-link-translation-function 'link-translate))
(org-element-property (org-element-property
:path :path

View File

@ -35,7 +35,8 @@
(equal (equal
"* a\n:PROPERTIES:\n:pname: \n:END:\n* b\n:PROPERTIES:\n:pname: pvalue\n:END:\n" "* a\n:PROPERTIES:\n:pname: \n:END:\n* b\n:PROPERTIES:\n:pname: pvalue\n:END:\n"
(org-test-with-temp-text "* a\n:PROPERTIES:\n:pna<point>\n:END:\n* b\n:PROPERTIES:\n:pname: pvalue\n:END:\n" (org-test-with-temp-text "* a\n:PROPERTIES:\n:pna<point>\n:END:\n* b\n:PROPERTIES:\n:pname: pvalue\n:END:\n"
(flet ((y-or-n-p (prompt) (error "Should not be called"))) (cl-letf (((symbol-function 'y-or-n-p)
(lambda (_) (error "Should not be called"))))
(pcomplete)) (pcomplete))
(buffer-string))))) (buffer-string)))))

View File

@ -197,16 +197,18 @@
(should (should
(equal (equal
"2015-03-04" "2015-03-04"
(flet ((current-time () (apply #'encode-time (cl-letf (((symbol-function 'current-time)
(org-parse-time-string "2014-03-04")))) (lambda ()
(apply #'encode-time (org-parse-time-string "2014-03-04")))))
(org-read-date (org-read-date
t nil "+1y" nil t nil "+1y" nil
(apply #'encode-time (org-parse-time-string "2012-03-29")))))) (apply #'encode-time (org-parse-time-string "2012-03-29"))))))
(should (should
(equal (equal
"2013-03-29" "2013-03-29"
(flet ((current-time () (apply #'encode-time (cl-letf (((symbol-function 'current-time)
(org-parse-time-string "2014-03-04")))) (lambda ()
(apply #'encode-time (org-parse-time-string "2014-03-04")))))
(org-read-date (org-read-date
t nil "++1y" nil t nil "++1y" nil
(apply #'encode-time (org-parse-time-string "2012-03-29")))))) (apply #'encode-time (org-parse-time-string "2012-03-29"))))))
@ -216,22 +218,25 @@
(should (should
(equal (equal
"2014-04-01" "2014-04-01"
(flet ((current-time () (apply #'encode-time (cl-letf (((symbol-function 'current-time)
(org-parse-time-string "2014-03-04")))) (lambda ()
(apply #'encode-time (org-parse-time-string "2014-03-04")))))
(let ((org-read-date-prefer-future t)) (let ((org-read-date-prefer-future t))
(org-read-date t nil "1"))))) (org-read-date t nil "1")))))
(should (should
(equal (equal
"2013-03-04" "2013-03-04"
(flet ((current-time () (apply #'encode-time (cl-letf (((symbol-function 'current-time)
(org-parse-time-string "2012-03-29")))) (lambda ()
(apply #'encode-time (org-parse-time-string "2012-03-29")))))
(let ((org-read-date-prefer-future t)) (let ((org-read-date-prefer-future t))
(org-read-date t nil "3-4"))))) (org-read-date t nil "3-4")))))
(should (should
(equal (equal
"2012-03-04" "2012-03-04"
(flet ((current-time () (apply #'encode-time (cl-letf (((symbol-function 'current-time)
(org-parse-time-string "2012-03-29")))) (lambda ()
(apply #'encode-time (org-parse-time-string "2012-03-29")))))
(let ((org-read-date-prefer-future nil)) (let ((org-read-date-prefer-future nil))
(org-read-date t nil "3-4"))))) (org-read-date t nil "3-4")))))
;; When set to `org-read-date-prefer-future' is set to `time', read ;; When set to `org-read-date-prefer-future' is set to `time', read
@ -241,15 +246,17 @@
(should (should
(equal (equal
"2012-03-30" "2012-03-30"
(flet ((current-time () (apply #'encode-time (cl-letf (((symbol-function 'current-time)
(org-parse-time-string "2012-03-29 16:40")))) (lambda ()
(apply #'encode-time (org-parse-time-string "2012-03-29 16:40")))))
(let ((org-read-date-prefer-future 'time)) (let ((org-read-date-prefer-future 'time))
(org-read-date t nil "00:40" nil))))) (org-read-date t nil "00:40" nil)))))
(should-not (should-not
(equal (equal
"2012-03-30" "2012-03-30"
(flet ((current-time () (apply #'encode-time (cl-letf (((symbol-function 'current-time)
(org-parse-time-string "2012-03-29 16:40")))) (lambda ()
(apply #'encode-time (org-parse-time-string "2012-03-29 16:40")))))
(let ((org-read-date-prefer-future 'time)) (let ((org-read-date-prefer-future 'time))
(org-read-date t nil "29 00:40" nil))))) (org-read-date t nil "29 00:40" nil)))))
;; Caveat: `org-read-date-prefer-future' always refers to current ;; Caveat: `org-read-date-prefer-future' always refers to current
@ -257,8 +264,9 @@
(should (should
(equal (equal
"2014-04-01" "2014-04-01"
(flet ((current-time (cl-letf (((symbol-function 'current-time)
() (apply #'encode-time (org-parse-time-string "2014-03-04")))) (lambda ()
(apply #'encode-time (org-parse-time-string "2014-03-04")))))
(let ((org-read-date-prefer-future t)) (let ((org-read-date-prefer-future t))
(org-read-date (org-read-date
t nil "1" nil t nil "1" nil
@ -266,8 +274,9 @@
(should (should
(equal (equal
"2014-03-25" "2014-03-25"
(flet ((current-time (cl-letf (((symbol-function 'current-time)
() (apply #'encode-time (org-parse-time-string "2014-03-04")))) (lambda ()
(apply #'encode-time (org-parse-time-string "2014-03-04")))))
(let ((org-read-date-prefer-future t)) (let ((org-read-date-prefer-future t))
(org-read-date (org-read-date
t nil "25" nil t nil "25" nil
@ -367,7 +376,8 @@
(ert-deftest test-org/deadline-close-p () (ert-deftest test-org/deadline-close-p ()
"Test `org-deadline-close-p' specifications." "Test `org-deadline-close-p' specifications."
;; Pretend that the current time is 2016-06-03 Fri 01:43 ;; Pretend that the current time is 2016-06-03 Fri 01:43
(flet ((current-time () '(22353 6425 905205 644000))) (cl-letf (((symbol-function 'current-time)
(lambda () '(22353 6425 905205 644000))))
;; Timestamps are close if they are within `ndays' of lead time. ;; Timestamps are close if they are within `ndays' of lead time.
(org-test-with-temp-text "* Heading" (org-test-with-temp-text "* Heading"
(should (org-deadline-close-p "2016-06-03 Fri" 0)) (should (org-deadline-close-p "2016-06-03 Fri" 0))
@ -4509,9 +4519,9 @@ Paragraph<point>"
(string-match (string-match
"Te<2014-03-04 .*?>xt" "Te<2014-03-04 .*?>xt"
(org-test-with-temp-text "Te<point>xt" (org-test-with-temp-text "Te<point>xt"
(flet ((org-read-date (cl-letf (((symbol-function 'org-read-date)
(&rest args) (lambda (&rest args)
(apply #'encode-time (org-parse-time-string "2014-03-04")))) (apply #'encode-time (org-parse-time-string "2014-03-04")))))
(org-time-stamp nil) (org-time-stamp nil)
(buffer-string))))) (buffer-string)))))
;; With a prefix argument, also insert time. ;; With a prefix argument, also insert time.
@ -4519,9 +4529,10 @@ Paragraph<point>"
(string-match (string-match
"Te<2014-03-04 .*? 00:41>xt" "Te<2014-03-04 .*? 00:41>xt"
(org-test-with-temp-text "Te<point>xt" (org-test-with-temp-text "Te<point>xt"
(flet ((org-read-date (cl-letf (((symbol-function 'org-read-date)
(&rest args) (lambda (&rest args)
(apply #'encode-time (org-parse-time-string "2014-03-04 00:41")))) (apply #'encode-time
(org-parse-time-string "2014-03-04 00:41")))))
(org-time-stamp '(4)) (org-time-stamp '(4))
(buffer-string))))) (buffer-string)))))
;; With two universal prefix arguments, insert an active timestamp ;; With two universal prefix arguments, insert an active timestamp
@ -4530,9 +4541,10 @@ Paragraph<point>"
(string-match (string-match
"Te<2014-03-04 .*? 00:41>xt" "Te<2014-03-04 .*? 00:41>xt"
(org-test-with-temp-text "Te<point>xt" (org-test-with-temp-text "Te<point>xt"
(flet ((current-time (cl-letf (((symbol-function 'current-time)
() (lambda ()
(apply #'encode-time (org-parse-time-string "2014-03-04 00:41")))) (apply #'encode-time
(org-parse-time-string "2014-03-04 00:41")))))
(org-time-stamp '(16)) (org-time-stamp '(16))
(buffer-string))))) (buffer-string)))))
;; When optional argument is non-nil, insert an inactive timestamp. ;; When optional argument is non-nil, insert an inactive timestamp.
@ -4540,9 +4552,9 @@ Paragraph<point>"
(string-match (string-match
"Te\\[2014-03-04 .*?\\]xt" "Te\\[2014-03-04 .*?\\]xt"
(org-test-with-temp-text "Te<point>xt" (org-test-with-temp-text "Te<point>xt"
(flet ((org-read-date (cl-letf (((symbol-function 'org-read-date)
(&rest args) (lambda (&rest args)
(apply #'encode-time (org-parse-time-string "2014-03-04")))) (apply #'encode-time (org-parse-time-string "2014-03-04")))))
(org-time-stamp nil t) (org-time-stamp nil t)
(buffer-string))))) (buffer-string)))))
;; When called from a timestamp, replace existing one. ;; When called from a timestamp, replace existing one.
@ -4550,18 +4562,18 @@ Paragraph<point>"
(string-match (string-match
"<2014-03-04 .*?>" "<2014-03-04 .*?>"
(org-test-with-temp-text "<2012-03-29<point> thu.>" (org-test-with-temp-text "<2012-03-29<point> thu.>"
(flet ((org-read-date (cl-letf (((symbol-function 'org-read-date)
(&rest args) (lambda (&rest args)
(apply #'encode-time (org-parse-time-string "2014-03-04")))) (apply #'encode-time (org-parse-time-string "2014-03-04")))))
(org-time-stamp nil) (org-time-stamp nil)
(buffer-string))))) (buffer-string)))))
(should (should
(string-match (string-match
"<2014-03-04 .*?>--<2014-03-04 .*?>" "<2014-03-04 .*?>--<2014-03-04 .*?>"
(org-test-with-temp-text "<2012-03-29<point> thu.>--<2014-03-04 tue.>" (org-test-with-temp-text "<2012-03-29<point> thu.>--<2014-03-04 tue.>"
(flet ((org-read-date (cl-letf (((symbol-function 'org-read-date)
(&rest args) (lambda (&rest args)
(apply #'encode-time (org-parse-time-string "2014-03-04")))) (apply #'encode-time (org-parse-time-string "2014-03-04")))))
(org-time-stamp nil) (org-time-stamp nil)
(buffer-string))))) (buffer-string)))))
;; When replacing a timestamp, preserve repeater, if any. ;; When replacing a timestamp, preserve repeater, if any.
@ -4569,9 +4581,9 @@ Paragraph<point>"
(string-match (string-match
"<2014-03-04 .*? \\+2y>" "<2014-03-04 .*? \\+2y>"
(org-test-with-temp-text "<2012-03-29<point> thu. +2y>" (org-test-with-temp-text "<2012-03-29<point> thu. +2y>"
(flet ((org-read-date (cl-letf (((symbol-function 'org-read-date)
(&rest args) (lambda (&rest args)
(apply #'encode-time (org-parse-time-string "2014-03-04")))) (apply #'encode-time (org-parse-time-string "2014-03-04")))))
(org-time-stamp nil) (org-time-stamp nil)
(buffer-string))))) (buffer-string)))))
;; When called twice in a raw, build a date range. ;; When called twice in a raw, build a date range.
@ -4579,9 +4591,9 @@ Paragraph<point>"
(string-match (string-match
"<2012-03-29 .*?>--<2014-03-04 .*?>" "<2012-03-29 .*?>--<2014-03-04 .*?>"
(org-test-with-temp-text "<2012-03-29 thu.><point>" (org-test-with-temp-text "<2012-03-29 thu.><point>"
(flet ((org-read-date (cl-letf (((symbol-function 'org-read-date)
(&rest args) (lambda (&rest args)
(apply #'encode-time (org-parse-time-string "2014-03-04")))) (apply #'encode-time (org-parse-time-string "2014-03-04")))))
(let ((last-command 'org-time-stamp) (let ((last-command 'org-time-stamp)
(this-command 'org-time-stamp)) (this-command 'org-time-stamp))
(org-time-stamp nil)) (org-time-stamp nil))