<commit_before>
#
# specifying flor
#
# Sun Apr  3 14:11:49 JST 2016
#

require 'spec_helper'


describe 'Flor procedures' do

  before :each do

    @executor = Flor::TransientExecutor.new
  end

  describe 'match' do

    it "returns false when it doesn't match" do

      flon = %{
        match "alpha", /bravo/
      }

      r = @executor.launch(flon)

      expect(r['point']).to eq('terminated')
      expect(r['payload']).to eq({ 'ret' => [] })
    end

    it "returns the array of matches" do

      flon = %{
        push f.l
          match "stuff", /stuf*/
        push f.l
          match "stuff", /s(tu)(f*)/
      }

      r = @executor.launch(flon, payload: { 'l' => [] })

      expect(r['point']).to eq('terminated')
      expect(r['payload']['l']).to eq([ %w[ stuff ], %w[ stuff tu ff ] ])
    end

    it 'turns the second argument into a regular expression' do

      flon = %{
        push f.l
          #match "stuff", "^stuf*$"
          match "stuff", "stuf*"
      }

      r = @executor.launch(flon, payload: { 'l' => [] })

      expect(r['point']).to eq('terminated')
      expect(r['payload']['l']).to eq([ %w[ stuff ] ])
    end
  end

  #describe 'starts_with' do
  #  it 'works'
  #end
  #describe 'ends_with' do
  #  it 'works'
  #end
end

<commit_msg>fix match spec - it returns [], not false<commit_after>
#
# specifying flor
#
# Sun Apr  3 14:11:49 JST 2016
#

require 'spec_helper'


describe 'Flor procedures' do

  before :each do

    @executor = Flor::TransientExecutor.new
  end

  describe 'match' do

    it "returns empty array when it doesn't match" do

      flon = %{
        match "alpha", /bravo/
      }

      r = @executor.launch(flon)

      expect(r['point']).to eq('terminated')
      expect(r['payload']).to eq({ 'ret' => [] })
    end

    it "returns the array of matches" do

      flon = %{
        push f.l
          match "stuff", /stuf*/
        push f.l
          match "stuff", /s(tu)(f*)/
      }

      r = @executor.launch(flon, payload: { 'l' => [] })

      expect(r['point']).to eq('terminated')
      expect(r['payload']['l']).to eq([ %w[ stuff ], %w[ stuff tu ff ] ])
    end

    it 'turns the second argument into a regular expression' do

      flon = %{
        push f.l
          #match "stuff", "^stuf*$"
          match "stuff", "stuf*"
      }

      r = @executor.launch(flon, payload: { 'l' => [] })

      expect(r['point']).to eq('terminated')
      expect(r['payload']['l']).to eq([ %w[ stuff ] ])
    end
  end

  #describe 'starts_with' do
  #  it 'works'
  #end
  #describe 'ends_with' do
  #  it 'works'
  #end
end


{'fraction_non_alphanumeric': 0.16934865900383142, 'fraction_numerical': 0.00842911877394636, 'mean_word_length': 2.149577804583836, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '629078', 'n_tokens_mistral': 994, 'n_tokens_neox': 904, 'n_words': 249}