File: html_pygments_spec.rb

package info (click to toggle)
ruby-rouge 4.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,836 kB
  • sloc: ruby: 38,168; sed: 2,071; perl: 152; makefile: 8
file content (17 lines) | stat: -rw-r--r-- 548 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

describe Rouge::Formatters::HTMLPygments do
  let(:formatter) { Rouge::Formatters::HTML.new }
  let(:source) { 'echo "Hello World"' }
  let(:lexer) { Rouge::Lexers::Shell.new }
  let(:subject) { Rouge::Formatters::HTMLPygments.new(formatter, lexer.tag) }
  let(:output) { subject.format(lexer.lex(source)) }

  it 'wrap with div.highlight' do
    assert { output =~ /\A<div class="highlight">.+<\/div>\Z/ }
  end

  it 'contain pre with class name "shell"' do
    assert { output =~ /<pre class="shell">/ }
  end
end