emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [babel] Trying to add ERT test cases
@ 2011-09-19 11:20 Sebastien Vauban
  2011-09-19 14:35 ` Eric Schulte
  2011-09-19 15:46 ` Martyn Jago
  0 siblings, 2 replies; 12+ messages in thread
From: Sebastien Vauban @ 2011-09-19 11:20 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi,

I'd like to really contrib more on test cases, in particular every time I'd
see something problematic. My goal (SOMEDAY/MAYBE) would be to (be able to)
report any problem with an attached ERT test case...

Last experience: for some unknown reason (maybe a Lisp nesting exceeded,
though), it (rarely) happens that the speed commands don't work anymore. I'd
like to test (ultimately all speed commans) against such a behavior.

Hence:

* Speed command (this must be at level-1 headline)
  :PROPERTIES:
  :ID:       4ee368b8-cf7c-4269-98c0-b28dcf94ff2b
  :END:

Some text.

* Test

#+begin_src emacs-lisp
(ert-deftest ob-tangle/speed-command-r ()
  "Test that speed command `r' does demote the headline."
  (org-test-at-id "4ee368b8-cf7c-4269-98c0-b28dcf94ff2b"
    (goto-char (point-at-bol))
    (insert "r") ;; I don't want a self-insert of r, but the effect of typing it
    (goto-char (point-at-bol))
    (should (looking-at "\\*\\* Speed command"))
    (delete-char 1)))
#+end_src

Problems:

- I want to simulate the user pressing `r', but `insert' does insert a literal
  `r', instead of executing what's associated to it.

  Of course, I don't want to replace the key press on `r' but a call to
  `org-shiftright', that's the whole point of the test.

  So, how can I insert a `r' character to be contextually interpreted?

- when `should' is failing, the `delete-char' does not take place. This is
  still mysterious to me, at this point in time.

Any hints for me to go further?

Best regards,
  Seb

-- 
Sebastien Vauban

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

end of thread, other threads:[~2011-09-21 15:12 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-19 11:20 [babel] Trying to add ERT test cases Sebastien Vauban
2011-09-19 14:35 ` Eric Schulte
2011-09-19 19:35   ` Sebastien Vauban
2011-09-19 21:32     ` Eric Schulte
2011-09-20  7:22       ` Sebastien Vauban
2011-09-19 15:46 ` Martyn Jago
2011-09-19 16:04   ` Eric Schulte
2011-09-20  8:03     ` Martyn Jago
2011-09-20 15:01       ` Eric Schulte
2011-09-21  4:18         ` Martyn Jago
2011-09-21 12:20           ` Eric Schulte
2011-09-19 19:43   ` Sebastien Vauban

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).