summaryrefslogtreecommitdiff
path: root/test/prism/result/heredoc_test.rb
blob: 7913c04a88ec6e12032682dc4930c8cae864cedc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true

require_relative "../test_helper"

module Prism
  class HeredocTest < TestCase
    def test_heredoc?
      refute Prism.parse_statement("\"foo\"").heredoc?
      refute Prism.parse_statement("\"foo \#{1}\"").heredoc?
      refute Prism.parse_statement("`foo`").heredoc?
      refute Prism.parse_statement("`foo \#{1}`").heredoc?

      assert Prism.parse_statement("<<~HERE\nfoo\nHERE\n").heredoc?
      assert Prism.parse_statement("<<~HERE\nfoo \#{1}\nHERE\n").heredoc?
      assert Prism.parse_statement("<<~`HERE`\nfoo\nHERE\n").heredoc?
      assert Prism.parse_statement("<<~`HERE`\nfoo \#{1}\nHERE\n").heredoc?
    end
  end
end