From 69b024d7ccb8d42bb0387a244dce4d444f619987 Mon Sep 17 00:00:00 2001 From: Vinicius Stock Date: Tue, 3 Oct 2023 15:29:29 -0400 Subject: [ruby/prism] Add full_name to ConstantPathNode and ConstantPathTargetNode https://github.com/ruby/prism/commit/b390553028 --- test/prism/constant_path_node_test.rb | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 test/prism/constant_path_node_test.rb (limited to 'test') diff --git a/test/prism/constant_path_node_test.rb b/test/prism/constant_path_node_test.rb new file mode 100644 index 0000000000..1a44fbaba5 --- /dev/null +++ b/test/prism/constant_path_node_test.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +require_relative "test_helper" + +module Prism + class ConstantPathNodeTest < TestCase + def test_full_name_for_constant_path + source = <<~RUBY + Foo:: # comment + Bar::Baz:: + Qux + RUBY + + constant_path = Prism.parse(source).value.statements.body.first + assert_equal("Foo::Bar::Baz::Qux", constant_path.full_name) + end + + def test_full_name_for_constant_path_target + source = <<~RUBY + Foo:: # comment + Bar::Baz:: + Qux, Something = [1, 2] + RUBY + + node = Prism.parse(source).value.statements.body.first + target = node.targets.first + assert_equal("Foo::Bar::Baz::Qux", target.full_name) + end + end +end -- cgit v1.2.3