We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dddfb29 commit a723f40Copy full SHA for a723f40
test/ruby_api_test.rb
@@ -0,0 +1,22 @@
1
+# frozen_string_literal: true
2
+
3
+require "yarp_test_helper"
4
5
+class YARPRubyAPITest < Test::Unit::TestCase
6
+ def test_ruby_api
7
+ filepath = __FILE__
8
+ source = File.read(filepath, binmode: true, external_encoding: Encoding::UTF_8)
9
10
+ assert_equal YARP.lex(source, filepath).value, YARP.lex_file(filepath).value
11
12
+ assert_equal YARP.dump(source, filepath), YARP.dump_file(filepath)
13
14
+ serialized = YARP.dump(source, filepath)
15
+ ast1 = YARP.load(source, serialized).value
16
+ ast2 = YARP.parse(source, filepath).value
17
+ ast3 = YARP.parse_file(filepath).value
18
19
+ assert_equal_nodes ast1, ast2
20
+ assert_equal_nodes ast2, ast3
21
+ end
22
+end
0 commit comments