Sha256: f4a4922b1d99354c742e316c378f50a84be8cb43ff2f44425d0b65d63a021a22

Contents?: true

Size: 1.41 KB

Versions: 2

Compression:

Stored size: 1.41 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
    source_str = <<-'EOB'
@<m>${}\}|$, @<m>|{}\}\$|, @<m>|\{\a\}|, @<tt>|}|, @<tt>|\|, @<tt>|\\|, @<tt>|\\\|
    EOB
    expected = <<-'EOB'
@<m>{{\}\\\}|}, @<m>{{\}\\\}\$}, @<m>{\{\a\\\}}, @<tt>{\}}, @<tt>{\\}, @<tt>{\\\\}, @<tt>{\\\\\\}
    EOB
    actual = @c.__send__(:replace_fence, source_str)
    assert_equal expected, actual
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
review-3.0.0.preview1 test/test_compiler.rb
review-2.5.0 test/test_compiler.rb