<commit_before>require 'teststrap'

context 'Sicuro (pre-#setup)' do
  asserts 'Sicuro.new.eval("1") runs Sicuro#setup' do
    Sicuro.new.eval("1")
    Sicuro.class_variable_get('@@timelimit').is_a?(Fixnum) rescue false
  end
end

cannot_load_error    = "NotImplementedError: a sandboxed version of `load' has not been implemented yet. Could not load %s." # Use: cannot_load_error % filename
cannot_require_error = "NotImplementedError: a sandboxed version of `require' has not been implemented yet. Could not require %s." # Use: cannot_require_error % filename

context 'Sicuro - ' do
  setup { s = Sicuro.new; s.setup(5, 100); s }

  context 'sandbox integrity' do
    # http://duckinator.net/blog/sicuro-untrusted-code-execution/<commit_msg>Add test to make sure ENV is replaced.<commit_after>require 'teststrap'

context 'Sicuro (pre-#setup)' do
  asserts 'Sicuro.new.eval("1") runs Sicuro#setup' do
    Sicuro.new.eval("1")
    Sicuro.class_variable_get('@@timelimit').is_a?(Fixnum) rescue false
  end
end

cannot_load_error    = "NotImplementedError: a sandboxed version of `load' has not been implemented yet. Could not load %s." # Use: cannot_load_error % filename
cannot_require_error = "NotImplementedError: a sandboxed version of `require' has not been implemented yet. Could not require %s." # Use: cannot_require_error % filename

context 'Sicuro - ' do
  setup { s = Sicuro.new; s.setup(5, 100); s }

  context 'replaced constants' do
    asserts(:eval_return, 'ENV').equals(Sicuro::Runtime::Constants::ENV.inspect)
  end

  context 'sandbox integrity' do
    # http://duckinator.net/blog/sicuro-untrusted-code-execution/
{'fraction_non_alphanumeric': 0.1180428134556575, 'fraction_numerical': 0.007339449541284404, 'mean_word_length': 4.700348432055749, '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': '767159', 'n_tokens_mistral': 556, 'n_tokens_neox': 541, 'n_words': 151}