riece-command-yank.
* test/test-riece-addon.el: New test cases.
* test/test-riece-yank.el: New test cases.
+2004-11-07 Daiki Ueno <ueno@unixuser.org>
+
+ * riece-yank.el (riece-yank-strip-space): New function split from
+ riece-command-yank.
+ * test/test-riece-addon.el: New test cases.
+ * test/test-riece-yank.el: New test cases.
+
+2004-11-05 Daiki Ueno <ueno@unixuser.org>
+
+ * COMPILE (riece-test): New function.
+ * Makefile.am (check-local): New target.
+ * test/luna.el: New file.
+ * test/lunit.el: New file.
+ * test/test-riece-alias.el: New test cases.
+
2004-11-05 Daiki Ueno <ueno@unixuser.org>
* riece-alias.el (riece-alias-alternate-separator): New user
(define-key riece-command-mode-map "\C-cy" 'undefined)
(setq riece-yank-enabled nil))
+(defun riece-yank-strip-space (string)
+ (with-temp-buffer
+ (insert string)
+ (untabify (point-min) (point-max))
+ ;; Delete blank lines before the first non-blank line.
+ (goto-char (point-min))
+ (while (looking-at " *$")
+ (delete-region (point) (progn (forward-line) (point))))
+ ;; Delete blank lines after the last non-blank line.
+ (goto-char (point-max))
+ (while (progn (beginning-of-line) (looking-at " *$"))
+ (delete-region (point) (progn (end-of-line 0) (point))))
+ ;; Delete common spaces in front of lines.
+ (setq space-width (point-max))
+ (while (looking-at " +")
+ (setq space-width (min space-width (length (match-string 0))))
+ (forward-line))
+ (goto-char (point-min))
+ (while (not (eobp))
+ (delete-char space-width)
+ (forward-line))
+ (buffer-string)))
+
(defun riece-command-yank (prefix)
(interactive "sPrefix: ")
(when (or (not prefix)
(unless kill
(error "Nothing to send in kill-ring"))
(if riece-yank-strip-space
- (with-temp-buffer
- (insert kill)
- (untabify (point-min) (point-max))
- ;; Delete blank lines before the first non-blank line.
- (goto-char (point-min))
- (while (looking-at " *$")
- (delete-region (point) (progn (forward-line) (point))))
- ;; Delete blank lines after the last non-blank line.
- (goto-char (point-max))
- (while (progn (beginning-of-line) (looking-at " *$"))
- (delete-region (point) (progn (end-of-line 0) (point))))
- ;; Delete common spaces in front of lines.
- (setq space-width (point-max))
- (while (looking-at " +")
- (setq space-width (min space-width (length (match-string 0))))
- (forward-line))
- (goto-char (point-min))
- (while (not (eobp))
- (delete-char space-width)
- (forward-line))
- (setq kill (buffer-string))))
+ (setq kill (riece-yank-strip-space kill)))
(setq msg (split-string kill "\n"))
(when (y-or-n-p (format "Send \"%s\"\n? " kill))
(mapcar
--- /dev/null
+(require 'riece-addon)
+
+(defun test-riece-addon-1-requires ()
+ '(test-riece-addon-2))
+(provide 'test-riece-addon-1)
+
+(defun test-riece-addon-2-requires ()
+ '(test-riece-addon-3 test-riece-addon-4))
+(provide 'test-riece-addon-2)
+
+(defun test-riece-addon-3-requires ())
+(provide 'test-riece-addon-3)
+
+(defun test-riece-addon-4-requires ())
+(provide 'test-riece-addon-4)
+
+(defun test-riece-addon-5-requires ()
+ '(test-riece-addon-6))
+(provide 'test-riece-addon-5)
+
+(defun test-riece-addon-6-requires ()
+ '(test-riece-addon-5))
+(provide 'test-riece-addon-6)
+
+(luna-define-class test-riece-addon (lunit-test-case))
+
+(luna-define-method test-riece-resolve-addons-1 ((case test-riece-addon))
+ (lunit-assert
+ (equal
+ (riece-resolve-addons '(test-riece-addon-1 test-riece-addon-2))
+ '(test-riece-addon-3 test-riece-addon-4
+ test-riece-addon-2 test-riece-addon-1))))
+
+(luna-define-method test-riece-resolve-addons-2 ((case test-riece-addon))
+ (lunit-assert
+ (equal
+ (condition-case error
+ (riece-resolve-addons '(test-riece-addon-5 test-riece-addon-6))
+ (error (nth 1 error)))
+ "Circular add-on dependency found")))
(luna-define-class test-riece-alias (lunit-test-case))
+(luna-define-method test-riece-alias-percent-hack ((case test-riece-alias))
+ (let ((riece-alias-percent-hack-mask "*.jp"))
+ (lunit-assert
+ (equal
+ (riece-alias-abbrev-percent-hack "#riece:*.jp")
+ "%riece"))
+ (lunit-assert
+ (equal
+ (riece-alias-expand-percent-hack "%riece")
+ "#riece:*.jp"))))
+
(luna-define-method test-riece-alias-altsep-1 ((case test-riece-alias))
(let ((riece-alias-alternate-separator "@"))
(lunit-assert
--- /dev/null
+(require 'riece-yank)
+
+(luna-define-class test-riece-yank (lunit-test-case))
+
+(luna-define-method test-riece-yank-strip-space ((case test-riece-yank))
+ (lunit-assert
+ (equal
+ (riece-yank-strip-space "\
+ def a
+ 0.times do
+ 0.times do
+ p 1 # this line begins with a TAB
+ end
+ end
+ end
+
+")
+ "\
+def a
+ 0.times do
+ 0.times do
+ p 1 # this line begins with a TAB
+ end
+ end
+end")))