<commit_before>require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../fixtures/classes', __FILE__)

describe "String.new" do
  it "returns an instance of String" do
    str = String.new
    str.should be_an_instance_of(String)
  end

  ruby_version_is "2.3" do
    it "accepts an encoding argument" do
      str = String.new("\xA4\xA2", encoding: 'euc-jp')
      str.encoding.should == Encoding::EUC_JP
    end
  end

  it "returns a fully-formed String" do
    str = String.new
    str.size.should == 0
    str << "more"
    str.should == "more"
  end

  it "returns a new string given a string argument" do<commit_msg>Fix encoding in core/string/new_spec.rb<commit_after>require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../fixtures/classes', __FILE__)

describe "String.new" do
  it "returns an instance of String" do
    str = String.new
    str.should be_an_instance_of(String)
  end

  ruby_version_is "2.3" do
    it "accepts an encoding argument" do
      xA4xA2 = [0xA4, 0xA2].pack('CC').force_encoding 'utf-8'
      str = String.new(xA4xA2, encoding: 'euc-jp')
      str.encoding.should == Encoding::EUC_JP
    end
  end

  it "returns a fully-formed String" do
    str = String.new
    str.size.should == 0
    str << "more"
    str.should == "more"
  end

  it "returns a new string given a string argument" do
{'fraction_non_alphanumeric': 0.12661870503597122, 'fraction_numerical': 0.01223021582733813, 'mean_word_length': 3.0791788856304985, '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': '5250557', 'n_tokens_mistral': 485, 'n_tokens_neox': 466, 'n_words': 132}