Sha256: 0ef5620c8524ad27c11d3d634ba959079fb5652ed53d3f3c2a2fdf5faf241c3c

Contents?: true

Size: 1.29 KB

Versions: 2

Compression:

Stored size: 1.29 KB

Contents

#!/usr/bin/env ruby -w
# encoding: UTF-8

#--
# Simple Declarative Language (SDL) for Ruby
# Copyright 2005 Ikayzo, inc.
#
# This program is free software. You can distribute or modify it under the
# terms of the GNU Lesser General Public License version 2.1 as published by
# the Free Software Foundation.
#
# This program is distributed AS IS and WITHOUT WARRANTY. OF ANY KIND,
# INCLUDING MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program; if not, contact the Free Software Foundation, Inc.,
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#++

module SDL4R

  require 'test/unit'
  require "rexml/document"

  require 'sdl4r/tag'

  class SDLTest < Test::Unit::TestCase

    def test_coerce_or_fail
      # Most basic types are considered to be tested in other tests (like ParserTest)
      tag = Tag.new "tag1"
      assert_raise ArgumentError do tag.add_value(Object.new) end
      assert_raise ArgumentError do tag.add_value([1, 2, 3]) end
      assert_raise ArgumentError do tag.add_value({"a" => "b"}) end

      # check translation of Rational
      tag.add_value(Rational(3, 10))
      assert_equal [0.3], tag.values
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sdl4r-0.9.9 test/sdl4r/sdl_test.rb
sdl4r-0.9.8 test/sdl4r/sdl_test.rb