summaryrefslogtreecommitdiff
path: root/test/prism/result/string_test.rb
blob: 48c7f592eb9406a89cc84ee57e64b09379c3b6d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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