Sha256: 298056f397280eadc6832392a6c4d9b1572f87e0a2f44b322280e2e836af1514

Contents?: true

Size: 1.54 KB

Versions: 1

Compression:

Stored size: 1.54 KB

Contents

#
# Testing OpenWFE
#
# John Mettraux at openwfe.org
#
# Sun Oct 29 16:18:25 JST 2006
#

require 'test/unit'
require 'openwfe/utils'
require 'openwfe/expressions/fe_define'
require 'openwfe/expressions/expressionmap'

#
# testing misc things
#

class MiscTest < Test::Unit::TestCase

    #def setup
    #end

    #def teardown
    #end

    def test_starts_with
        assert \
            OpenWFE::starts_with("//a", "//")
        assert \
            (not OpenWFE::starts_with("/a", "//"))
    end

    def test_ends_with
        assert \
            OpenWFE::ends_with("c'est la fin", "fin")
    end

    def test_expression_map

        em = OpenWFE::ExpressionMap.new('expressionmap', {})

        assert \
            em.get_class('process-definition') == OpenWFE::DefineExpression,
            "class of 'process-definition' should be DefineExpression"
        assert \
            em.is_definition?('process-definition'),
            "process-definition should be considered as a definition"
    end

    def test_dup
        a0 = A.new
        a0.a = 1
        a0.b = 2
        a1 = OpenWFE::dup(a0)

        #puts a0
        #puts a1
        
        assert \
            a0.equals(a1),
            "dup() utility not working"
    end

    private
    
        class A
            attr_accessor :a, :b

            def equals (other)
                return false if not other.kind_of?(A)
                return (self.a == other.a and self.b == other.b)
            end

            def to_s
                "A : a='#{a}', b='#{b}'"
            end
        end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
openwferu-0.9.2 test/misctest.rb