(require 'oni-core) (ert-deftest oni-core-move-beginning-of-dwim-moves-to-beginning-of-indentation () "Test that ‘oni-core-move-beginning-of-dwim’ moves to the beginning of indentation." (with-temp-buffer (emacs-lisp-mode) (insert "(defun test-defun ()\n \"Just testing a function\")") (goto-char (point-max)) (oni-core-move-beginning-of-dwim) (should (equal 24 (point))))) (ert-deftest oni-core-move-beginning-of-dwim-moves-to-beginning-of-line () "Test that ‘oni-core-move-beginning-of-dwim’ moves to the beginning of the line." (with-temp-buffer (emacs-lisp-mode) (insert "(defun test-defun ()\n \"Just testing a function\")") (goto-char (point-max)) (oni-core-move-beginning-of-dwim) (oni-core-move-beginning-of-dwim) (should (equal 22 (point))))) (ert-deftest oni-core-move-beginning-of-dwim-moves-to-beginning-of-indentation-again () "Test that ‘oni-core-move-beginning-of-dwim’ moves to the beginning of indentation again." (with-temp-buffer (emacs-lisp-mode) (insert "(defun test-defun ()\n \"Just testing a function\")") (goto-char (point-max)) (oni-core-move-beginning-of-dwim) (oni-core-move-beginning-of-dwim) (oni-core-move-beginning-of-dwim) (should (equal 24 (point))))) (ert-deftest oni-core-move-end-of-dwim-moves-to-end-of-code () "Test that ‘oni-core-move-end-of-dwim’ moves to the end of the code before a comment." (with-temp-buffer (emacs-lisp-mode) (insert "(defun test-defun () ;; Just testing\n \"Just testing a function\")") (goto-char (point-min)) (oni-core-move-end-of-dwim) (should (equal 21 (point))))) (ert-deftest oni-core-move-end-of-dwim-moves-to-end-of-line () "Test that ‘oni-core-move-end-of-dwim’ moves to the end of the line." (with-temp-buffer (emacs-lisp-mode) (insert "(defun test-defun () ;; Just testing\n \"Just testing a function\")") (goto-char (point-min)) (oni-core-move-end-of-dwim) (oni-core-move-end-of-dwim) (should (equal 38 (point))))) (ert-deftest oni-core-move-end-of-dwim-moves-to-end-of-code-again () "Test that ‘oni-core-move-end-of-dwim’ moves to the end of the code before a comment again." (with-temp-buffer (emacs-lisp-mode) (insert "(defun test-defun () ;; Just testing\n \"Just testing a function\")") (goto-char (point-min)) (oni-core-move-end-of-dwim) (oni-core-move-end-of-dwim) (oni-core-move-end-of-dwim) (should (equal 21 (point)))))