Skip to content

Commit

Permalink
Ensure newlines are sorted in newline test
Browse files Browse the repository at this point in the history
  • Loading branch information
kddnewton committed Sep 26, 2023
1 parent c1707f6 commit 3bfefc4
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions test/yarp/newline_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,6 @@

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
Expand Down Expand Up @@ -99,7 +85,7 @@ def yarp_lines(result)
newlines << result.source.line(node.location.start_offset) if node&.newline?
end

newlines
newlines.sort
end
end
end

0 comments on commit 3bfefc4

Please sign in to comment.