diff options
author | Stan Hu <stanhu@gmail.com> | 2016-07-31 20:51:12 -0700 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-08-01 13:24:06 +0200 |
commit | 3fe18525ddca414017d330e992999bad05002fa8 (patch) | |
tree | 04836fccf41e3228324f162dbb399c9e3c0360be /spec/lib | |
parent | e91fe7553db6f1e9d286df4941a1847f27a767d5 (diff) | |
download | gitlab-ce-3fe18525ddca414017d330e992999bad05002fa8.tar.gz |
Trim extra displayed carriage returns in diffs and files with CRLFs
Closes #20440
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/highlight_spec.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/lib/gitlab/highlight_spec.rb b/spec/lib/gitlab/highlight_spec.rb index 364532e94e3..80a9473d6aa 100644 --- a/spec/lib/gitlab/highlight_spec.rb +++ b/spec/lib/gitlab/highlight_spec.rb @@ -17,6 +17,18 @@ describe Gitlab::Highlight, lib: true do expect(lines[21]).to eq(%Q{<span id="LC22" class="line"> <span class="k">unless</span> <span class="no">File</span><span class="p">.</span><span class="nf">directory?</span><span class="p">(</span><span class="n">path</span><span class="p">)</span></span>\n}) expect(lines[26]).to eq(%Q{<span id="LC27" class="line"> <span class="vi">@cmd_status</span> <span class="o">=</span> <span class="mi">0</span></span>\n}) end + + describe 'with CRLF' do + let(:branch) { 'crlf-diff' } + let(:blob) { repository.blob_at_branch(branch, path) } + let(:lines) do + Gitlab::Highlight.highlight_lines(project.repository, 'crlf-diff-test', 'files/whitespace') + end + + it 'strips extra LFs' do + expect(lines[0]).to eq("<span id=\"LC1\" class=\"line\">test </span>") + end + end end describe 'custom highlighting from .gitattributes' do |