summaryrefslogtreecommitdiff
path: root/spec/lib/rouge/formatters/html_gitlab_spec.rb
diff options
context:
space:
mode:
authorGitLab Release Tools Bot <delivery-team+release-tools@gitlab.com>2023-03-30 21:24:47 +0000
committerGitLab Release Tools Bot <delivery-team+release-tools@gitlab.com>2023-03-30 21:24:47 +0000
commit9025d53443ae9708675aaa5b035fdb79562bebad (patch)
treebb4f5ba0c7d4e5c206cd37e7e59f062ed6df685d /spec/lib/rouge/formatters/html_gitlab_spec.rb
parentc00b0b2dedd4748d8f2d44c70c954d39e37d4696 (diff)
parentc57c04a970e6e1afcd0dbc287afe1006a103afd4 (diff)
downloadgitlab-ce-9025d53443ae9708675aaa5b035fdb79562bebad.tar.gz
Merge remote-tracking branch 'dev/15-8-stable' into 15-8-stable
Diffstat (limited to 'spec/lib/rouge/formatters/html_gitlab_spec.rb')
-rw-r--r--spec/lib/rouge/formatters/html_gitlab_spec.rb21
1 files changed, 20 insertions, 1 deletions
diff --git a/spec/lib/rouge/formatters/html_gitlab_spec.rb b/spec/lib/rouge/formatters/html_gitlab_spec.rb
index 79bfdb262c0..6fc1b395fc8 100644
--- a/spec/lib/rouge/formatters/html_gitlab_spec.rb
+++ b/spec/lib/rouge/formatters/html_gitlab_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe Rouge::Formatters::HTMLGitlab do
+RSpec.describe Rouge::Formatters::HTMLGitlab, feature_category: :source_code_management do
describe '#format' do
subject { described_class.format(tokens, **options) }
@@ -67,5 +67,24 @@ RSpec.describe Rouge::Formatters::HTMLGitlab do
is_expected.to include(%{<span class="unicode-bidi has-tooltip" data-toggle="tooltip" title="#{message}">}).exactly(4).times
end
end
+
+ context 'when space characters and zero-width spaces are used' do
+ let(:lang) { 'ruby' }
+ let(:tokens) { lexer.lex(code, continue: false) }
+
+ let(:code) do
+ <<~JS
+ def\u00a0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000hello
+ JS
+ end
+
+ it 'replaces the space characters with spaces' do
+ is_expected.to eq(
+ "<span id=\"LC1\" class=\"line\" lang=\"ruby\">" \
+ "<span class=\"k\">def</span><span class=\"err\"> </span><span class=\"n\">hello</span>" \
+ "</span>"
+ )
+ end
+ end
end
end