mirror of
https://github.com/ruby/ruby.git
synced 2025-08-24 21:44:30 +02:00

This should make it easier on the sync to determine what changed
and hopefully result in fewer merge conflicts that have to be
manually resolved.
17d82afbfc
26 lines
713 B
Ruby
26 lines
713 B
Ruby
# frozen_string_literal: true
|
|
|
|
require_relative "test_helper"
|
|
|
|
return if YARP::BACKEND == :FFI
|
|
|
|
class ParseSerializeTest < Test::Unit::TestCase
|
|
def test_parse_serialize
|
|
dumped = YARP.const_get(:Debug).parse_serialize_file(__FILE__)
|
|
result = YARP.load(File.read(__FILE__), dumped)
|
|
|
|
assert_kind_of YARP::ParseResult, result, "Expected the return value to be a ParseResult"
|
|
assert_equal __FILE__, find_file_node(result)&.filepath, "Expected the filepath to be set correctly"
|
|
end
|
|
|
|
private
|
|
|
|
def find_file_node(result)
|
|
queue = [result.value]
|
|
|
|
while (node = queue.shift)
|
|
return node if node.is_a?(YARP::SourceFileNode)
|
|
queue.concat(node.child_nodes.compact)
|
|
end
|
|
end
|
|
end
|