mirror of
https://github.com/ruby/ruby.git
synced 2025-08-25 22:14:37 +02:00
Resync YARP
This commit is contained in:
parent
957cd369fa
commit
3873b1eb39
Notes:
git
2023-08-17 00:47:57 +00:00
437 changed files with 9116 additions and 6733 deletions
22
test/yarp/ruby_api_test.rb
Normal file
22
test/yarp/ruby_api_test.rb
Normal file
|
@ -0,0 +1,22 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "yarp_test_helper"
|
||||
|
||||
class YARPRubyAPITest < Test::Unit::TestCase
|
||||
def test_ruby_api
|
||||
filepath = __FILE__
|
||||
source = File.read(filepath, binmode: true, external_encoding: Encoding::UTF_8)
|
||||
|
||||
assert_equal YARP.lex(source, filepath).value, YARP.lex_file(filepath).value
|
||||
|
||||
assert_equal YARP.dump(source, filepath), YARP.dump_file(filepath)
|
||||
|
||||
serialized = YARP.dump(source, filepath)
|
||||
ast1 = YARP.load(source, serialized).value
|
||||
ast2 = YARP.parse(source, filepath).value
|
||||
ast3 = YARP.parse_file(filepath).value
|
||||
|
||||
assert_equal_nodes ast1, ast2
|
||||
assert_equal_nodes ast2, ast3
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue