Sha256: 0b4c15cd54c45b9ee80f77baa0754c54543b978ef6b7487fc46309819848f9af

Contents?: true

Size: 1.37 KB

Versions: 1

Compression:

Stored size: 1.37 KB

Contents

require 'test_helper'
require 'review/compiler'
require 'review/book'
require 'review/latexbuilder'

class CompilerTest < Test::Unit::TestCase
  include ReVIEW

  def setup
    @builder = LATEXBuilder.new
    @c = Compiler.new(@builder)
  end

  def test_parse_args
    args = @c.__send__(:parse_args, '[foo][bar]')
    assert_equal ['foo', 'bar'], args
  end

  def test_parse_args_with_brace1
    args = @c.__send__(:parse_args, '[fo[\\][\\]o][bar]')
    assert_equal ['fo[][]o', 'bar'], args
  end

  def test_parse_args_with_brace2
    args = @c.__send__(:parse_args, '[f\\]o\\]o][bar]')
    assert_equal ['f]o]o', 'bar'], args
  end

  def test_parse_args_with_backslash
    args = @c.__send__(:parse_args, '[foo][bar\\buz]')
    assert_equal ['foo', 'bar\\buz'], args
  end

  def test_parse_args_with_backslash2
    args = @c.__send__(:parse_args, '[foo][bar\\#\\[\\!]')
    assert_equal ['foo', 'bar\\#\\[\\!'], args
  end

  def test_parse_args_with_backslash3
    args = @c.__send__(:parse_args, '[foo][bar\\\\buz]')
    assert_equal ['foo', 'bar\\buz'], args
  end

  def test_replace_fence
    actual = @c.__send__(:replace_fence, '@<m>${}\\}|$, @<m>|{}\\}\\$|, @<m>|\\{\\a\\}|, @<tt>|}|, @<tt>|\\|, @<tt>|\\\\|, @<tt>|\\\\\\|')
    assert_equal '@<m>{{\\}\\\\\\}|}, @<m>{{\\}\\\\\\}\\$}, @<m>{\\{\\a\\\\\\}}, @<tt>{\\}}, @<tt>{\\\\}, @<tt>{\\\\\\\\}, @<tt>{\\\\\\\\\\\\}', actual
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
review-2.4.0 test/test_compiler.rb