Changeset 45

Show
Ignore:
Timestamp:
01/18/08 14:08:07 (7 months ago)
Author:
abedra
Message:

first attempt to get focused tests working for test/spec examples

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • incubator/.elisp/dot.emacs

    r44 r45  
    33(setq shell-file-name "/bin/bash") 
    44 
    5 ;;; Jim Weirich's GNU-Emacs Initialization File 
     5;;; Relevance GNU-Emacs Initialization File (A Modified Version of Jim Weirich's GNU-Emacs Initialization File) 
    66 
    77(setq ini-directory (expand-file-name "~/.elisp/ini")) 
     
    2727(custom-set-variables 
    2828 '(init-face-from-resources nil) 
    29  '(mm-inline-media-tests (quote (("image/jpeg" mm-inline-image (lambda (handle) (mm-valid-and-fit-image-p (quote jpeg) handle))) ("image/png" mm-inline-image (lambda (handle) (mm-valid-and-fit-image-p (quote png) handle))) ("image/gif" mm-inline-image (lambda (handle) (mm-valid-and-fit-image-p (quote gif) handle))) ("image/tiff" mm-inline-image (lambda (handle) (mm-valid-and-fit-image-p (quote tiff) handle))) ("image/xbm" mm-inline-image (lambda (handle) (mm-valid-and-fit-image-p (quote xbm) handle))) ("image/x-xbitmap" mm-inline-image (lambda (handle) (mm-valid-and-fit-image-p (quote xbm) handle))) ("image/xpm" mm-inline-image (lambda (handle) (mm-valid-and-fit-image-p (quote xpm) handle))) ("image/x-pixmap" mm-inline-image (lambda (handle) (mm-valid-and-fit-image-p (quote xpm) handle))) ("image/bmp" mm-inline-image (lambda (handle) (mm-valid-and-fit-image-p (quote bmp) handle))) ("text/plain" mm-inline-text identity) ("text/enriched" mm-inline-text identity) ("text/richtext" mm-inline-text identity) ("text/x-patch" mm-display-patch-inline (lambda (handle) (locate-library "diff-mode"))) ("application/emacs-lisp" mm-display-elisp-inline identity) ("text/x-vcard" mm-inline-text (lambda (handle) (or (featurep (quote vcard)) (locate-library "vcard")))) ("message/delivery-status" mm-inline-text identity) ("message/rfc822" mm-inline-message identity) ("message/partial" mm-inline-partial identity) ("text/.*" mm-inline-text identity) ("audio/wav" mm-inline-audio (lambda (handle) (and (or (featurep (quote nas-sound)) (featurep (quote native-sound))) (device-sound-enabled-p)))) ("audio/au" mm-inline-audio (lambda (handle) (and (or (featurep (quote nas-sound)) (featurep (quote native-sound))) (device-sound-enabled-p)))) ("application/pgp-signature" ignore identity) ("multipart/alternative" ignore identity) ("multipart/mixed" ignore identity) ("multipart/related" ignore identity)))) 
    30  '(load-home-init-file t t) 
    31  '(gnuserv-program (concat exec-directory "/gnuserv")) 
    32  '(toolbar-news-reader (quote gnus)) 
    33  '(toolbar-mail-reader (quote gnus)) 
    34  '(ecb-source-path (quote (("/home/jim/working/rubyforge/rubygems" "RubyGems") ("/home/jim/working/rubyforge/rake" "Rake"))))) 
     29 '(mm-inline-media-tests (quote (("image/jpeg" mm-inline-image (lambda (handle) (mm-valid-and-fit-image-p (quote jpeg) handle))) ("image/png" mm-inline-image (lambda (handle) (mm-valid-and-fit-image-p (quote png) handle))) ("image/gif" mm-inline-image (lambda (handle) (mm-valid-and-fit-image-p (quote gif) handle))) ("image/tiff" mm-inline-image (lambda (handle) (mm-valid-and-fit-image-p (quote tiff) handle))) ("image/xbm" mm-inline-image (lambda (handle) (mm-valid-and-fit-image-p (quote xbm) handle))) ("image/x-xbitmap" mm-inline-image (lambda (handle) (mm-valid-and-fit-image-p (quote xbm) handle))) ("image/xpm" mm-inline-image (lambda (handle) (mm-valid-and-fit-image-p (quote xpm) handle))) ("image/x-pixmap" mm-inline-image (lambda (handle) (mm-valid-and-fit-image-p (quote xpm) handle))) ("image/bmp" mm-inline-image (lambda (handle) (mm-valid-and-fit-image-p (quote bmp) handle))) ("text/plain" mm-inline-text identity) ("text/enriched" mm-inline-text identity) ("text/richtext" mm-inline-text identity) ("text/x-patch" mm-display-patch-inline (lambda (handle) (locate-library "diff-mode"))) ("application/emacs-lisp" mm-display-elisp-inline identity) ("text/x-vcard" mm-inline-text (lambda (handle) (or (featurep (quote vcard)) (locate-library "vcard")))) ("message/delivery-status" mm-inline-text identity) ("message/rfc822" mm-inline-message identity) ("message/partial" mm-inline-partial identity) ("text/.*" mm-inline-text identity) ("audio/wav" mm-inline-audio (lambda (handle) (and (or (featurep (quote nas-sound)) (featurep (quote native-sound))) (device-sound-enabled-p)))) ("audio/au" mm-inline-audio (lambda (handle) (and (or (featurep (quote nas-sound)) (featurep (quote native-sound))) (device-sound-enabled-p)))) ("application/pgp-signature" ignore identity) ("multipart/alternative" ignore identity) ("multipart/mixed" ignore identity) ("multipart/related" ignore identity))))) 
     30 
    3531(custom-set-faces 
    3632 '(default ((t (:size "12pt" :family "Fixed"))) t)) 
  • incubator/.elisp/ini/ini-testing.el

    r44 r45  
    159159    (next-line) 
    160160    (re-search-backward "^ *def *\\(test_[a-zA-Z_]+\\)") 
     161    (buffer-substring (match-beginning 1) (match-end 1)))) 
     162 
     163(defun rel-find-test-spec-method-name () 
     164  "Return the name of the current test/spec method." 
     165  (save-excursion 
     166    (next-line) 
     167    (re-search-backward "^ *it \\([a-zA-Z]+\\)") 
    161168    (buffer-substring (match-beginning 1) (match-end 1)))) 
    162169 
     
    299306                file-name "--" (concat "-n" method-name))) )))) 
    300307 
     308(defun rel-run-test-spec-method (arg) 
     309  "Run the current focused test method." 
     310  (interactive "P") 
     311  (jw-take-down-test-buffer) 
     312  (let* ((file-name (buffer-file-name)) 
     313         (default-directory (jw-find-project-top file-name)) ) 
     314    (if (not (jw-test-file-name-p file-name)) 
     315        (progn 
     316          (jw-toggle-buffer) 
     317          (setq file-name (buffer-file-name)) )) 
     318    (save-buffer) 
     319    (setq jw-testing-last-test-buffer (buffer-name)) 
     320    (let ((method-name (rel-find-test-spec-method-name))) 
     321      (cond ((null default-directory) (message "Cannot find project top")) 
     322            ((null arg) 
     323             (jw-prep-test-buffer) 
     324             (jw-test-start-process 
     325              jw-ruby-command jw-test-options 
     326              file-name (concat "-n" method-name)) 
     327             (jw-insert_headers 
     328              "= Test Method ...\n" 
     329              "== File: " (file-name-nondirectory file-name) "\n" 
     330              "== Method: " method-name "\n\n")) 
     331            (t (jw-prep-test-buffer) 
     332               (jw-test-start-debugging 
     333                jw-rdebug-command jw-test-options 
     334                file-name "--" (concat "-n" method-name))) )))) 
     335 
    301336;;; -- Toggle Enhancements ------------------------------------------- 
    302337 
     
    390425(global-set-key "\C-Ctf" 'jw-run-test-file) 
    391426(global-set-key "\C-Ctm" 'jw-run-test-method) 
     427(global-set-key "\C-Ctp" 'rel-run-test-spec-method) 
    392428 
    393429(global-set-key "\C-Ct1" (lambda () (interactive)(setq jw-testing-single-window t)))