Sha256: 1e13658186c6f7556217c2a8b5a39ff40a67589507c238d566ec62afd05b9767

Contents?: true

Size: 1.12 KB

Versions: 8

Compression:

Stored size: 1.12 KB

Contents

require "test_helper"

class Mathematical::MaliciousnessTest < Test::Unit::TestCase

  def test_it_does_not_error_on_unrecognized_commands
    render = Mathematical::Render.new
    output = nil
    assert_nothing_raised { output = render.render('$\align$') }
    assert_equal output, '$\align$'
  end

  def test_it_does_not_blow_up_on_bad_arguments
    # need to pass a hash here
    assert_raise TypeError do
      render = Mathematical::Render.new("not a hash")
    end

    # need to pass a string here
    render = Mathematical::Render.new
    assert_raise TypeError do
      Mathematical::Render.new.render(123)
    end
  end

  def test_it_does_not_blow_up_on_bad_options
    assert_raise TypeError do
      render = Mathematical::Render.new({:ppi => "not a number"})
    end

    assert_raise TypeError do
      render = Mathematical::Render.new({:zoom => "not a number"})
    end
  end


  def test_it_does_not_blow_up_on_bad_input
    assert_raise TypeError do
      render = Mathematical::Render.new.render(23)
    end

    assert_raise ArgumentError do
      render = Mathematical::Render.new.render("No dollars")
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mathematical-0.3.1 test/mathematical/maliciousness_test.rb
mathematical-0.3.0 test/mathematical/maliciousness_test.rb
mathematical-0.2.3 test/mathematical/maliciousness_test.rb
mathematical-0.2.2 test/mathematical/maliciousness_test.rb
mathematical-0.2.1 test/mathematical/maliciousness_test.rb
mathematical-0.2.0 test/mathematical/maliciousness_test.rb
mathematical-0.1.2 test/mathematical/maliciousness_test.rb
mathematical-0.1.1 test/mathematical/maliciousness_test.rb