diff options
author | Jan Provaznik <jprovaznik@gitlab.com> | 2018-05-15 13:20:18 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-05-15 13:20:18 +0300 |
commit | 91f8656c2c30fe2a31ead5f9f3d4efd56b4980ac (patch) | |
tree | 95125f7ac52783eb59288d014b7d15ee29093eb4 /spec/lib/gitlab/project_search_results_spec.rb | |
parent | a78b1b27b86d34c00e1b0631e967d637f8a6714b (diff) |
Disable greedy mode when matching filename
Diffstat (limited to 'spec/lib/gitlab/project_search_results_spec.rb')
-rw-r--r-- | spec/lib/gitlab/project_search_results_spec.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/lib/gitlab/project_search_results_spec.rb b/spec/lib/gitlab/project_search_results_spec.rb index a34b7d9905a..e3f705d2299 100644 --- a/spec/lib/gitlab/project_search_results_spec.rb +++ b/spec/lib/gitlab/project_search_results_spec.rb @@ -106,6 +106,18 @@ describe Gitlab::ProjectSearchResults do end end + context 'when the matching content contains multiple null bytes' do + let(:search_result) { "master:testdata/foo.txt\x001\x00blah\x001\x00foo" } + + it 'returns a valid FoundBlob' do + expect(subject.filename).to eq('testdata/foo.txt') + expect(subject.basename).to eq('testdata/foo') + expect(subject.ref).to eq('master') + expect(subject.startline).to eq(1) + expect(subject.data).to eq("blah\x001\x00foo") + end + end + context 'when the search result ends with an empty line' do let(:results) { project.repository.search_files_by_content('Role models', 'master') } |