Skip to content

Commit

Permalink
Fix up newline test
Browse files Browse the repository at this point in the history
  • Loading branch information
kddnewton committed Oct 26, 2023
1 parent 5ae3b66 commit 9fdb41d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions test/prism/newline_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@

module Prism
class NewlineTest < TestCase
base = File.dirname(__dir__)
Dir["{lib,test}/**/*.rb", base: base].each do |relative|
base = File.expand_path("../", __FILE__)
filepaths = Dir["*.rb", base: base] - %w[unescape_test.rb]

filepaths.each do |relative|
define_method("test_newline_flags_#{relative}") do
assert_newlines(base, relative)
end
Expand Down Expand Up @@ -82,7 +84,7 @@ def prism_lines(result)

while node = queue.shift
queue.concat(node.compact_child_nodes)
newlines << result.source.line(node.location.start_offset) if node&.newline?
newlines << (result.source.line(node.location.start_offset) + 1) if node&.newline?
end

newlines.sort
Expand Down

0 comments on commit 9fdb41d

Please sign in to comment.