mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-11-13 23:12:24 +00:00
test: added minimal tests for svg and png formatters
Some checks are pending
Tests / build (push) Waiting to run
Some checks are pending
Tests / build (push) Waiting to run
This commit is contained in:
parent
8b34a1659d
commit
22decedf3a
@ -1,4 +1,5 @@
|
||||
require "./spec_helper"
|
||||
require "digest/sha1"
|
||||
|
||||
# These are the testcases from Pygments
|
||||
testcases = Dir.glob("#{__DIR__}/tests/**/*txt").sort
|
||||
@ -103,6 +104,7 @@ describe Tartrazine do
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
describe "to_ansi" do
|
||||
it "should do basic highlighting" do
|
||||
ansi = Tartrazine.to_ansi("puts 'Hello, World!'", "ruby")
|
||||
@ -119,6 +121,24 @@ describe Tartrazine do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "to_svg" do
|
||||
it "should do basic highlighting" do
|
||||
svg = Tartrazine.to_svg("puts 'Hello, World!'", "ruby", standalone: false)
|
||||
svg.should eq(
|
||||
"<text x=\"0\" y=\"19\" xml:space=\"preserve\"><tspan fill=\"#ab4642\">puts</tspan><tspan fill=\"#d8d8d8\"> </tspan><tspan fill=\"#a1b56c\">'Hello, World!'</tspan></text>"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
describe "to_png" do
|
||||
it "should do basic highlighting" do
|
||||
png = Digest::SHA1.hexdigest(Tartrazine.to_png("puts 'Hello, World!'", "ruby"))
|
||||
png.should eq(
|
||||
"62d419dcd263fffffc265a0f04c156dc2530c362"
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Helper that creates lexer and tokenizes
|
||||
|
Loading…
Reference in New Issue
Block a user