<commit_before>require 'test_helper'
class TestAndroid2CSVCommand < Test::Unit::TestCase
 def test_android2csv
    options = {:filenames => ["test/data/android.xml"]}
    Android2CSVCommand.new([], options).android2csv

    assert File.exist?("translations.csv")

    #clean up
    system("rm -f translations.csv")
  end

  def test_android2csv_with_dryrun_option
    options = {:filenames => ["test/data/android.xml"], :dryrun => true}
    Android2CSVCommand.new([], options).android2csv

    assert !File.exist?("translations.csv")

    #clean up
    system("rm -f translations.csv")
  end

  def test_android2csv_with_output_file
    options = {:filenames => ["test/data/android.xml"], :csv_filename => "myfile.csv"}
    # -i, -o
    Android2CSVCommand.new([], options).android2csv

    assert File.exist?("myfile.csv")

    #clean up
    system("rm -f myfile.csv")
  end

  def test_android2csv_with_headers
    options = {:filenames => ["test/data/android.xml"], :headers => ["constants", "english"]}
    # -i, -h
    Android2CSVCommand.new([], options).android2csv

    #TODO assertion or move test on at lib level

    #clean up
    system("rm -f translations.csv")
  end

  def test_android2csv_with_two_files
    options = {
      :filenames => ["test/data/test_en.strings", "test/data/test_fr.strings"],
      :headers => %w{Constants English French},
      :csv_filename => "enfr.csv"
    }
    # --filenames, --headers, -o
    Android2CSVCommand.new([], options).android2csv

    #TODO assertion

    #clean up
    system("rm -f enfr.csv")
  end

end
<commit_msg>Fixes test android 2 csv<commit_after>require 'test_helper'
class TestAndroid2CSVCommand < Test::Unit::TestCase
 def test_android2csv
    options = {:filenames => ["test/data/android.xml"]}
    Android2CSVCommand.new([], options).android2csv

    assert File.exist?("translations.csv")

    #clean up
    system("rm -f translations.csv")
  end

  def test_android2csv_with_dryrun_option
    options = {:filenames => ["test/data/android.xml"], :dryrun => true}
    Android2CSVCommand.new([], options).android2csv

    assert !File.exist?("translations.csv")

    #clean up
    system("rm -f translations.csv")
  end

  def test_android2csv_with_output_file
    options = {:filenames => ["test/data/android.xml"], :csv_filename => "myfile.csv"}
    # -i, -o
    Android2CSVCommand.new([], options).android2csv

    assert File.exist?("myfile.csv")

    #clean up
    system("rm -f myfile.csv")
  end

  def test_android2csv_with_headers
    options = {:filenames => ["test/data/android.xml"], :headers => ["constants", "english"]}
    # -i, -h
    Android2CSVCommand.new([], options).android2csv

    #TODO assertion or move test on at lib level

    #clean up
    system("rm -f translations.csv")
  end

  def test_android2csv_with_two_files
    options = {
      :filenames => ["test/data/android-en.xml", "test/data/android-fr.xml"],
      :headers => %w{Constants English French},
      :csv_filename => "enfr.csv"
    }
    # --filenames, --headers, -o
    Android2CSVCommand.new([], options).android2csv

    #TODO assertion

    #clean up
    system("rm -f enfr.csv")
  end

end

{'fraction_non_alphanumeric': 0.144349477682811, 'fraction_numerical': 0.010446343779677113, 'mean_word_length': 3.4319775596072932, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 10}, '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': '1688702', 'n_tokens_mistral': 1102, 'n_tokens_neox': 1051, 'n_words': 222}