From 9fdb41d8ba11afebc5818d96a1a6ef16192cc8bf Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Thu, 26 Oct 2023 15:40:15 -0400 Subject: [PATCH] Fix up newline test --- test/prism/newline_test.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/prism/newline_test.rb b/test/prism/newline_test.rb index 6fd0aee2d50..3a2892b9706 100644 --- a/test/prism/newline_test.rb +++ b/test/prism/newline_test.rb @@ -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 @@ -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