<commit_before>require  "#{File.dirname(__FILE__)}/../lib/windirs"

describe Windirs do

  before do
    @relatives = {
      :windows => '.\\somedir\\file',
      :cygwin  => './somedir/file',
      :rubywin => './somedir/file',
      :nix     => './somedir/file',
    }
    @rpaths = Hash.new
    @relatives.map{|k, v| @rpaths[k] = Windirs::Path.new(v)}

    @drives = {
      :cygwin  => '/cygdrive/c/Users/joe/Desktop',
      :windows => 'C:\Users\joe\Desktop',
      :rubywin => 'C:/Users/joe/Desktop',
    }
    @dpaths = Hash.new
    @drives.map{|k, v| @dpaths[k] = Windirs::Path.new(v)}

    @uncs = {
      :windows => '\\\\windomain\\somedir\\file',
      :cygwin  => '//windomain/somedir/file',
      :rubywin => '//windomain/somedir/file',
      :nix     => '//windomain/somedir/file',
    }
    @upaths = Hash.new
    @uncs.map{|k, v| @upaths[k] = Windirs::Path.new(v)}

  end

  describe Windirs::Path do

    it 'converts any drive to any drive' do 
      @drives.keys.repeated_permutation(2).each do |from, to|
        puts "converts from #{from} to #{to}"
        @dpaths[from].method(to).call.should eq @drives[to]
      end
    end

    it 'fakes a drive letter to *nix' do
      @drives.keys.each do |from|
        puts "fake drive letter from #{from} to *nix"
        @dpaths[from].nix.should eq '/c/Users/joe/Desktop'
      end
    end

    it 'converts any unc to any unc' do 
      @uncs.keys.repeated_permutation(2).each do |from, to|
        puts "converts from #{from} to #{to}"
        @upaths[from].method(to).call.should eq @uncs[to]
      end
    end

    it 'converts relative paths' do
      @relatives.keys.repeated_permutation(2).each do |from, to|
        puts "converts from #{from} to #{to}"
        @rpaths[from].method(to).call.should eq @relatives[to]
      end
    end

  end

end<commit_msg>add pending tests for cyg_deref and win_deref<commit_after>require  "#{File.dirname(__FILE__)}/../lib/windirs"

describe Windirs do

  before do
    @relatives = {
      :windows => '.\\somedir\\file',
      :cygwin  => './somedir/file',
      :rubywin => './somedir/file',
      :nix     => './somedir/file',
    }
    @rpaths = Hash.new
    @relatives.map{|k, v| @rpaths[k] = Windirs::Path.new(v)}

    @drives = {
      :cygwin  => '/cygdrive/c/Users/joe/Desktop',
      :windows => 'C:\Users\joe\Desktop',
      :rubywin => 'C:/Users/joe/Desktop',
    }
    @dpaths = Hash.new
    @drives.map{|k, v| @dpaths[k] = Windirs::Path.new(v)}

    @uncs = {
      :windows => '\\\\windomain\\somedir\\file',
      :cygwin  => '//windomain/somedir/file',
      :rubywin => '//windomain/somedir/file',
      :nix     => '//windomain/somedir/file',
    }
    @upaths = Hash.new
    @uncs.map{|k, v| @upaths[k] = Windirs::Path.new(v)}

    @cygwin_home = Windirs::Path.new('/home')
    @win_netdrive = Windirs::Path.new('R:')
  end

  describe Windirs::Path do

    it 'converts any drive to any drive' do 
      @drives.keys.repeated_permutation(2).each do |from, to|
        puts "converts from #{from} to #{to}"
        @dpaths[from].method(to).call.should eq @drives[to]
      end
    end

    it 'fakes a drive letter to *nix' do
      @drives.keys.each do |from|
        puts "fake drive letter from #{from} to *nix"
        @dpaths[from].nix.should eq '/c/Users/joe/Desktop'
      end
    end

    it 'converts any unc to any unc' do 
      @uncs.keys.repeated_permutation(2).each do |from, to|
        puts "converts from #{from} to #{to}"
        @upaths[from].method(to).call.should eq @uncs[to]
      end
    end

    it 'converts relative paths' do
      @relatives.keys.repeated_permutation(2).each do |from, to|
        puts "converts from #{from} to #{to}"
        @rpaths[from].method(to).call.should eq @relatives[to]
      end
    end

    it 'dereferences cygwin mounts' do
      pending
      @cygwin_home.cyg_deref.windows should eq 'C:/cygwin/home'
    end

    it 'dereferences windows network mounts' do
      pending
      @win_netdrive.win_deref.windows should eq '//1stdg/root'
    end

  end

end
{'fraction_non_alphanumeric': 0.1654320987654321, 'fraction_numerical': 0.0017283950617283952, 'mean_word_length': 2.387123745819398, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 25, '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': '6052117', 'n_tokens_mistral': 1579, 'n_tokens_neox': 1501, 'n_words': 324}