<commit_before>require 'spec_helper'

module Xcake
  module Xcode
    describe SchemeList do

      before :each do
        @project = double()
        @scheme_list = SchemeList.new(@project)
      end

      it "should store project" do
        expect(@scheme_list.project).to be(@project)
      end

      it "should create empty schemes array" do
        expect(@scheme_list.schemes).to eq([])
      end

      it "should create default scheme management hash" do
        expect(@scheme_list.xcschememanagement).to eq({
          'SchemeUserState' => {},
          'SuppressBuildableAutocreation' => {}
        })
      end

      it "should create schemes for each target" do

        target = double()

        allow(@project).to receive(:targets).and_return([target])
        expect(@scheme_list).to receive(:create_schemes_for_target).with(target)

        @scheme_list.recreate_schemes
      end

      it "should create scheme for application" do

        target = double()

        allow(target).to receive(:product_type).and_return(Xcodeproj::Constants::PRODUCT_TYPE_UTI[:application])
        expect(@scheme_list).to receive(:create_schemes_for_application).with(target)

        @scheme_list.create_schemes_for_target(target)
      end

      context "when creating build configurations for application" do

        
      end
      # def create_schemes_for_application(target)
      #   target.build_configurations.each do |c|
      #     scheme = Scheme.new
      #
      #     scheme.name = "#{target.name}-#{c.name}"
      #     scheme.add_build_target(target)
      #     @xcschememanagement['SuppressBuildableAutocreation'][target.uuid] = {"primary" => true}
      #
      #     unit_test_target = project.find_unit_test_target_for_target(target)
      #
      #     if unit_test_target then
      #       scheme.add_test_target(unit_test_target)
      #       unit_test_target.add_dependency(target)
      #       @xcschememanagement['SuppressBuildableAutocreation'][unit_test_target.uuid] = {"primary" => true}
      #     end
      #
      #     schemes << scheme
      #   end
      # end

      # def save(writing_path)
      #
      #   schemes_dir = Scheme.user_data_dir(writing_path)
      #
      #   FileUtils.rm_rf(schemes_dir)
      #   FileUtils.mkdir_p(schemes_dir)
      #<commit_msg>Updating tests.<commit_after>require 'spec_helper'

module Xcake
  module Xcode
    describe SchemeList do

      before :each do
        @project = double()
        @scheme_list = SchemeList.new(@project)

        @target = double()
        allow(@project).to receive(:targets).and_return([@target])
      end

      it "should store project" do
        expect(@scheme_list.project).to be(@project)
      end

      it "should create empty schemes array" do
        expect(@scheme_list.schemes).to eq([])
      end

      it "should create default scheme management hash" do
        expect(@scheme_list.xcschememanagement).to eq({
          'SchemeUserState' => {},
          'SuppressBuildableAutocreation' => {}
        })
      end

      it "should create schemes for each target" do
        expect(@scheme_list).to receive(:create_schemes_for_target).with(@target)
        @scheme_list.recreate_schemes
      end

      it "should create scheme for application" do
        allow(@target).to receive(:product_type).and_return(Xcodeproj::Constants::PRODUCT_TYPE_UTI[:application])
        expect(@scheme_list).to receive(:create_schemes_for_application).with(@target)
        @scheme_list.create_schemes_for_target(@target)
      end

      context "when creating scheme for application" do

        it "should set correct name" do
          # build_configuration = double()
          # allow(@target).to receive(:build_configurations).and_return([build_configuration])
          #
          # scheme = double()
          # allow(Scheme).to receive(:new).and_return(scheme)
          #
          # @scheme_list.create_schemes_for_application(target)
        end
        #   target.build_configurations.each do |c|
        #     scheme = Scheme.new
        #
        #     scheme.name = "#{target.name}-#{c.name}"
        #     scheme.add_build_target(target)
        #     @xcschememanagement['SuppressBuildableAutocreation'][target.uuid] = {"primary" => true}
        #
        #     unit_test_target = project.find_unit_test_target_for_target(target)
        #
        #     if unit_test_target then
        #       scheme.add_test_target(unit_test_target)
        #       unit_test_target.add_dependency(target)
        #       @xcschememanagement['SuppressBuildableAutocreation'][unit_test_target.uuid] = {"primary" => true}
        #     end
        #
        #     schemes << scheme
        #   end
      end


      # def save(writing_path)
      #
      #   schemes_dir = Scheme.user_data_dir(writing_path)
      #
      #   FileUtils.rm_rf(schemes_dir)
      #   FileUtils.mkdir_p(schemes_dir)
      #
{'fraction_non_alphanumeric': 0.10178426601784266, 'fraction_numerical': 0.0, 'mean_word_length': 2.4424284717376135, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, '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': '5192220', 'n_tokens_mistral': 1458, 'n_tokens_neox': 1421, 'n_words': 255}