Changeset 1234
- Timestamp:
- 04/19/05 19:00:06 (3 years ago)
- Files:
-
- trunk/actionwebservice/lib/action_web_service/casting.rb (modified) (1 diff)
- trunk/actionwebservice/test/casting_test.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionwebservice/lib/action_web_service/casting.rb
r1171 r1234 40 40 def cast(value, signature_type) # :nodoc: 41 41 return value if signature_type.nil? # signature.length != params.length 42 return nil if value.nil? 42 43 unless signature_type.array? || signature_type.structured? 43 44 return value if canonical_type(value.class) == signature_type.type trunk/actionwebservice/test/casting_test.rb
r1072 r1234 63 63 def test_array_type_casting 64 64 assert_equal [1, 2, 3213992, 4], cast_expects(:int_array, ['1', '2', '3213992', '4'])[0] 65 assert_equal ['one', 'two', '5.0', '200', '', 'true'], cast_expects(:str_array, [:one, 'two', 5.0, 200, nil, true])[0]66 assert_equal [true, false, true, true, false], cast_expects(:bool_array, ['1', nil, 'y', true, 'false'])[0]65 assert_equal ['one', 'two', '5.0', '200', nil, 'true'], cast_expects(:str_array, [:one, 'two', 5.0, 200, nil, true])[0] 66 assert_equal [true, nil, true, true, false], cast_expects(:bool_array, ['1', nil, 'y', true, 'false'])[0] 67 67 end 68 68