[ruby/prism] Frozen strings in the AST

8d9d429155
This commit is contained in:
Kevin Newton 2024-12-20 16:52:10 -05:00 committed by git
parent 48749afe61
commit 14b9098459
6 changed files with 42 additions and 9 deletions

View file

@ -0,0 +1,32 @@
# frozen_string_literal: true
require_relative "../test_helper"
module Prism
class StringTest < TestCase
def test_regular_expression_node_unescaped_frozen
node = Prism.parse_statement("/foo/")
assert_predicate node.unescaped, :frozen?
end
def test_source_file_node_filepath_frozen
node = Prism.parse_statement("__FILE__")
assert_predicate node.filepath, :frozen?
end
def test_string_node_unescaped_frozen
node = Prism.parse_statement('"foo"')
assert_predicate node.unescaped, :frozen?
end
def test_symbol_node_unescaped_frozen
node = Prism.parse_statement(":foo")
assert_predicate node.unescaped, :frozen?
end
def test_xstring_node_unescaped_frozen
node = Prism.parse_statement("`foo`")
assert_predicate node.unescaped, :frozen?
end
end
end