<commit_before># -*- encoding: binary -*-

describe :regexp_quote, shared: true do
  it "escapes any characters with special meaning in a regular expression" do
    Regexp.send(@method, '\*?{}.+^[]()- ').should == '\\\\\*\?\{\}\.\+\^\[\]\(\)\-\\ '
    Regexp.send(@method, "\*?{}.+^[]()- ").should == '\\*\\?\\{\\}\\.\\+\\^\\[\\]\\(\\)\\-\\ '
    Regexp.send(@method, '\n\r\f\t').should == '\\\\n\\\\r\\\\f\\\\t'
    Regexp.send(@method, "\n\r\f\t").should == '\\n\\r\\f\\t'
  end

  it "works with symbols" do
    Regexp.send(@method, :symbol).should == 'symbol'
  end

  it "works with substrings" do
    str = ".+[]()"[1...-1]
    Regexp.send(@method, str).should == '\+\[\]\('
  end

  it "sets the encoding of the result to US-ASCII if there are only US-ASCII characters present in the input String" do
    str = "abc".force_encoding("euc-jp")
    Regexp.send(@method, str).encoding.should == Encoding::US_ASCII
  end
<commit_msg>Expand Regexp.quote specs<commit_after># -*- encoding: binary -*-

describe :regexp_quote, shared: true do
  it "escapes any characters with special meaning in a regular expression" do
    Regexp.send(@method, '\*?{}.+^[]()- ').should == '\\\\\*\?\{\}\.\+\^\[\]\(\)\-\\ '
    Regexp.send(@method, "\*?{}.+^[]()- ").should == '\\*\\?\\{\\}\\.\\+\\^\\[\\]\\(\\)\\-\\ '
    Regexp.send(@method, '\n\r\f\t').should == '\\\\n\\\\r\\\\f\\\\t'
    Regexp.send(@method, "\n\r\f\t").should == '\\n\\r\\f\\t'
  end

  it "works with symbols" do
    Regexp.send(@method, :symbol).should == 'symbol'
  end

  it "works with substrings" do
    str = ".+[]()"[1...-1]
    Regexp.send(@method, str).should == '\+\[\]\('
  end

  it "works for broken strings" do
    Regexp.send(@method, "a.\x85b.".force_encoding("US-ASCII")).should =="a\\.\x85b\\.".force_encoding("US-ASCII")
    Regexp.send(@method, "a.\x80".force_encoding("UTF-8")).should == "a\\.\x80".force_encoding("UTF-8")
  end

  it "sets the encoding of the result to US-ASCII if there are only US-ASCII characters present in the input String" do
    str = "abc".force_encoding("euc-jp")
    Regexp.send(@method, str).encoding.should == Encoding::US_ASCII
  end

{'fraction_non_alphanumeric': 0.2757816145590294, 'fraction_numerical': 0.006532897806812879, 'mean_word_length': 2.591289782244556, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5495650', 'n_tokens_mistral': 840, 'n_tokens_neox': 792, 'n_words': 169}