Phil Estival <p...@7d.nz> writes: > This may appear as an unnecessary effort to refactor, or worse, > normalize a code that can benefit from some diversity > yet, > the forms > > (should > (equal "<str result>" > (org-test-with-temp-text "<block>" > (org-babel-next-src-block) > (org-trim (org-babel-execute-src-block)))))) > ... > exist in > test-ob-[maxima,R,sqlite,sed,shell,plantuml,lua,java,julia,lob,octave,perl,python,emacs-lisp].el > > Considering it at the repetitive pattern, I think a macro can shorten > those forms to : > > (ob-test "<preamble + block>" > :expect "<expected-result>") > ... > (ob-test "<preamble+block>" > :expect-to-match "<expected regexp to match>")
Looks reasonable. Although, :expect/:expect-*-to-* are probably redundant. We may instead use some kind of anamorphic form like: (ob-with-src-block-result "...." (should (equal it "expected")) (should (string-match-p "expected-re" it)) (should-not ...) ...) -- Ihor Radchenko // yantar92, Org mode maintainer, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>