Fork me on GitHub
#cider
<
2018-01-17
>
qqq05:01:29

(ct/deftest test-a!
      (ct/is (thrown? Error (a! nil))) 
      (ct/is (thrown? AssertionError (assert false))) 
      (ct/is (thrown? java.lang.ArithmeticException (/ 1 0)))) ;; cursor is here
C-x C-e defines the test I know about 'cider-run-tests' However, I don't always want to run all tests. Is there a way to say "run only the test right in front of the cursor" ?

gonewest81805:01:12

C-c C-t t (or equivalently C-c C-t C-t) is bound to cider-test-run-test which runs the test at point. I believe in your example it would run all three is clauses in test-a!.

qqq06:01:11

@gonewest818 : 1. cider-test-run-test is great 2. this may be cause I'm using evil/lispy/lispyville cider-test-run-test seems to want the cursor to be on the "(" whereas cider-eval-last-sexp seems to want cursor to be on the ")"

qqq06:01:37

oh, I guess I should be comparing cider-test-run-test with cider-eval-sexp-at-point

qqq06:01:45

@gonewest818: I just defined

(defun my-cider-test-run-test-last-sexp ()
  (interactive)
  (save-excursion
    (evil-backward-char 1)
    (lispy-left 1)
    (cider-test-run-test)))
and it works beautifully now; thanks! πŸ™‚

bozhidar08:01:59

> cider-test-run-test seems to want the cursor to be on the β€œ(” whereas cider-eval-last-sexp seems to want cursor to be on the β€œ)”

bozhidar08:01:43

I thought it was supposed to work anywhere within the test definition. File a ticket about this, maybe it’s worth adding some other way to run a single test.

qqq08:01:57

this looks like another case of "solve problem use lispy, @bozhidar solves it correctly" πŸ™‚ πŸ™‚ πŸ™‚

bozhidar09:01:44

Perhaps πŸ™‚

qqq09:01:38

(foo (+ 2 3) # (* 4 5)) # = my cursor is there a command which will transform the above into foo (+ 2 3) # (* 4 5) what I want is: find smallest 'parent ()', remove the ()

qqq09:01:58

ah, got it (lispy-left 1) (lispy-splice) πŸ™‚

gonewest81815:01:49

in paredit M-s for paredit-splice-sexp