2017-01-04 13:43:06 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Gitlab::Git::Util do
|
2017-03-24 19:04:03 -04:00
|
|
|
describe '#count_lines' do
|
2017-01-04 13:43:06 -05:00
|
|
|
[
|
|
|
|
["", 0],
|
|
|
|
["foo", 1],
|
|
|
|
["foo\n", 1],
|
2017-05-03 07:22:03 -04:00
|
|
|
["foo\n\n", 2]
|
2017-01-04 13:43:06 -05:00
|
|
|
].each do |string, line_count|
|
|
|
|
it "counts #{line_count} lines in #{string.inspect}" do
|
2017-05-01 11:13:33 -04:00
|
|
|
expect(described_class.count_lines(string)).to eq(line_count)
|
2017-01-04 13:43:06 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|