summaryrefslogtreecommitdiff
path: root/test/irb
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2020-06-09 00:10:14 +0900
committeraycabta <aycabta@gmail.com>2020-07-22 02:31:47 +0900
commit4268084d699922d7650b0bf6327042f3331d5ca3 (patch)
treea43378ef733c1322469076675b601e917c311a7b /test/irb
parentc72a2fad9717a6090aa792c31eb0043886d0fb39 (diff)
[ruby/irb] Add encoding magic comments of editors
https://github.com/ruby/irb/commit/f8c10ea24b
Diffstat (limited to 'test/irb')
-rw-r--r--test/irb/test_ruby_lex.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/irb/test_ruby_lex.rb b/test/irb/test_ruby_lex.rb
index bc5b4feaf7..7768a6a5dd 100644
--- a/test/irb/test_ruby_lex.rb
+++ b/test/irb/test_ruby_lex.rb
@@ -152,5 +152,31 @@ module TestIRB
assert_indenting(lines, row.new_line_spaces, true)
end
end
+
+ def test_incomplete_emacs_coding_magic_comment
+ input_with_correct_indents = [
+ Row.new(%q(# -*- coding: u), nil, 0),
+ ]
+
+ lines = []
+ input_with_correct_indents.each do |row|
+ lines << row.content
+ assert_indenting(lines, row.current_line_spaces, false)
+ assert_indenting(lines, row.new_line_spaces, true)
+ end
+ end
+
+ def test_incomplete_vim_coding_magic_comment
+ input_with_correct_indents = [
+ Row.new(%q(# vim:set fileencoding=u), nil, 0),
+ ]
+
+ lines = []
+ input_with_correct_indents.each do |row|
+ lines << row.content
+ assert_indenting(lines, row.current_line_spaces, false)
+ assert_indenting(lines, row.new_line_spaces, true)
+ end
+ end
end
end