<commit_before>#!/usr/bin/env ruby
# encoding: UTF-8

$: << File.join(File.dirname(__FILE__), '..')

require 'helper'

class MimicSingle < Minitest::Test
  def test_mimic_single
    assert(defined?(JSON).nil?)
    Oj.mimic_JSON

    # Test constants
    assert(!defined?(JSON).nil?)
    assert(!defined?(JSON::ParserError).nil?)

    # Test loaded features
    assert(!require('json'))

    begin
      require('json_spec')
    rescue LoadError
      assert(true)
      return
    end
    assert(false, '** should raise LoadError')

    # Make sure to_json is define for object.
    {'a' => 1}.to_json()
    Object.new().to_json()
  end
end # MimicSingle
<commit_msg>Improve $LOADED_FEATURES: do not mess with return<commit_after>#!/usr/bin/env ruby
# encoding: UTF-8

$: << File.join(File.dirname(__FILE__), '..')

require 'helper'

class MimicSingle < Minitest::Test
  def test_mimic_single
    assert(defined?(JSON).nil?)
    Oj.mimic_JSON

    # Test constants
    assert(!defined?(JSON).nil?)
    assert(!defined?(JSON::ParserError).nil?)

    # Test loaded features
    assert(!require('json'))

    begin
      require('json_spec')
      assert(false, '** should raise LoadError')
    rescue LoadError
      assert(true)
    end

    # Make sure to_json is define for object.
    {'a' => 1}.to_json()
    Object.new().to_json()
  end
end # MimicSingle

{'fraction_non_alphanumeric': 0.14422369389256806, 'fraction_numerical': 0.0029433406916850625, 'mean_word_length': 3.2767295597484276, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, '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': '5812494', 'n_tokens_mistral': 467, 'n_tokens_neox': 457, 'n_words': 97}