summaryrefslogtreecommitdiff
path: root/test/syntax_highlighter_test.rb
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2019-04-22 03:08:14 -0600
committerGitHub <noreply@github.com>2019-04-22 03:08:14 -0600
commit5bdf5a352b8a9e08ab4935f18a236b72df946551 (patch)
tree31d36b6a87eac7a17308b6e9e82506fb0572f483 /test/syntax_highlighter_test.rb
parent2c263a4b515d768346bd4d53305f87cf7f9090c2 (diff)
resolves #3274 update register_for methods to accept symbol arguments (PR #3275)
- coerce symbol arguments to register_for to strings - fill in missing API doc for register_for and register methods in SyntaxHighlighter module
Diffstat (limited to 'test/syntax_highlighter_test.rb')
-rw-r--r--test/syntax_highlighter_test.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/syntax_highlighter_test.rb b/test/syntax_highlighter_test.rb
index 7e0f353b..7650e39e 100644
--- a/test/syntax_highlighter_test.rb
+++ b/test/syntax_highlighter_test.rb
@@ -106,6 +106,22 @@ context 'Syntax Highlighter' do
assert_equal syntax_highlighter, (Asciidoctor::SyntaxHighlighter.for 'foobar')
end
+ test 'should be able to register syntax highlighter using symbol' do
+ syntax_highlighter = Class.new Asciidoctor::SyntaxHighlighter::Base do
+ register_for :foobaz
+
+ def format node, language, opts
+ %(<pre class="highlight"><code class="language-#{language}" data-lang="#{language}">#{node.content}</code></pre>)
+ end
+
+ def highlight?
+ false
+ end
+ end
+
+ assert_equal syntax_highlighter, (Asciidoctor::SyntaxHighlighter.for 'foobaz')
+ end
+
test 'should set language on output of source block when source-highlighter attribute is not set' do
input = <<~'EOS'
[source, ruby]