<commit_before>require 'helper'

class Output
  def messages
    @messages ||= []
  end

  def puts(message)
    messages << message
  end
end

class TestTesler < Test::Unit::TestCase
  def setup
    FileUtils.rm_r("dest") if File.exists?("dest")

    @output = Output.new
    Tesler::Config.output = @output

    directory 'test\dest' do
      copy 'test\src\file1'
      copy 'test\src\file2'
      copy 'test\src\subdir1\file4'
    
      directory 'subdir1' do
        copy 'test\src\file3'
        copy 'test\src\subdir1\file5'
        copy 'c:\temp'
        
        directory 'subdir3' do
          copy 'test\src\file8'
          copy 'test\src\file9', :rename => 'renamed'
        end
      end
    
      copy 'test\src\subdir2'
      copy 'test\src\subdir2', :rename => 'renamed'
    end
  end

  should "copy files" do
    assert File.exists?("test/dest")
    assert File.exists?("test/dest/file1")
    assert File.exists?("test/dest/file2")
    assert File.exists?("test/dest/file4")
    assert File.exists?("test/dest/subdir1")
    assert File.exists?("test/dest/subdir1/file3")
    assert File.exists?("test/dest/subdir1/file5")
    assert File.exists?("test/dest/subdir1/temp")
    assert File.exists?("test/dest/subdir1/subdir3")
    assert File.exists?("test/dest/subdir1/subdir3/file8")
    assert File.exists?("test/dest/subdir1/subdir3/renamed")
    assert File.exists?("test/dest/subdir2")
    assert File.exists?("test/dest/renamed") 

    messages = @output.messages.map { |m| m.strip }
    assert_match messages[0],  /(create|exists)\ttest\/dest/
    assert_equal messages[1],  "copy\ttest/dest/file1"
    assert_equal messages[2],  "copy\ttest/dest/file2"
    assert_equal messages[3],  "copy\ttest/dest/file4"
    assert_match messages[4],  /(create|exists)\ttest\/dest\/subdir1/
    assert_equal messages[5],  "copy\ttest/dest/subdir1/file3"
    assert_equal messages[6],  "copy\ttest/dest/subdir1/file5"
    assert_equal messages[7],  "copy\ttest/dest/subdir1/temp"
    assert_match messages[8],  /(create|exists)\ttest\/dest\/subdir1\/subdir3/
    assert_equal messages[9],  "copy\ttest/dest/subdir1/subdir3/file8"
    assert_equal messages[10], "copy\ttest/dest/subdir1/subdir3/renamed"
    assert_equal messages[11], "copy\ttest/dest/subdir2"
    assert_equal messages[12], "copy\ttest/dest/renamed"
  end
end<commit_msg>update the tests for unix compatibility<commit_after>require 'helper'

class Output
  def messages
    @messages ||= []
  end

  def puts(message)
    messages << message
  end
end

class TestTesler < Test::Unit::TestCase
  def setup
    FileUtils.rm_r("dest") if File.exists?("dest")

    @output = Output.new
    Tesler::Config.output = @output

    directory 'test\dest' do
      copy 'test\src\file1'
      copy 'test\src\file2'
      copy 'test\src\subdir1\file4'
    
      directory 'subdir1' do
        copy 'test\src\file3'
        copy 'test\src\subdir1\file5'
        
        directory 'subdir3' do
          copy 'test\src\file8'
          copy 'test\src\file9', :rename => 'renamed'
        end
      end
    
      copy 'test\src\subdir2'
      copy 'test\src\subdir2', :rename => 'renamed'
    end
  end

  should "copy files" do
    assert File.exists?("test/dest")
    assert File.exists?("test/dest/file1")
    assert File.exists?("test/dest/file2")
    assert File.exists?("test/dest/file4")
    assert File.exists?("test/dest/subdir1")
    assert File.exists?("test/dest/subdir1/file3")
    assert File.exists?("test/dest/subdir1/file5")
    assert File.exists?("test/dest/subdir1/subdir3")
    assert File.exists?("test/dest/subdir1/subdir3/file8")
    assert File.exists?("test/dest/subdir1/subdir3/renamed")
    assert File.exists?("test/dest/subdir2")
    assert File.exists?("test/dest/renamed") 

    messages = @output.messages.map { |m| m.strip }
    assert_match messages[0],  /(create|exists)\ttest\/dest/
    assert_equal messages[1],  "copy\ttest/dest/file1"
    assert_equal messages[2],  "copy\ttest/dest/file2"
    assert_equal messages[3],  "copy\ttest/dest/file4"
    assert_match messages[4],  /(create|exists)\ttest\/dest\/subdir1/
    assert_equal messages[5],  "copy\ttest/dest/subdir1/file3"
    assert_equal messages[6],  "copy\ttest/dest/subdir1/file5"
    assert_match messages[7],  /(create|exists)\ttest\/dest\/subdir1\/subdir3/
    assert_equal messages[8],  "copy\ttest/dest/subdir1/subdir3/file8"
    assert_equal messages[9],  "copy\ttest/dest/subdir1/subdir3/renamed"
    assert_equal messages[10], "copy\ttest/dest/subdir2"
    assert_equal messages[11], "copy\ttest/dest/renamed"
  end
end
{'fraction_non_alphanumeric': 0.14661735914726995, 'fraction_numerical': 0.026539047204698716, 'mean_word_length': 3.112701252236136, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, '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': '6158888', 'n_tokens_mistral': 1665, 'n_tokens_neox': 1647, 'n_words': 273}