<commit_before>require "spec_helper"

module SocialSnippet

  describe Inserter do

    context "from empty" do

      let(:instance) { Inserter.new([]) }

      context "insert AAA" do

        before { instance.insert ['AAA'] }
        subject { instance.to_s }
        it { should eq "AAA" }

        context "insert BBB, CCC" do

          before { instance.insert ['BBB', 'CCC'] }
          subject { instance.to_s }

          let(:output) do
            [
              'AAA',
              'BBB',
              'CCC',
            ].join("\n")
          end

          it { should eq output }

          context "replace ABC" do

            before { instance.replace 'ABC' }
            subject { instance.to_s }

            let(:output) do
              [
                'AAA',
                'BBB',
                'ABC',
              ].join("\n")
            end

            it { should eq output }

            context "remove" do

              before { instance.remove }
              subject { instance.to_s }

              let(:output) do
                [
                  'AAA',
                  'BBB',
                ].join("\n")
              end

              it { should eq output }

              context "insert 1, 2, 3" do

                before { instance.insert ['1', '2', '3'] }
                subject { instance.to_s }

                let(:output) do
                  [
                    'AAA',
                    'BBB',
                    '1',
                    '2',
                    '3',
                  ].join("\n")
                end

                it { should eq output }

              end

            end # remove 

          end # replace ABC

        end # insert BBB, CCC

      end # insert AAA

    end # empty

  end # Inserter

end # SocialSnippet<commit_msg>inserter: spec: remove disused function tests<commit_after>require "spec_helper"

module SocialSnippet

  describe Inserter do

    context "new include, snip" do

      let(:instance) do
        Inserter.new [
          '#include <iostream>',
          '',
          '// @snip<my-repo:path/to/func.cpp>',
        ]
      end

      context "set_index 2" do

        before { instance.set_index 2 }

        context "ignore" do

          before { instance.ignore }

          let(:output) do
            [
              '#include <iostream>',
              '',
            ].join("\n").freeze
          end

          it { expect(instance.to_s).to eq output }

          context "insert snippet" do

            before do
              instance.insert [
                '// @snippet<my-repo:path/to/func.cpp>',
              ].freeze
            end

            let(:output) do
              [
                '#include <iostream>',
                '',
                '// @snippet<my-repo:path/to/func.cpp>',
              ].join("\n").freeze
            end

            it { expect(instance.to_s).to eq output }

            context "insert code, code, code" do

              before do
                instance.insert [
                  'code',
                  'code',
                  'code',
                ].freeze
              end

              let(:output) do
                [
                  '#include <iostream>',
                  '',
                  '// @snippet<my-repo:path/to/func.cpp>',
                  'code',
                  'code',
                  'code',
                ].join("\n").freeze
              end

              it { expect(instance.to_s).to eq output }

            end # insert code, code, code

          end # insert snippet

        end # ignore

      end # set_index 2

    end # new include, snip

    context "from empty" do

      let(:instance) { Inserter.new([]) }

      context "insert 1, 2, 3" do

        before do
          instance.insert [
            '1',
            '2',
            '3',
          ].freeze
        end

        let(:output) do
          [
            '1',
            '2',
            '3',
          ].join("\n").freeze
        end

        it { expect(instance.to_s).to eq output }

        context "ignore" do

          before { instance.ignore }

          let(:output) do
            [
              '1',
              '2',
              '3',
            ].join("\n").freeze
          end

          it { expect(instance.to_s).to eq output }

          context "insert a" do

            before do
              instance.insert [
                'a',
              ].freeze
            end

            let(:output) do
              [
                '1',
                '2',
                '3',
                'a',
              ].join("\n").freeze
            end

            it { expect(instance.to_s).to eq output }

          end # insert a

        end # ignore

      end # insert 1, 2, 3

      context "insert AAA" do

        before { instance.insert ['AAA'] }
        subject { instance.to_s }
        it { should eq "AAA" }

        context "insert BBB, CCC" do

          before { instance.insert ['BBB', 'CCC'] }
          subject { instance.to_s }

          let(:output) do
            [
              'AAA',
              'BBB',
              'CCC',
            ].join("\n")
          end

          it { should eq output }

        end # insert BBB, CCC

      end # insert AAA

    end # empty

  end # Inserter

end # SocialSnippet
{'fraction_non_alphanumeric': 0.10886122979751069, 'fraction_numerical': 0.005573100501579045, 'mean_word_length': 0.9221706533380936, 'pattern_counts': {'":': 0, '<': 11, '<?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': '5178353', 'n_tokens_mistral': 1520, 'n_tokens_neox': 1378, 'n_words': 368}