diff --git a/rakelib/check_manifest.rake b/rakelib/check_manifest.rake index d557c37455f..3746e8751ac 100644 --- a/rakelib/check_manifest.rake +++ b/rakelib/check_manifest.rake @@ -12,6 +12,7 @@ task :check_manifest => [:templates] do autom4te.cache bin build + doc fuzz java pkg diff --git a/test/yarp/newline_test.rb b/test/yarp/newline_test.rb index ba82b5ef45d..7fb6d173bb0 100644 --- a/test/yarp/newline_test.rb +++ b/test/yarp/newline_test.rb @@ -36,12 +36,7 @@ def assert_newlines(base, relative) result = YARP.parse_file(filepath) assert_empty result.errors - - result.mark_newlines! - visitor = NewlineVisitor.new(result.source) - - result.value.accept(visitor) - actual = visitor.newlines + actual = yarp_lines(result) source.each_line.with_index(1) do |line, line_number| # Lines like `while (foo = bar)` result in two line flags in the @@ -92,5 +87,19 @@ def rubyvm_lines(source) lines.sort end + + def yarp_lines(result) + result.mark_newlines! + + queue = [result.value] + newlines = [] + + while node = queue.shift + queue.concat(node.compact_child_nodes) + newlines << result.source.line(node.location.start_offset) if node&.newline? + end + + newlines + end end end