зеркало из https://github.com/github/ruby.git
[ruby/yarp] Ensure newlines are sorted in newline test
https://github.com/ruby/yarp/commit/3bfefc44c4
This commit is contained in:
Родитель
a436805d3b
Коммит
705bd6439d
|
@ -6,20 +6,6 @@ return unless defined?(RubyVM::InstructionSequence)
|
|||
|
||||
module YARP
|
||||
class NewlineTest < TestCase
|
||||
class NewlineVisitor < Visitor
|
||||
attr_reader :source, :newlines
|
||||
|
||||
def initialize(source)
|
||||
@source = source
|
||||
@newlines = []
|
||||
end
|
||||
|
||||
def visit(node)
|
||||
newlines << source.line(node.location.start_offset) if node&.newline?
|
||||
super(node)
|
||||
end
|
||||
end
|
||||
|
||||
base = File.dirname(__dir__)
|
||||
Dir["{lib,test}/**/*.rb", base: base].each do |relative|
|
||||
define_method("test_newline_flags_#{relative}") do
|
||||
|
@ -99,7 +85,7 @@ module YARP
|
|||
newlines << result.source.line(node.location.start_offset) if node&.newline?
|
||||
end
|
||||
|
||||
newlines
|
||||
newlines.sort
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче