From: Bozhidar Batsov Date: Wed, 20 Nov 2013 11:51:12 +0000 (+0200) Subject: * test/automated/ruby-mode-tests.el: X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~771 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=19594366789090aec9b7527ae5676ad2b4c129b2;p=emacs.git * test/automated/ruby-mode-tests.el: Add a few tests for `ruby--insert-coding-comment'. --- diff --git a/test/automated/ruby-mode-tests.el b/test/automated/ruby-mode-tests.el index efed67d9d91..9c121169756 100644 --- a/test/automated/ruby-mode-tests.el +++ b/test/automated/ruby-mode-tests.el @@ -619,6 +619,26 @@ VALUES-PLIST is a list with alternating index and value elements." (ruby-backward-sexp) (should (= 2 (line-number-at-pos))))) +(ert-deftest ruby--insert-coding-comment-ruby-style () + (with-temp-buffer + (let ((ruby-encoding-magic-comment-style 'ruby)) + (ruby--insert-coding-comment "utf-8") + (should (string= "# coding: utf-8\n" (buffer-string)))))) + +(ert-deftest ruby--insert-coding-comment-emacs-style () + (with-temp-buffer + (let ((ruby-encoding-magic-comment-style 'emacs)) + (ruby--insert-coding-comment "utf-8") + (should (string= "# -*- coding: utf-8 -*-\n" (buffer-string)))))) + +(ert-deftest ruby--insert-coding-comment-custom-style () + (with-temp-buffer + (let ((ruby-encoding-magic-comment-style 'custom) + (ruby-custom-encoding-magic-comment-template "# encoding: %s\n")) + (ruby--insert-coding-comment "utf-8") + (should (string= "# encoding: utf-8\n\n" (buffer-string)))))) + + (provide 'ruby-mode-tests) ;;; ruby-mode-tests.el ends here