<commit_before>require 'helper'

class TestSlimRubyErrors < TestSlim
  def test_multline_attribute
    source = %q{
p(data-1=1
data2-=1)
  p
    = unknown_ruby_method
}

    assert_ruby_error NameError, "test.slim:5", source, :file => 'test.slim'
  end

  def test_broken_output_line
    source = %q{
p = hello_world + \
  hello_world + \
  unknown_ruby_method
}

    # FIXME: Remove this hack!
    if RUBY_PLATFORM == "java"
      assert_ruby_error NameError, "test.slim:2", source, :file => 'test.slim'
    else
      assert_ruby_error NameError, "test.slim:4", source, :file => 'test.slim'
    end
  end

  def test_broken_output_line2
    source = %q{
p = hello_world + \
  hello_world
p Hello<commit_msg>add extended comment<commit_after>require 'helper'

class TestSlimRubyErrors < TestSlim
  def test_multline_attribute
    source = %q{
p(data-1=1
data2-=1)
  p
    = unknown_ruby_method
}

    assert_ruby_error NameError, "test.slim:5", source, :file => 'test.slim'
  end

  def test_broken_output_line
    source = %q{
p = hello_world + \
  hello_world + \
  unknown_ruby_method
}

    # FIXME: Remove this hack!
    # This is actually a jruby issue. Jruby reports a wrong
    # line number 1 in this case:
    #
    # test = 1+\
    #    unknown_variable
    if RUBY_PLATFORM == "java"
      assert_ruby_error NameError, "test.slim:2", source, :file => 'test.slim'
    else
      assert_ruby_error NameError, "test.slim:4", source, :file => 'test.slim'
    end
  end

  def test_broken_output_line2
    source = %q{
p = hello_world + \
  hello_world
p Hello
{'fraction_non_alphanumeric': 0.10586734693877552, 'fraction_numerical': 0.011479591836734694, 'mean_word_length': 3.2064343163538873, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '791816', 'n_tokens_mistral': 614, 'n_tokens_neox': 576, 'n_words': 138}