Sha256: 05d728cbb5579c8fdaa3a8ca29dc21fe9a3f0f06ca51e36253cc94c1b8ff7c77

Contents?: true

Size: 1.39 KB

Versions: 10

Compression:

Stored size: 1.39 KB

Contents

require 'test_helper'

class RawTagTest < Minitest::Test
  include Liquid

  def test_tag_in_raw
    assert_template_result '{% comment %} test {% endcomment %}',
      '{% raw %}{% comment %} test {% endcomment %}{% endraw %}'
  end

  def test_output_in_raw
    assert_template_result '{{ test }}', '{% raw %}{{ test }}{% endraw %}'
  end

  def test_open_tag_in_raw
    assert_template_result ' Foobar {% invalid ', '{% raw %} Foobar {% invalid {% endraw %}'
    assert_template_result ' Foobar invalid %} ', '{% raw %} Foobar invalid %} {% endraw %}'
    assert_template_result ' Foobar {{ invalid ', '{% raw %} Foobar {{ invalid {% endraw %}'
    assert_template_result ' Foobar invalid }} ', '{% raw %} Foobar invalid }} {% endraw %}'
    assert_template_result ' Foobar {% invalid {% {% endraw ', '{% raw %} Foobar {% invalid {% {% endraw {% endraw %}'
    assert_template_result ' Foobar {% {% {% ', '{% raw %} Foobar {% {% {% {% endraw %}'
    assert_template_result ' test {% raw %} {% endraw %}', '{% raw %} test {% raw %} {% {% endraw %}endraw %}'
    assert_template_result ' Foobar {{ invalid 1', '{% raw %} Foobar {{ invalid {% endraw %}{{ 1 }}'
  end

  def test_invalid_raw
    assert_match_syntax_error(/tag was never closed/, '{% raw %} foo')
    assert_match_syntax_error(/Valid syntax/, '{% raw } foo {% endraw %}')
    assert_match_syntax_error(/Valid syntax/, '{% raw } foo %}{% endraw %}')
  end
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
liquid-4.0.4 test/integration/tags/raw_tag_test.rb
metanorma-cli-1.3.4 gems/ruby/2.6.0/gems/liquid-4.0.3/test/integration/tags/raw_tag_test.rb
metanorma-cli-1.3.3.1 gems/ruby/2.6.0/gems/liquid-4.0.3/test/integration/tags/raw_tag_test.rb
liquid-4.0.3 test/integration/tags/raw_tag_test.rb
liquid-4.0.2 test/integration/tags/raw_tag_test.rb
liquid-4-0-2-4.0.2 test/integration/tags/raw_tag_test.rb
liquid-4.0.1 test/integration/tags/raw_tag_test.rb
liquid-4.0.0 test/integration/tags/raw_tag_test.rb
liquid-4.0.0.rc3 test/integration/tags/raw_tag_test.rb
liquid-4.0.0.rc2 test/integration/tags/raw_tag_test.rb