Sha256: d99f727559d799e760df90d189c4738f1715ef7dc7b19231d84184f8fc1baddb
Contents?: true
Size: 1.19 KB
Versions: 2
Compression:
Stored size: 1.19 KB
Contents
require "test/unit" require "n/logger"; $log = Logger.new(STDERR) unless $log require "n/properties" module Test # :nodoc: all class Message prop_accessor Fixnum, :owner_oid prop_accessor Fixnum, "smallint", :val1, :val2, :val3 prop_accessor String, :title, :body prop_accessor String, "char(10) NOT NULL", :test prop_accessor Fixnum, :count prop_accessor Time, :create_time # a marshaled property prop_accessor Array, :options def initialize @create_time = Time.now @options = [] end end class SubMessage < Message inherit_meta(superclass) # duplicate definition prop_accessor Float, :count end class TC_N_Properties < Test::Unit::TestCase def setup @msg1 = Message.new end def teardown @msg1 = nil end def test_props # bug: props for subclasses. assert(SubMessage.__props) assert_equal(Message.__props.size(), SubMessage.__props.size()) # bug: duplicate definition assert_equal(Float, SubMessage.__props.find { |p| :count == p.symbol }.klass) # dont force conversion @msg1.count = 2.4 assert_equal(Float, @msg1.count.class) # force conversion @msg1.__force_count(2.4) assert_equal(Fixnum, @msg1.count.class) end end end # module
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nitro-0.2.0 | test/n/tc_properties.rb |
nitro-0.3.0 | test/n/tc_properties.rb |