Sha256: 7ae70714d00513e57babf1a495d22bd19727393dc850f38b95ca3d88a55a113e

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

require "test_helper"

module Latexpdf
  class EscaperTest < MiniTest::Test
    def test_escape_ampersand
      assert_equal "\\&", Latexpdf.escape_latex("&")
    end

    def test_escape_dollar
      assert_equal "\\$", Latexpdf.escape_latex("$")
    end

    def test_escape_pound
      assert_equal "\\#", Latexpdf.escape_latex("#")
    end

    def test_escape_underscore
      assert_equal "\\_", Latexpdf.escape_latex("_")
    end

    def test_escape_lcurly
      assert_equal "\\{", Latexpdf.escape_latex("{")
    end

    def test_escape_rcurly
      assert_equal "\\}", Latexpdf.escape_latex("}")
    end

    def test_escape_tilde
      assert_equal "\\textasciitilde{}", Latexpdf.escape_latex("~")
    end

    def test_escape_ciicircum
      assert_equal "\\textasciicircum{}", Latexpdf.escape_latex("^")
    end

    def test_escape_backslash
      assert_equal "\\textbackslash{}", Latexpdf.escape_latex("\\")
    end

    # Although 007F is a valid UTF-8 char, xelatex does not like it
    # Since it is not visible (DELETE) we substitute with nothing
    def test_remove_utf8_delete
      assert_equal "text:", Latexpdf.escape_latex("text:\u007F")
    end

    def test_escape_percent_sign
      assert_equal "\\%", Latexpdf.escape_latex("%")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
latexpdf-0.4.8 test/latexpdf/escaper_test.rb