<commit_before>require 'minitest_helper'

class TestGit < Minitest::Test
  
  def setup
    Dir.mkdir '/tmp/temptest'
    Dir.chdir '/tmp/temptest'
  end
  
  def teardown
    Dir.chdir '/tmp'
    FileUtils.rm_rf 'temptest'
    ARGV.clear
  end
  
  def test_git_new_should_raise_exception
    assert_raises NoGitRepositoryError do
      Git.check_repo_existance
    end
  end
  
  def test_git_init_should_return_correct_output
    output = Git.init
    assert output.include?('Initialized empty Git repository')
    Dir.exists?('.git')
  end
  
  def test_git_commit_all_should_return_correct_output
    Git.init
    FileUtils.touch 'file.txt'
    Git.commit_all('test')
    output = Git.log
    assert output.include?('commit')
    assert output.include?('test')
  end
  
end<commit_msg>updated git library tests<commit_after>require 'minitest_helper'

class TestGit < Minitest::Test

  def setup
    Dir.mkdir '/tmp/peacock'
    Dir.chdir '/tmp/peacock'
  end

  def teardown
    FileUtils.rm_rf '/tmp/peacock'
    ARGV.clear
  end

  def test_git_new_should_raise_exception
    assert_raises NoGitRepositoryError do
      Git.check_repo_existance
    end
  end

  def test_git_init_should_return_correct_output
    output = Git.init
    assert output.include?('Initialized empty Git repository')
    Dir.exists?('.git')
  end

  def test_git_status_should_return_correct_output
    Git.init
    output = Git.status
    assert output.include?('Initial commit')
    assert output.include?('nothing to commit')
    FileUtils.touch 'file.txt'
    Git.commit_all('initial commit')

    output = Git.status
    assert output.include?('On branch master')
    assert output.include?('nothing to commit')

    FileUtils.rm 'file.txt'
    output = Git.status
    assert output.include?('Changes not staged for commit')
    assert output.include?('deleted')
    assert output.include?('file.txt')
  end

  def test_git_commit_all_should_return_correct_output
    Git.init
    FileUtils.touch 'file.txt'
    Git.commit_all('test')
    output = Git.log
    assert output.include?('commit')
    assert output.include?('test')
  end

  def test_git_remove_from_cache_should_work_as_expected
    Git.init
    FileUtils.touch 'file.txt'
    Git.commit_all 'initial commit'
    Git.remove_from_cache 'file.txt'
    output = Git.status
    assert output.include?('deleted')
    assert output.include?('file.txt')
  end

  def test_git_clear_cache_should_work_as_expected
    Git.init
    FileUtils.touch 'file.txt'
    FileUtils.touch 'file2.txt'
    Git.commit_all 'initial commit'
    Git.clear_cache
    output = Git.status
    assert output.include?('deleted')
    assert output.include?('file.txt')
    assert output.include?('file2.txt')
  end
end
{'fraction_non_alphanumeric': 0.09309967141292443, 'fraction_numerical': 0.0007301935012778386, 'mean_word_length': 3.440842787682334, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2080869', 'n_tokens_mistral': 915, 'n_tokens_neox': 898, 'n_words': 184}