<commit_before>require File.dirname(__FILE__) + '/../spec_helper'

$: << 'lib'
require 'pt_testcase'

class String

  ##
  # This form doesn't do the rubinius specific rewriting...  That's
  # fine for now, we don't need to test that here as the compiler is
  # all over that.
  def to_sexp
    require 'ruby_parser'

    RubyParser.new.process(self, "(string)")
  end
end

describe "String#to_sexp" do
  ParseTreeTestCase.testcases.each do |node, hash|
    next if Array === hash['Ruby']

    it "parses :#{node}" do
      expected = hash['ParseTree']
      actual   = hash['Ruby'].to_sexp
      expected.should == actual
    end
  end
end
<commit_msg>Make the spec helper version of String#to_sexp have the usual signature<commit_after>require File.dirname(__FILE__) + '/../spec_helper'

$: << 'lib'
require 'pt_testcase'

class String

  ##
  # This form doesn't do the rubinius specific rewriting...  That's
  # fine for now, we don't need to test that here as the compiler is
  # all over that.
  def to_sexp(file = '(string)', line = 1)
    require 'ruby_parser'

    RubyParser.new.process(self, file)
  end
end

describe "String#to_sexp" do
  ParseTreeTestCase.testcases.each do |node, hash|
    next if Array === hash['Ruby']

    it "parses :#{node}" do
      expected = hash['ParseTree']
      actual   = hash['Ruby'].to_sexp
      expected.should == actual
    end
  end
end

{'fraction_non_alphanumeric': 0.11968276856524873, 'fraction_numerical': 0.0007209805335255948, 'mean_word_length': 3.2576687116564416, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, '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': '7453378', 'n_tokens_mistral': 472, 'n_tokens_neox': 448, 'n_words': 145}