Code cleanup.
[ruby-eet.git] / test / test_broken_classes.rb
1 # $Id: test_broken_classes.rb 1 2005-03-26 01:45:38Z tilman $
2
3 class BrokenTestData1
4 end
5
6 class BrokenTestData2
7         def to_eet_properties
8         end
9 end
10
11 class BrokenTestData3
12         def to_eet_properties
13                 ["blah"]
14         end
15 end
16
17 class BrokenTestData4
18         def to_eet_properties
19                 {}
20         end
21 end
22
23 class BrokenTestData5
24         def to_eet_name
25                 "blah"
26         end
27
28         def to_eet_properties
29                 {"" => nil}
30         end
31 end
32
33 class BrokenTestData6
34         def to_eet_name
35                 "blah"
36         end
37
38         def to_eet_properties
39                 {"blah" => nil}
40         end
41 end
42
43 class BrokenTestData7
44         def to_eet_properties
45                 {"blah" => [nil]}
46         end
47 end
48
49 class BrokenTestData8
50         def to_eet_name
51         end
52
53         def to_eet_properties
54                 {"blah" => [nil]}
55         end
56 end
57
58 class BrokenTestData9
59         def to_eet_name
60                 ""
61         end
62
63         def to_eet_properties
64                 {"blah" => [nil]}
65         end
66 end
67
68 class BrokenTest < Test::Unit::TestCase
69         def test_broken_properties
70                 (1..6).each do |i|
71                         assert_raise(Eet::PropertyError) do
72                                 Object.const_get("BrokenTestData#{i}").new.to_eet
73                         end
74                 end
75         end
76
77         def test_broken_eet_names
78                 assert_raise(NoMethodError) do
79                         BrokenTestData8.new.to_eet
80                 end
81
82                 assert_raise(Eet::NameError) do
83                         BrokenTestData9.new.to_eet
84                 end
85         end
86 end