diff options
author | Nick Thomas <nick@gitlab.com> | 2017-07-21 22:08:23 +0100 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2017-07-21 22:08:23 +0100 |
commit | 000ddc96c5c9b58d898f6723bd122678d138e35d (patch) | |
tree | 4ea2d40f75419d606d58bf87199e68117b1d640a /spec | |
parent | 2209426f7ba1a0c40b09e5b67ac3b48fd15f7b99 (diff) | |
download | gitlab-ce-000ddc96c5c9b58d898f6723bd122678d138e35d.tar.gz |
Fix the gcovr coverage regex by removing line separators before scanning
RE2 differs from Ruby in handling multiple-line strings. The string "foo\n"
will not match the regular expression "foo$" unless multi-line mode is enabled
(and it's off by default).
Since we're already scanning the build trace line by line (and so multi-line
coverage regular expressions won't work), we can fix this by removing the line
separator before scanning the string.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/ci/trace/stream_spec.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ci/trace/stream_spec.rb b/spec/lib/gitlab/ci/trace/stream_spec.rb index 13f0338b6aa..3a132fb9989 100644 --- a/spec/lib/gitlab/ci/trace/stream_spec.rb +++ b/spec/lib/gitlab/ci/trace/stream_spec.rb @@ -300,5 +300,12 @@ describe Gitlab::Ci::Trace::Stream do include_examples 'malicious regexp' end + + context 'multi-line data with rooted regexp' do + let(:data) { "\n65%\n" } + let(:regex) { '^(\d+)\%$' } + + it { is_expected.to eq('65') } + end end end |