summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-03-10 17:37:58 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-03-10 17:37:58 +0000
commitd244360d8b38218bd3e71c0203e9f2af41498daa (patch)
tree4dd99c19f76256866770d4035b606e7d9dfbdc6f
parentf030ca96950296390a162ebc7b59914282bdb605 (diff)
downloadgitlab-ce-d244360d8b38218bd3e71c0203e9f2af41498daa.tar.gz
Add latest changes from gitlab-org/gitlab@15-9-stable-ee
-rw-r--r--lib/gitlab/regex.rb2
-rw-r--r--spec/fast_spec_helper.rb1
-rw-r--r--spec/lib/gitlab/regex_spec.rb6
-rw-r--r--spec/models/concerns/taskable_spec.rb16
4 files changed, 22 insertions, 3 deletions
diff --git a/lib/gitlab/regex.rb b/lib/gitlab/regex.rb
index e76056709e9..93d23add5eb 100644
--- a/lib/gitlab/regex.rb
+++ b/lib/gitlab/regex.rb
@@ -466,7 +466,7 @@ module Gitlab
# HTML comment line:
# <!-- some commented text -->
- ^<!--\ .*\ -->\ *$
+ ^<!--\ .*?\ -->\ *$
)
}mx.freeze
diff --git a/spec/fast_spec_helper.rb b/spec/fast_spec_helper.rb
index e53f0cd936f..0df771b4025 100644
--- a/spec/fast_spec_helper.rb
+++ b/spec/fast_spec_helper.rb
@@ -21,6 +21,7 @@ require_relative 'support/rspec'
require_relative '../lib/gitlab/utils'
require_relative '../lib/gitlab/utils/strong_memoize'
require 'active_support/all'
+require 'pry'
require_relative 'simplecov_env'
SimpleCovEnv.start!
diff --git a/spec/lib/gitlab/regex_spec.rb b/spec/lib/gitlab/regex_spec.rb
index caca33704dd..31de4068bc5 100644
--- a/spec/lib/gitlab/regex_spec.rb
+++ b/spec/lib/gitlab/regex_spec.rb
@@ -1142,7 +1142,7 @@ RSpec.describe Gitlab::Regex, feature_category: :tooling do
context 'HTML comment lines' do
subject { described_class::MARKDOWN_HTML_COMMENT_LINE_REGEX }
- let(:expected) { %(<!-- an HTML comment -->) }
+ let(:expected) { [['<!-- an HTML comment -->'], ['<!-- another HTML comment -->']] }
let(:markdown) do
<<~MARKDOWN
Regular text
@@ -1150,13 +1150,15 @@ RSpec.describe Gitlab::Regex, feature_category: :tooling do
<!-- an HTML comment -->
more text
+
+ <!-- another HTML comment -->
MARKDOWN
end
it { is_expected.to match(%(<!-- single line comment -->)) }
it { is_expected.not_to match(%(<!--\nblock comment\n-->)) }
it { is_expected.not_to match(%(must start in first column <!-- comment -->)) }
- it { expect(subject.match(markdown)[:html_comment_line]).to eq expected }
+ it { expect(markdown.scan(subject)).to eq expected }
end
context 'HTML comment blocks' do
diff --git a/spec/models/concerns/taskable_spec.rb b/spec/models/concerns/taskable_spec.rb
index 0ad29454ff3..14f346f353b 100644
--- a/spec/models/concerns/taskable_spec.rb
+++ b/spec/models/concerns/taskable_spec.rb
@@ -46,6 +46,22 @@ RSpec.describe Taskable, feature_category: :team_planning do
subject { described_class.get_tasks(description) }
it { is_expected.to match(expected_result) }
+
+ describe 'with single line comments' do
+ let(:description) do
+ <<~MARKDOWN
+ <!-- line comment -->
+
+ - [ ] only task item
+
+ <!-- another line comment -->
+ MARKDOWN
+ end
+
+ let(:expected_result) { [TaskList::Item.new('- [ ]', 'only task item')] }
+
+ it { is_expected.to match(expected_result) }
+ end
end
describe '#task_list_items' do