mirror of
https://github.com/vale981/emacs-jupyter
synced 2025-03-04 15:41:37 -05:00
Test against the newest version of org-mode
This commit is contained in:
parent
70f4b1b9a3
commit
d927d3d58d
2 changed files with 43 additions and 27 deletions
2
Cask
2
Cask
|
@ -1,5 +1,6 @@
|
|||
(source gnu)
|
||||
(source melpa)
|
||||
(source org)
|
||||
|
||||
(package-file "jupyter.el")
|
||||
|
||||
|
@ -9,4 +10,5 @@
|
|||
|
||||
(development
|
||||
(depends-on "ert-runner")
|
||||
(depends-on "org-plus-contrib")
|
||||
(depends-on "julia-mode"))
|
||||
|
|
|
@ -352,33 +352,47 @@ results instead of an equality match."
|
|||
"#+END_SRC")))
|
||||
|
||||
(defun jupyter-org-test-src-block-1 (code test-result &optional regexp args)
|
||||
(insert (jupyter-org-test-make-block code args))
|
||||
(let* ((info (org-babel-get-src-block-info))
|
||||
(end (point-marker)))
|
||||
(set-marker-insertion-type end t)
|
||||
(save-window-excursion
|
||||
(org-babel-execute-src-block nil info))
|
||||
(org-with-point-at (org-babel-where-is-src-block-result nil info)
|
||||
(when (equal (alist-get :async args) "yes")
|
||||
(jupyter-wait-until-idle
|
||||
(ring-ref (oref jupyter-current-client pending-requests) 0)))
|
||||
(let ((drawer (org-element-at-point)))
|
||||
;; Handle empty results with just a RESULTS keyword
|
||||
;;
|
||||
;; #+RESULTS:
|
||||
(if (eq (org-element-type drawer) 'keyword) ""
|
||||
(let ((result (string-trim
|
||||
(if (eq (org-element-type drawer) 'drawer)
|
||||
(let ((src-block (jupyter-org-test-make-block code args)))
|
||||
(insert src-block)
|
||||
(let* ((info (org-babel-get-src-block-info))
|
||||
(end (point-marker)))
|
||||
(set-marker-insertion-type end t)
|
||||
(save-window-excursion
|
||||
(org-babel-execute-src-block nil info))
|
||||
(org-with-point-at (org-babel-where-is-src-block-result nil info)
|
||||
(when (equal (alist-get :async args) "yes")
|
||||
(jupyter-wait-until-idle
|
||||
(ring-ref (oref jupyter-current-client pending-requests) 0)))
|
||||
(let ((drawer (org-element-at-point)))
|
||||
;; Handle empty results with just a RESULTS keyword
|
||||
;;
|
||||
;; #+RESULTS:
|
||||
(if (eq (org-element-type drawer) 'keyword) ""
|
||||
(let ((result (string-trim
|
||||
(if (eq (org-element-type drawer) 'drawer)
|
||||
(buffer-substring-no-properties
|
||||
(org-element-property :contents-begin drawer)
|
||||
(org-element-property :contents-end drawer))
|
||||
(buffer-substring-no-properties
|
||||
(org-element-property :contents-begin drawer)
|
||||
(org-element-property :contents-end drawer))
|
||||
(buffer-substring-no-properties
|
||||
(org-element-property :post-affiliated drawer)
|
||||
(org-element-property :end drawer))))))
|
||||
(if regexp (should (string-match-p test-result result))
|
||||
(should (eq (compare-strings
|
||||
result nil nil test-result nil nil
|
||||
'ignore-case)
|
||||
t)))))))))
|
||||
(org-element-property :post-affiliated drawer)
|
||||
(org-element-property :end drawer))))))
|
||||
(if regexp (should (string-match-p test-result result))
|
||||
(message "\
|
||||
|
||||
Testing src-block:
|
||||
%s
|
||||
|
||||
Expected result:
|
||||
%s
|
||||
|
||||
Result:
|
||||
%s
|
||||
|
||||
"
|
||||
src-block result test-result)
|
||||
(should (eq (compare-strings
|
||||
result nil nil test-result nil nil
|
||||
'ignore-case)
|
||||
t))))))))))
|
||||
|
||||
;;; test-helper.el ends here
|
||||
|
|
Loading…
Add table
Reference in a new issue