Skip to content

Commit f8c10ea

Browse files
committed
Add encoding magic comments of editors
1 parent e593cc6 commit f8c10ea

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

test/irb/test_ruby_lex.rb

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,5 +152,31 @@ def test_incomplete_encoding_magic_comment
152152
assert_indenting(lines, row.new_line_spaces, true)
153153
end
154154
end
155+
156+
def test_incomplete_emacs_coding_magic_comment
157+
input_with_correct_indents = [
158+
Row.new(%q(# -*- coding: u), nil, 0),
159+
]
160+
161+
lines = []
162+
input_with_correct_indents.each do |row|
163+
lines << row.content
164+
assert_indenting(lines, row.current_line_spaces, false)
165+
assert_indenting(lines, row.new_line_spaces, true)
166+
end
167+
end
168+
169+
def test_incomplete_vim_coding_magic_comment
170+
input_with_correct_indents = [
171+
Row.new(%q(# vim:set fileencoding=u), nil, 0),
172+
]
173+
174+
lines = []
175+
input_with_correct_indents.each do |row|
176+
lines << row.content
177+
assert_indenting(lines, row.current_line_spaces, false)
178+
assert_indenting(lines, row.new_line_spaces, true)
179+
end
180+
end
155181
end
156182
end

0 commit comments

Comments
 (0)