ruby-changes:62339
From: aycabta <ko1@a...>
Date: Wed, 22 Jul 2020 02:42:15 +0900 (JST)
Subject: [ruby-changes:62339] 4268084d69 (master): [ruby/irb] Add encoding magic comments of editors
https://git.ruby-lang.org/ruby.git/commit/?id=4268084d69 From 4268084d699922d7650b0bf6327042f3331d5ca3 Mon Sep 17 00:00:00 2001 From: aycabta <aycabta@g...> Date: Tue, 9 Jun 2020 00:10:14 +0900 Subject: [ruby/irb] Add encoding magic comments of editors https://github.com/ruby/irb/commit/f8c10ea24b diff --git a/test/irb/test_ruby_lex.rb b/test/irb/test_ruby_lex.rb index bc5b4fe..7768a6a 100644 --- a/test/irb/test_ruby_lex.rb +++ b/test/irb/test_ruby_lex.rb @@ -152,5 +152,31 @@ module TestIRB https://github.com/ruby/ruby/blob/trunk/test/irb/test_ruby_lex.rb#L152 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 -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/