File: test_exception.rb

package info (click to toggle)
libcairo-ruby 1.8.1-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 2,476 kB
  • ctags: 5,116
  • sloc: ruby: 9,621; ansic: 6,413; sh: 19; makefile: 3
file content (27 lines) | stat: -rw-r--r-- 673 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
require 'cairo'

class ExceptionTest < Test::Unit::TestCase
  def test_new_symbols_since_1_7_2
    if Cairo.satisfied_version?(1, 7, 2)
      assertion = :assert_defined
    else
      assertion = :assert_not_defined
    end
    send(assertion, "FontTypeMismatch")
    send(assertion, "UserFontImmutable")
    send(assertion, "UserFontError")
    send(assertion, "NegativeCount")
    send(assertion, "InvalidClusters")
    send(assertion, "InvalidSlant")
    send(assertion, "InvalidWeight")
  end

  private
  def assert_defined(name)
    assert_true(Cairo.const_defined?(name))
  end

  def assert_not_defined(name)
    assert_false(Cairo.const_defined?(name))
  end
end