~ubuntu-branches/ubuntu/hardy/ruby1.8/hardy-updates

« back to all changes in this revision

Viewing changes to test/soap/marshal/test_struct.rb

  • Committer: Bazaar Package Importer
  • Author(s): akira yamada
  • Date: 2007-03-13 22:11:58 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20070313221158-h3oql37brlaf2go2
Tags: 1.8.6-1
* new upstream version, 1.8.6.
* libruby1.8 conflicts with libopenssl-ruby1.8 (< 1.8.6) (closes: #410018)
* changed packaging style to cdbs from dbs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
require 'test/unit'
 
2
require 'soap/marshal'
 
3
 
 
4
 
 
5
module SOAP
 
6
module Marshal
 
7
 
 
8
 
 
9
Foo1 = ::Struct.new("Foo1", :m)
 
10
Foo2 = ::Struct.new(:m)
 
11
class Foo3
 
12
  attr_accessor :m
 
13
end
 
14
 
 
15
class TestStruct < Test::Unit::TestCase
 
16
  def test_foo1
 
17
    org = Foo1.new
 
18
    org.m = org
 
19
    obj = convert(org)
 
20
    assert_equal(Foo1, obj.class)
 
21
    assert_equal(obj.m, obj)
 
22
  end
 
23
 
 
24
  def test_foo2
 
25
    org = Foo2.new
 
26
    org.m = org
 
27
    obj = convert(org)
 
28
    assert_equal(Foo2, obj.class)
 
29
    assert_equal(obj.m, obj)
 
30
  end
 
31
 
 
32
  def test_foo3
 
33
    org = Foo3.new
 
34
    org.m = org
 
35
    obj = convert(org)
 
36
    assert_equal(Foo3, obj.class)
 
37
    assert_equal(obj.m, obj)
 
38
  end
 
39
 
 
40
  def convert(obj)
 
41
    SOAP::Marshal.unmarshal(SOAP::Marshal.marshal(obj))
 
42
  end
 
43
end
 
44
 
 
45
 
 
46
end
 
47
end