-
Notifications
You must be signed in to change notification settings - Fork 347
Add post-command-hook related tests #1093
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
(haskell-utils-async-watch-changes) | ||
(should (null haskell-utils-async-post-command-flag)) | ||
;; now invoke some commands and test flag value | ||
(insert "Hello World!") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use:
(execute-kbd-macro "DEF")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This gives error during test:
(end-of-buffer)
(goto-char (point-min))
does not help.
Summary:
|
Well, I've found only two ways to cover |
Don't merge this yet. Let's merge test-utils first, then I'll rebase code (I guess this will be needed, won't it?). |
Ok, this is almost total coverage! 📈 Any good ideas about last uncovered function? |
Use |
Well, we cannot test interactive stuff in batch mode, because:
So, I'll remove last commit in few minutes, @gracjan can we have some special init file to run Emacs not in batch mode (if this is even possible on Travis), then run interactive tests with mentioned hacks [1] and finally exit Emacs? |
Add post-command-hook related tests
@geraldus: I never saw your interactive commit so I do not know what you are talking about. I have some IRC bouncer set up, so I get all messages when I get back to computer. |
@gracjan wow, Evil's registers prevented me from loosing it comletely: (ert-deftest read-directory-name ()
"Test `haskell-utils-read-directory-name'.
This is very simple test, it just runs
`haskell-utils-read-directory-name' function with default
directory set to home dir. Since we have no clue about
evnironment the only way to test this function will be simulate
RET keypress and compare result to home folder path - the
latter should be a prexif ot former."
(let* ((home (getenv "HOME"))
(unread-command-events (listify-key-sequence (kbd "RET G-g")))
(result (haskell-utils-read-directory-name "> " home)))
(should (string-prefix-p home result)))) while this woks fine in non-batch mode, Travis builds are failing after 10 minutes timeout. |
In the particular case of |
@gracjan I didn't catch how to use it, can you explain a bit? |
Example of (mocklet (((haskell-session-name "dummy-session") => "dumses1"))
(haskell-process-compute-process-log-and-command "dummy-session" 'ghci))) So in our situation this would be something like: (mocklet (((read-directory-name ? ? ?) => ?))
(should (equal "xxx" (haskell-utils-read-directory-name ? ? ?))) |
@gracjan let me not to be greedy in this respect and leave this final piece to you (or someone else). Sorry, I need some time to learn that mocklets and have some other tasks to do in nearest time 😔 |
Don't merge yet, I opened this to see coverage stats first.
@gracjan I've spent few hour trying to make it record changes to flag during ert running test. I have tried
command-execute
,call-interactively
,execute-kbd-macro
, and changing modes but flag remains empty all the time. Can you help me with this?