diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2019-03-31 23:58:07 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-03-31 23:58:07 -0600 |
| commit | 9ffe4391ff53b375e783d17419df972562e17edc (patch) | |
| tree | 33d7f1c73956435f0d324686c85c9e181eecbd4c /test | |
| parent | 23d8c6f40c64ff94e47c2ad7d95257d87d96053c (diff) | |
resolves #3223 should not crash when source highlighter is rouge and source language is not set on block (PR #3224)
Diffstat (limited to 'test')
| -rw-r--r-- | test/syntax_highlighter_test.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/syntax_highlighter_test.rb b/test/syntax_highlighter_test.rb index 857e417e..0e358a90 100644 --- a/test/syntax_highlighter_test.rb +++ b/test/syntax_highlighter_test.rb @@ -646,6 +646,21 @@ context 'Syntax Highlighter' do assert_includes output, 'pre.rouge .no {' end + test 'should not crash if source-highlighter attribute is set and source block does not define a language' do + input = <<~'EOS' + :source-highlighter: rouge + + [source] + ---- + require 'rouge' + + html = Rouge::Formatters::HTML.new.format(Rouge::Lexers::Ruby.new.lex('puts "Hello, world!"')) + ---- + EOS + output = convert_string_to_embedded input, safe: :safe + assert_css 'pre > code:not([data-lang])', output, 1 + end + test 'should default to plain text lexer if lexer cannot be resolved for language' do input = <<~'EOS' :source-highlighter: rouge |
