Function: ses-exercise
ses-exercise is an interactive and byte-compiled function defined in
tcover-ses.el.gz.
Signature
(ses-exercise)
Documentation
Executes all SES coverage tests and displays the results.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/tcover-ses.el.gz
;;;#########################################################################
(defun ses-exercise ()
"Executes all SES coverage tests and displays the results."
(interactive)
(ses-exercise-startup)
;;Run the keyboard-macro tests
(let ((safe-functions nil)
(ses-initial-size '(1 . 1))
(ses-initial-column-width 7)
(ses-initial-default-printer "%.7g")
(ses-after-entry-functions '(forward-char))
(ses-mode-hook nil))
(ses-exercise-macros)
(ses-exercise-signals)
(ses-exercise-invalid-spreadsheets)
;;Upgrade of old-style spreadsheet
(with-temp-buffer
(insert " \n\n\^L\n(ses-cell A1 nil nil nil nil)\n\n(ses-column-widths [7])\n(ses-column-printers [nil])\n(ses-default-printer \"%.7g\")\n\n( ;Global parameters (these are read first)\n 1 ;SES file-format\n 1 ;numrows\n 1 ;numcols\n)\n\n")
(ses-load))
;;ses-vector-delete is always called from buffer-undo-list with the same
;;symbol as argument. We'll give it a different one here.
(dlet ((tcover-ses--x [1 2 3]))
(ses-vector-delete 'tcover-ses--x 0 0))
;;ses-create-header-string behaves differently in a non-window environment
;;but we always test under windows.
(let ((window-system (not window-system)))
(scroll-left 7)
(ses-create-header-string))
;;Test for nonstandard after-entry functions
(let ((ses-after-entry-functions '(forward-line))
ses-mode-hook)
(ses-read-cell 0 0 1)
(ses-read-symbol 0 0 t)))
;;Tests with unsafep disabled
(let ((safe-functions t)
ses-mode-hook)
(message "<Checking safe-functions = t>")
(kill-buffer "ses-example.ses")
(find-file "ses-example.ses"))
;;Checks for nonstandard default values for new spreadsheets
(let (ses-mode-hook)
(dolist (x '(("%.6g" 8 (2 . 2))
("%.8g" 6 (3 . 3))))
(let ((ses-initial-size (nth 2 x))
(ses-initial-column-width (nth 1 x))
(ses-initial-default-printer (nth 0 x)))
(with-temp-buffer
(set-buffer-modified-p t)
(ses-mode)))))
;;Test error-handling in command hook, outside a macro.
;;This will ring the bell.
(let (ses--curcell-overlay)
(ses-command-hook))
;;Due to use of run-with-timer, ses-command-hook sometimes gets called
;;after we switch to another buffer.
(switch-to-buffer "*scratch*")
(ses-command-hook)
;;Print results
(message "<Marking source code>")
(testcover-mark-all "ses.el")
(testcover-next-mark)
;;Cleanup
(delete-other-windows)
(kill-buffer "ses-test.txt")
;;Could do this here: (testcover-end "ses.el")
(message "Done"))