Shopify / liquid

Liquid markup language. Safe, customer facing template language for flexible web apps.
https://shopify.github.io/liquid/
MIT License
11.13k stars 1.39k forks source link

Integration test failures in inline_comment_test.rb #1699

Open Apteryks opened 1 year ago

Apteryks commented 1 year ago

Hello,

While packaging this for GNU Guix, I encountered the following failures:

[...]
Finished in 0.243319s, 3061.8262 runs/s, 7303.1747 assertions/s.

745 runs, 1777 assertions, 0 failures, 0 errors, 0 skips
/tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/strainer_template.rb:36: warning: instance variable @filter_methods not initialized
/gnu/store/07zmrggk70ldlgcsflgvah8i9i4d8z26-ruby-liquid-c-bootstrap-4.1.0/lib/ruby/vendor_ruby/gems/liquid-c-4.1.0/lib/liquid/c.rb:87: warning: method redefined; discarding old parse_expression
/tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/parse_context.rb:30: warning: previous definition of parse_expression was here
/tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/strainer_template.rb:36: warning: instance variable @filter_methods not initialized
-- LAX ERROR MODE
-- LIQUID C
Run options: --seed 8471

# Running:

....................................................................................................................../tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/strainer_template.rb:36: warning: instance variable @filter_methods not initialized
........................................................................................../tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/strainer_template.rb:36: warning: instance variable @filter_methods not initialized
.EEEEEEF/tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/strainer_template.rb:36: warning: instance variable @filter_methods not initialized
................................................................................................................................................................................................................................................................................................................................................................................../tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/strainer_template.rb:36: warning: instance variable @filter_methods not initialized
.

Finished in 0.213339s, 2751.4906 runs/s, 6576.3907 assertions/s.

  1) Error:
InlineCommentTest#test_inline_comment_does_not_require_a_space_after_the_pound_sign:
Liquid::SyntaxError: Liquid syntax error (line 1): Unknown tag '#this is an inline comment'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/document.rb:36:in `unknown_tag'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/document.rb:57:in `block in parse_body'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/document.rb:55:in `parse'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/document.rb:55:in `parse_body'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/document.rb:23:in `parse'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/document.rb:7:in `parse'
    /gnu/store/07zmrggk70ldlgcsflgvah8i9i4d8z26-ruby-liquid-c-bootstrap-4.1.0/lib/ruby/vendor_ruby/gems/liquid-c-4.1.0/lib/liquid/c.rb:120:in `parse'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/template.rb:111:in `parse'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/template.rb:97:in `parse'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/test/test_helper.rb:41:in `assert_template_result'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/test/integration/tags/inline_comment_test.rb:16:in `test_inline_comment_does_not_require_a_space_after_the_pound_sign'

  2) Error:
InlineCommentTest#test_inline_comment_does_not_support_nested_tags:
Liquid::SyntaxError: Liquid syntax error (line 1): Unknown tag ' # {% echo 'hello world' '
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/document.rb:36:in `unknown_tag'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/document.rb:57:in `block in parse_body'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/document.rb:55:in `parse'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/document.rb:55:in `parse_body'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/document.rb:23:in `parse'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/document.rb:7:in `parse'
    /gnu/store/07zmrggk70ldlgcsflgvah8i9i4d8z26-ruby-liquid-c-bootstrap-4.1.0/lib/ruby/vendor_ruby/gems/liquid-c-4.1.0/lib/liquid/c.rb:120:in `parse'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/template.rb:111:in `parse'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/template.rb:97:in `parse'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/test/test_helper.rb:41:in `assert_template_result'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/test/integration/tags/inline_comment_test.rb:67:in `test_inline_comment_does_not_support_nested_tags'

  3) Error:
InlineCommentTest#test_inline_comment_multiple_pound_signs:
Liquid::SyntaxError: Liquid syntax error (line 2): Unknown tag '######################################'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/block.rb:47:in `raise_unknown_tag'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/block_body.rb:65:in `unknown_tag_in_liquid_tag'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/document.rb:55:in `parse'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/document.rb:55:in `parse_body'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/document.rb:23:in `parse'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/document.rb:7:in `parse'
    /gnu/store/07zmrggk70ldlgcsflgvah8i9i4d8z26-ruby-liquid-c-bootstrap-4.1.0/lib/ruby/vendor_ruby/gems/liquid-c-4.1.0/lib/liquid/c.rb:120:in `parse'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/template.rb:111:in `parse'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/template.rb:97:in `parse'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/test/test_helper.rb:41:in `assert_template_result'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/test/integration/tags/inline_comment_test.rb:48:in `test_inline_comment_multiple_pound_signs'

  4) Error:
InlineCommentTest#test_inline_comment_can_be_written_on_multiple_lines:
Liquid::SyntaxError: Liquid syntax error (line 1): Unknown tag '
  # That kind of block comment is also allowed.
  # It would only be a stylistic difference.

  # Much like JavaScript's /* */ comments and their
  # leading * on new lines.
'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/document.rb:36:in `unknown_tag'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/document.rb:57:in `block in parse_body'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/document.rb:55:in `parse'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/document.rb:55:in `parse_body'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/document.rb:23:in `parse'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/document.rb:7:in `parse'
    /gnu/store/07zmrggk70ldlgcsflgvah8i9i4d8z26-ruby-liquid-c-bootstrap-4.1.0/lib/ruby/vendor_ruby/gems/liquid-c-4.1.0/lib/liquid/c.rb:120:in `parse'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/template.rb:111:in `parse'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/template.rb:97:in `parse'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/test/test_helper.rb:41:in `assert_template_result'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/test/integration/tags/inline_comment_test.rb:36:in `test_inline_comment_can_be_written_on_multiple_lines'

  5) Error:
InlineCommentTest#test_inline_comment_returns_nothing:
Liquid::SyntaxError: Liquid syntax error (line 1): Unknown tag ' # this is an inline comment '
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/document.rb:36:in `unknown_tag'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/document.rb:57:in `block in parse_body'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/document.rb:55:in `parse'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/document.rb:55:in `parse_body'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/document.rb:23:in `parse'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/document.rb:7:in `parse'
    /gnu/store/07zmrggk70ldlgcsflgvah8i9i4d8z26-ruby-liquid-c-bootstrap-4.1.0/lib/ruby/vendor_ruby/gems/liquid-c-4.1.0/lib/liquid/c.rb:120:in `parse'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/template.rb:111:in `parse'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/template.rb:97:in `parse'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/test/test_helper.rb:41:in `assert_template_result'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/test/integration/tags/inline_comment_test.rb:9:in `test_inline_comment_returns_nothing'

  6) Error:
InlineCommentTest#test_liquid_inline_comment_returns_nothing:
Liquid::SyntaxError: Liquid syntax error (line 2): Unknown tag '# This is how you'd write a block comment in a liquid tag.'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/block.rb:47:in `raise_unknown_tag'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/block_body.rb:65:in `unknown_tag_in_liquid_tag'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/document.rb:55:in `parse'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/document.rb:55:in `parse_body'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/document.rb:23:in `parse'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/document.rb:7:in `parse'
    /gnu/store/07zmrggk70ldlgcsflgvah8i9i4d8z26-ruby-liquid-c-bootstrap-4.1.0/lib/ruby/vendor_ruby/gems/liquid-c-4.1.0/lib/liquid/c.rb:120:in `parse'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/template.rb:111:in `parse'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/lib/liquid/template.rb:97:in `parse'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/test/test_helper.rb:41:in `assert_template_result'
    /tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/test/integration/tags/inline_comment_test.rb:20:in `test_liquid_inline_comment_returns_nothing'

  7) Failure:
InlineCommentTest#test_inline_comments_require_the_pound_sign_on_every_new_line [/tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/test/integration/tags/inline_comment_test.rb:58]:
Expected /Each\ line\ of\ comments\ must\ be\ prefixed\ by\ the\ '\#'\ character/ to match "Liquid syntax error (line 1): Unknown tag '\n  # some comment\n  echo 'hello world'\n'".

587 runs, 1403 assertions, 1 failures, 6 errors, 0 skips
rake aborted!
Command failed with status (1)
/tmp/guix-build-ruby-liquid-5.4.0.drv-0/source/Rakefile:50:in `block in <top (required)>'
Tasks: TOP => integration_test
(See full trace by running task with --trace)
error: in phase 'check': uncaught exception:
%exception #<&invoke-error program: "rake" arguments: ("test") exit-status: 1 term-signal: #f stop-signal: #f> 
phase `check' failed after 1.1 seconds
command "rake" "test" failed with status 1

The version is 5.4.0 with Ruby 2.7.4, and the direct dependency versions are at:

ruby-liquid-c-bootstrap@4.1.0 ruby-rspec@3.12.0 ruby-stackprof@0.2.17

I've deleted the inline_comment_test.rb test file to get around the failure. I hope this report is useful!

Thanks!