Sha256: e6ce7e0034f4c15b26ce1f91aa63c25f181c0a8de2eab8d9590480830a08b14e

Contents?: true

Size: 1.45 KB

Versions: 18

Compression:

Stored size: 1.45 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 = "@<m>{\x03\x04\x02\x04|}, @<m>{\x03\x04\x02\x04\x02$}, @<m>{\x02\x03\x02a\x02\x04}, @<tt>{\x04}, @<tt>{\x02}, @<tt>{\x02\x02}, @<tt>{\x02\x02\x02}\n"
    actual = @c.__send__(:replace_fence, source_str)
    assert_equal expected, actual
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
review-5.6.0 test/test_compiler.rb
review-5.5.0 test/test_compiler.rb
review-5.4.0 test/test_compiler.rb
review-5.3.0 test/test_compiler.rb
review-5.2.0 test/test_compiler.rb
review-5.1.1 test/test_compiler.rb
review-5.1.0 test/test_compiler.rb
review-5.0.0 test/test_compiler.rb
review-4.2.0 test/test_compiler.rb
review-4.1.0 test/test_compiler.rb
review-4.0.0 test/test_compiler.rb
review-3.2.0 test/test_compiler.rb
review-3.1.0 test/test_compiler.rb
review-3.0.0 test/test_compiler.rb
review-3.0.0.rc1 test/test_compiler.rb
review-3.0.0.preview4 test/test_compiler.rb
review-3.0.0.preview3 test/test_compiler.rb
review-3.0.0.preview2 test/test_compiler.rb