Sha256: 55520496f9228b52d61ffa4cf49e93737990c967ea3e940ec6c6d5e249926042

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 KB

Contents

#--
# 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 File.dirname(__FILE__) + '/../../lib/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

1 entries across 1 versions & 1 rubygems

Version Path
sdl4r-0.9.4 test/sdl4r/sdl_test.rb