Sha256: d35284ca8516fc66c3eb264b3eecefccd694159a61a4ec443a13c5d679a2380d

Contents?: true

Size: 1.33 KB

Versions: 3

Compression:

Stored size: 1.33 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 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

3 entries across 3 versions & 1 rubygems

Version Path
sdl4r-0.9.7 test/sdl4r/sdl_test.rb
sdl4r-0.9.6 test/sdl4r/sdl_test.rb
sdl4r-0.9.5 test/sdl4r/sdl_test.rb