[ruby/prism] Wire up options through the Ruby API

8582d372a3
This commit is contained in:
Kevin Newton 2023-11-02 12:48:19 -04:00
parent 2a0f2b7763
commit ca7297efd3
No known key found for this signature in database
GPG key ID: 0EAD74C79EC73F26
4 changed files with 288 additions and 100 deletions

View file

@ -8,12 +8,12 @@ module Prism
filepath = __FILE__
source = File.read(filepath, binmode: true, external_encoding: Encoding::UTF_8)
assert_equal Prism.lex(source, filepath).value, Prism.lex_file(filepath).value
assert_equal Prism.dump(source, filepath), Prism.dump_file(filepath)
assert_equal Prism.lex(source, filepath: filepath).value, Prism.lex_file(filepath).value
assert_equal Prism.dump(source, filepath: filepath), Prism.dump_file(filepath)
serialized = Prism.dump(source, filepath)
serialized = Prism.dump(source, filepath: filepath)
ast1 = Prism.load(source, serialized).value
ast2 = Prism.parse(source, filepath).value
ast2 = Prism.parse(source, filepath: filepath).value
ast3 = Prism.parse_file(filepath).value
assert_equal_nodes ast1, ast2