Sha256: 2529a75e9a344439403917c0cd40de55c6e8dbcda6240bf837c3e34b411f6e11

Contents?: true

Size: 1.08 KB

Versions: 5

Compression:

Stored size: 1.08 KB

Contents

require_relative '../spec_helper'
require_relative '../../lib/bioinform/support/multiline_squish'

describe String do
  describe '#multiline_squish' do
    it 'should replace multiple spaces with one space' do
      "abc def   ghi\n  jk  lmn".multiline_squish.should == "abc def ghi\njk lmn"
    end
    it 'should replace tabs with a space' do
      "abc\tdef   ghi \t jk".multiline_squish.should == 'abc def ghi jk'
    end
    it 'should replace \r\n with \n' do
      "abc def ghi\r\njk lmn".multiline_squish.should == "abc def ghi\njk lmn"
    end
    it 'should preserve rows pagination' do
      "abc def ghi\njk lmn".multiline_squish.should == "abc def ghi\njk lmn"
    end
    it 'should preserve empty lines in the middle of text' do
      "abc def\n\nghi\n \t  \njk lmn \n\n\n zzz".multiline_squish.should == "abc def\n\nghi\n\njk lmn\n\n\nzzz"
    end
    it 'should drop empty lines at begin and at end of string' do
      "\n  \t\n\nabc def\n\nghi\n \t  \njk lmn \n\n\n zzz\n\n \t  \n".multiline_squish.should == "abc def\n\nghi\n\njk lmn\n\n\nzzz"
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bioinform-0.1.12 spec/support/multiline_squish_spec.rb
bioinform-0.1.11 spec/support/multiline_squish_spec.rb
bioinform-0.1.10 spec/support/multiline_squish_spec.rb
bioinform-0.1.9 spec/support/multiline_squish_spec.rb
bioinform-0.1.8 spec/support/multiline_squish_spec.rb