From 19594366789090aec9b7527ae5676ad2b4c129b2 Mon Sep 17 00:00:00 2001 From: Bozhidar Batsov Date: Wed, 20 Nov 2013 13:51:12 +0200 Subject: [PATCH] * test/automated/ruby-mode-tests.el: Add a few tests for `ruby--insert-coding-comment'. --- test/automated/ruby-mode-tests.el | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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 -- 2.39.2