striuct 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. data/.gitignore +35 -34
  2. data/.travis.yml +6 -6
  3. data/Gemfile +12 -12
  4. data/History.rdoc +279 -273
  5. data/LICENSE +21 -21
  6. data/Manifest.txt +91 -90
  7. data/README.ja.old.rdoc +297 -297
  8. data/README.md +128 -128
  9. data/Rakefile +11 -11
  10. data/benchmark/basics.rb +56 -56
  11. data/example/README.rb +44 -44
  12. data/example/example.old.rdoc +187 -187
  13. data/example/example1.rb +233 -233
  14. data/example/example2.rb +22 -22
  15. data/example/see_trace.rb +32 -32
  16. data/lib/striuct/classmethods/README.md +5 -5
  17. data/lib/striuct/classmethods/adjustment.rb +32 -32
  18. data/lib/striuct/classmethods/constructor.rb +63 -63
  19. data/lib/striuct/classmethods/default.rb +27 -27
  20. data/lib/striuct/classmethods/enum.rb +48 -48
  21. data/lib/striuct/classmethods/inner.rb +91 -91
  22. data/lib/striuct/classmethods/length.rb +14 -14
  23. data/lib/striuct/classmethods/macro.rb +144 -144
  24. data/lib/striuct/classmethods/named.rb +113 -113
  25. data/lib/striuct/classmethods/object.rb +54 -54
  26. data/lib/striuct/classmethods/prevent_conflicts.rb +89 -89
  27. data/lib/striuct/classmethods/requiremnets.rb +11 -11
  28. data/lib/striuct/classmethods/to_struct.rb +23 -25
  29. data/lib/striuct/classmethods/validation.rb +55 -55
  30. data/lib/striuct/classmethods.rb +1 -1
  31. data/lib/striuct/instancemethods/README.md +5 -5
  32. data/lib/striuct/instancemethods/assign.rb +30 -30
  33. data/lib/striuct/instancemethods/cast.rb +34 -34
  34. data/lib/striuct/instancemethods/compare.rb +30 -30
  35. data/lib/striuct/instancemethods/default.rb +13 -13
  36. data/lib/striuct/instancemethods/delegate_class_methods.rb +28 -28
  37. data/lib/striuct/instancemethods/enum.rb +103 -103
  38. data/lib/striuct/instancemethods/hashy.rb +121 -121
  39. data/lib/striuct/instancemethods/inner.rb +60 -60
  40. data/lib/striuct/instancemethods/keyvalidatable.rb +14 -14
  41. data/lib/striuct/instancemethods/lock.rb +61 -61
  42. data/lib/striuct/instancemethods/object.rb +52 -52
  43. data/lib/striuct/instancemethods/requirements.rb +14 -14
  44. data/lib/striuct/instancemethods/safety.rb +11 -11
  45. data/lib/striuct/instancemethods/subscript.rb +55 -55
  46. data/lib/striuct/instancemethods/validation.rb +29 -25
  47. data/lib/striuct/instancemethods/values.rb +57 -57
  48. data/lib/striuct/instancemethods.rb +1 -1
  49. data/lib/striuct/requirements.rb +5 -5
  50. data/lib/striuct/singleton_class.rb +66 -66
  51. data/lib/striuct/specificcontainer.rb +19 -19
  52. data/lib/striuct/structs.rb +7 -7
  53. data/lib/striuct/version.rb +5 -5
  54. data/lib/striuct.rb +13 -13
  55. data/striuct.gemspec +24 -24
  56. data/test/helper.rb +5 -5
  57. data/test/test_striuct-singleton_class-define.rb +19 -19
  58. data/test/test_striuct-subclass-class-cloning.rb +20 -20
  59. data/test/test_striuct-subclass-class-close.rb +36 -36
  60. data/test/test_striuct-subclass-class-constructor.rb +82 -82
  61. data/test/test_striuct-subclass-class-freeze.rb +36 -36
  62. data/test/test_striuct-subclass-class-inheritable.rb +57 -57
  63. data/test/test_striuct-subclass-class-macro.rb +13 -13
  64. data/test/test_striuct-subclass-class-safety_naming.rb +72 -72
  65. data/test/test_striuct-subclass-class-validation.rb +26 -26
  66. data/test/test_striuct-subclass-feature-alias_member.rb +53 -53
  67. data/test/test_striuct-subclass-feature-to_struct.rb +61 -25
  68. data/test/test_striuct-subclass-feature-validation_util.rb +57 -0
  69. data/test/test_striuct-subclass-instance-accessor.rb +137 -137
  70. data/test/test_striuct-subclass-instance-adjuster.rb +94 -94
  71. data/test/test_striuct-subclass-instance-assign.rb +30 -30
  72. data/test/test_striuct-subclass-instance-basic.rb +32 -32
  73. data/test/test_striuct-subclass-instance-cloning.rb +22 -22
  74. data/test/test_striuct-subclass-instance-compare.rb +51 -51
  75. data/test/test_striuct-subclass-instance-default_value.rb +128 -128
  76. data/test/test_striuct-subclass-instance-enum.rb +92 -92
  77. data/test/test_striuct-subclass-instance-freeze.rb +19 -19
  78. data/test/test_striuct-subclass-instance-hashlike.rb +153 -153
  79. data/test/test_striuct-subclass-instance-keyvalidatable.rb +24 -24
  80. data/test/test_striuct-subclass-instance-lock.rb +39 -39
  81. data/test/test_striuct-subclass-instance-to_s_family.rb +25 -25
  82. data/test/test_striuct-subclass-instance-validation_functional_condition.rb +50 -50
  83. data/test/test_striuct-subclass-instance-validation_inference.rb +50 -50
  84. data/test/test_striuct-subclass-instance-validation_specific_conditions.rb +247 -247
  85. data/test/test_striuct-subclass-instance-validation_with_getter.rb +33 -33
  86. data/test/test_striuct-subclass-instance_names.rb +18 -18
  87. data/test/test_striuct-version.rb +10 -10
  88. metadata +4 -2
@@ -1,51 +1,51 @@
1
- require_relative 'helper'
2
-
3
- class Test_Striuct_Subclass_Instance_Inference < Test::Unit::TestCase
4
-
5
- def test_inference
6
- klass = Striuct.define do
7
- member :n, Numeric, inference: true
8
- member :m, ANYTHING?, inference: true
9
- end
10
-
11
- sth, sth2 = klass.new, klass.new
12
-
13
- assert_raises Validation::InvalidWritingError do
14
- sth.n = '1'
15
- end
16
-
17
- sth.n = 1.1
18
-
19
- assert_equal 1.1, sth.n
20
-
21
- assert_raises Validation::InvalidWritingError do
22
- sth.n = 1
23
- end
24
-
25
- assert_raises Validation::InvalidWritingError do
26
- sth2.n = 1
27
- end
28
-
29
- sth.n = 2.1
30
-
31
- assert_equal 2.1, sth.n
32
-
33
-
34
- sth2.m = 1
35
-
36
- assert_equal 1, sth2.m
37
-
38
- assert_raises Validation::InvalidWritingError do
39
- sth.m = 1.0
40
- end
41
-
42
- assert_raises Validation::InvalidWritingError do
43
- sth2.m = 1.0
44
- end
45
-
46
- sth.m = 2
47
-
48
- assert_equal 2, sth.m
49
- end
50
-
1
+ require_relative 'helper'
2
+
3
+ class Test_Striuct_Subclass_Instance_Inference < Test::Unit::TestCase
4
+
5
+ def test_inference
6
+ klass = Striuct.define do
7
+ member :n, Numeric, inference: true
8
+ member :m, ANYTHING?, inference: true
9
+ end
10
+
11
+ sth, sth2 = klass.new, klass.new
12
+
13
+ assert_raises Validation::InvalidWritingError do
14
+ sth.n = '1'
15
+ end
16
+
17
+ sth.n = 1.1
18
+
19
+ assert_equal 1.1, sth.n
20
+
21
+ assert_raises Validation::InvalidWritingError do
22
+ sth.n = 1
23
+ end
24
+
25
+ assert_raises Validation::InvalidWritingError do
26
+ sth2.n = 1
27
+ end
28
+
29
+ sth.n = 2.1
30
+
31
+ assert_equal 2.1, sth.n
32
+
33
+
34
+ sth2.m = 1
35
+
36
+ assert_equal 1, sth2.m
37
+
38
+ assert_raises Validation::InvalidWritingError do
39
+ sth.m = 1.0
40
+ end
41
+
42
+ assert_raises Validation::InvalidWritingError do
43
+ sth2.m = 1.0
44
+ end
45
+
46
+ sth.m = 2
47
+
48
+ assert_equal 2, sth.m
49
+ end
50
+
51
51
  end
@@ -1,247 +1,247 @@
1
- require_relative 'helper'
2
-
3
- class Test_Striuct_Subclass_Instance_SpecificConditions < Test::Unit::TestCase
4
-
5
- Sth = Striuct.define do
6
- member :list_only_int, GENERICS(Integer)
7
- member :true_or_false, BOOL?
8
- member :like_str, STRINGABLE?
9
- member :has_foo, CAN(:foo)
10
- member :has_foo_and_bar, CAN(:foo, :bar)
11
- member :one_of_member, MEMBER_OF([1, 3])
12
- member :has_ignore, AND(1..5, 3..10)
13
- member :nand, NAND(1..5, 3..10)
14
- member :all_pass, OR(1..5, 3..10)
15
- member :catch_error, CATCH(NoMethodError){|v|v.no_name!}
16
- member :no_exception, QUIET(->v{v.class})
17
- member :not_integer, NOT(Integer)
18
- end
19
-
20
- def test_not
21
- sth = Sth.new
22
-
23
- obj = Object.new
24
-
25
- sth.not_integer = obj
26
- assert_same obj, sth.not_integer
27
-
28
- assert_raises Validation::InvalidWritingError do
29
- sth.not_integer = 1
30
- end
31
- end
32
-
33
-
34
- def test_still
35
- sth = Sth.new
36
-
37
- obj = Object.new
38
-
39
- sth.no_exception = obj
40
- assert_same obj, sth.no_exception
41
- sth.no_exception = false
42
-
43
- obj.singleton_class.class_eval do
44
- undef_method :class
45
- end
46
-
47
- assert_raises Validation::InvalidWritingError do
48
- sth.no_exception = obj
49
- end
50
- end
51
-
52
- def test_catch
53
- sth = Sth.new
54
-
55
- obj = Object.new
56
-
57
- sth.catch_error = obj
58
- assert_same obj, sth.catch_error
59
- sth.catch_error = false
60
-
61
- obj.singleton_class.class_eval do
62
- def no_name!
63
- end
64
- end
65
-
66
- assert_raises Validation::InvalidWritingError do
67
- sth.catch_error = obj
68
- end
69
- end
70
-
71
- def test_or
72
- sth = Sth.new
73
-
74
- assert_raises Validation::InvalidWritingError do
75
- sth.all_pass = 11
76
- end
77
-
78
- sth.all_pass = 1
79
- assert_equal 1, sth.all_pass
80
- sth.all_pass = 4
81
- assert_equal 4, sth.all_pass
82
- assert_equal true, sth.valid?(:all_pass)
83
- end
84
-
85
- def test_and
86
- sth = Sth.new
87
-
88
- assert_raises Validation::InvalidWritingError do
89
- sth.has_ignore = 1
90
- end
91
-
92
- assert_raises Validation::InvalidWritingError do
93
- sth.has_ignore= 2
94
- end
95
-
96
- sth.has_ignore = 3
97
- assert_equal 3, sth.has_ignore
98
- assert_equal true, sth.valid?(:has_ignore)
99
-
100
- assert_raises Validation::InvalidWritingError do
101
- sth.has_ignore = []
102
- end
103
- end
104
-
105
- def test_nand
106
- sth = Sth.new
107
-
108
- assert_raises Validation::InvalidWritingError do
109
- sth.nand = 4
110
- end
111
-
112
- assert_raises Validation::InvalidWritingError do
113
- sth.nand = 4.5
114
- end
115
-
116
- sth.nand = 2
117
- assert_equal 2, sth.nand
118
- assert_equal true, sth.valid?(:nand)
119
- sth.nand = []
120
- assert_equal [], sth.nand
121
- end
122
-
123
- def test_member_of
124
- sth = Sth.new
125
-
126
- assert_raises Validation::InvalidWritingError do
127
- sth.one_of_member = 4
128
- end
129
-
130
- sth.one_of_member = 3
131
- assert_equal 3, sth.one_of_member
132
- assert_equal true, sth.valid?(:one_of_member)
133
- end
134
-
135
- def test_generics
136
- sth = Sth.new
137
-
138
- assert_raises Validation::InvalidWritingError do
139
- sth.list_only_int = [1, '2']
140
- end
141
-
142
- sth.list_only_int = [1, 2]
143
- assert_equal [1, 2], sth.list_only_int
144
- assert_equal true, sth.valid?(:list_only_int)
145
- sth.list_only_int = []
146
- assert_equal [], sth.list_only_int
147
- assert_equal true, sth.valid?(:list_only_int)
148
- sth.list_only_int << '2'
149
- assert_equal false, sth.valid?(:list_only_int)
150
- end
151
-
152
- def test_boolean
153
- sth = Sth.new
154
-
155
- assert_raises Validation::InvalidWritingError do
156
- sth.true_or_false = nil
157
- end
158
-
159
- assert_equal false, sth.valid?(:true_or_false)
160
-
161
- sth.true_or_false = true
162
- assert_equal true, sth.true_or_false
163
- assert_equal true, sth.valid?(:true_or_false)
164
- sth.true_or_false = false
165
- assert_equal false, sth.true_or_false
166
- assert_equal true, sth.valid?(:true_or_false)
167
- end
168
-
169
- def test_stringable
170
- sth = Sth.new
171
- obj = Object.new
172
-
173
- assert_raises Validation::InvalidWritingError do
174
- sth.like_str = obj
175
- end
176
-
177
- sth.like_str = 'str'
178
- assert_equal true, sth.valid?(:like_str)
179
- sth.like_str = :sym
180
- assert_equal true, sth.valid?(:like_str)
181
-
182
- obj.singleton_class.class_eval do
183
- def to_str
184
- end
185
- end
186
-
187
- sth.like_str = obj
188
- assert_equal true, sth.valid?(:like_str)
189
- end
190
-
191
- def test_responsible_arg1
192
- sth = Sth.new
193
- obj = Object.new
194
-
195
- raise if obj.respond_to? :foo
196
-
197
- assert_raises Validation::InvalidWritingError do
198
- sth.has_foo = obj
199
- end
200
-
201
- obj.singleton_class.class_eval do
202
- def foo
203
- end
204
- end
205
-
206
- raise unless obj.respond_to? :foo
207
-
208
- sth.has_foo = obj
209
- assert_equal obj, sth.has_foo
210
- assert_equal true, sth.valid?(:has_foo)
211
- end
212
-
213
- def test_responsible_arg2
214
- sth = Sth.new
215
- obj = Object.new
216
-
217
- raise if obj.respond_to? :foo
218
- raise if obj.respond_to? :bar
219
-
220
- assert_raises Validation::InvalidWritingError do
221
- sth.has_foo_and_bar = obj
222
- end
223
-
224
- obj.singleton_class.class_eval do
225
- def foo
226
- end
227
- end
228
-
229
- assert_raises Validation::InvalidWritingError do
230
- sth.has_foo_and_bar = obj
231
- end
232
-
233
- raise unless obj.respond_to? :foo
234
-
235
- obj.singleton_class.class_eval do
236
- def bar
237
- end
238
- end
239
-
240
- raise unless obj.respond_to? :bar
241
-
242
- sth.has_foo_and_bar = obj
243
- assert_equal obj, sth.has_foo_and_bar
244
- assert_equal true, sth.valid?(:has_foo_and_bar)
245
- end
246
-
247
- end
1
+ require_relative 'helper'
2
+
3
+ class Test_Striuct_Subclass_Instance_SpecificConditions < Test::Unit::TestCase
4
+
5
+ Sth = Striuct.define do
6
+ member :list_only_int, GENERICS(Integer)
7
+ member :true_or_false, BOOL?
8
+ member :like_str, STRINGABLE?
9
+ member :has_foo, CAN(:foo)
10
+ member :has_foo_and_bar, CAN(:foo, :bar)
11
+ member :one_of_member, MEMBER_OF([1, 3])
12
+ member :has_ignore, AND(1..5, 3..10)
13
+ member :nand, NAND(1..5, 3..10)
14
+ member :all_pass, OR(1..5, 3..10)
15
+ member :catch_error, CATCH(NoMethodError){|v|v.no_name!}
16
+ member :no_exception, QUIET(->v{v.class})
17
+ member :not_integer, NOT(Integer)
18
+ end
19
+
20
+ def test_not
21
+ sth = Sth.new
22
+
23
+ obj = Object.new
24
+
25
+ sth.not_integer = obj
26
+ assert_same obj, sth.not_integer
27
+
28
+ assert_raises Validation::InvalidWritingError do
29
+ sth.not_integer = 1
30
+ end
31
+ end
32
+
33
+
34
+ def test_still
35
+ sth = Sth.new
36
+
37
+ obj = Object.new
38
+
39
+ sth.no_exception = obj
40
+ assert_same obj, sth.no_exception
41
+ sth.no_exception = false
42
+
43
+ obj.singleton_class.class_eval do
44
+ undef_method :class
45
+ end
46
+
47
+ assert_raises Validation::InvalidWritingError do
48
+ sth.no_exception = obj
49
+ end
50
+ end
51
+
52
+ def test_catch
53
+ sth = Sth.new
54
+
55
+ obj = Object.new
56
+
57
+ sth.catch_error = obj
58
+ assert_same obj, sth.catch_error
59
+ sth.catch_error = false
60
+
61
+ obj.singleton_class.class_eval do
62
+ def no_name!
63
+ end
64
+ end
65
+
66
+ assert_raises Validation::InvalidWritingError do
67
+ sth.catch_error = obj
68
+ end
69
+ end
70
+
71
+ def test_or
72
+ sth = Sth.new
73
+
74
+ assert_raises Validation::InvalidWritingError do
75
+ sth.all_pass = 11
76
+ end
77
+
78
+ sth.all_pass = 1
79
+ assert_equal 1, sth.all_pass
80
+ sth.all_pass = 4
81
+ assert_equal 4, sth.all_pass
82
+ assert_equal true, sth.valid?(:all_pass)
83
+ end
84
+
85
+ def test_and
86
+ sth = Sth.new
87
+
88
+ assert_raises Validation::InvalidWritingError do
89
+ sth.has_ignore = 1
90
+ end
91
+
92
+ assert_raises Validation::InvalidWritingError do
93
+ sth.has_ignore= 2
94
+ end
95
+
96
+ sth.has_ignore = 3
97
+ assert_equal 3, sth.has_ignore
98
+ assert_equal true, sth.valid?(:has_ignore)
99
+
100
+ assert_raises Validation::InvalidWritingError do
101
+ sth.has_ignore = []
102
+ end
103
+ end
104
+
105
+ def test_nand
106
+ sth = Sth.new
107
+
108
+ assert_raises Validation::InvalidWritingError do
109
+ sth.nand = 4
110
+ end
111
+
112
+ assert_raises Validation::InvalidWritingError do
113
+ sth.nand = 4.5
114
+ end
115
+
116
+ sth.nand = 2
117
+ assert_equal 2, sth.nand
118
+ assert_equal true, sth.valid?(:nand)
119
+ sth.nand = []
120
+ assert_equal [], sth.nand
121
+ end
122
+
123
+ def test_member_of
124
+ sth = Sth.new
125
+
126
+ assert_raises Validation::InvalidWritingError do
127
+ sth.one_of_member = 4
128
+ end
129
+
130
+ sth.one_of_member = 3
131
+ assert_equal 3, sth.one_of_member
132
+ assert_equal true, sth.valid?(:one_of_member)
133
+ end
134
+
135
+ def test_generics
136
+ sth = Sth.new
137
+
138
+ assert_raises Validation::InvalidWritingError do
139
+ sth.list_only_int = [1, '2']
140
+ end
141
+
142
+ sth.list_only_int = [1, 2]
143
+ assert_equal [1, 2], sth.list_only_int
144
+ assert_equal true, sth.valid?(:list_only_int)
145
+ sth.list_only_int = []
146
+ assert_equal [], sth.list_only_int
147
+ assert_equal true, sth.valid?(:list_only_int)
148
+ sth.list_only_int << '2'
149
+ assert_equal false, sth.valid?(:list_only_int)
150
+ end
151
+
152
+ def test_boolean
153
+ sth = Sth.new
154
+
155
+ assert_raises Validation::InvalidWritingError do
156
+ sth.true_or_false = nil
157
+ end
158
+
159
+ assert_equal false, sth.valid?(:true_or_false)
160
+
161
+ sth.true_or_false = true
162
+ assert_equal true, sth.true_or_false
163
+ assert_equal true, sth.valid?(:true_or_false)
164
+ sth.true_or_false = false
165
+ assert_equal false, sth.true_or_false
166
+ assert_equal true, sth.valid?(:true_or_false)
167
+ end
168
+
169
+ def test_stringable
170
+ sth = Sth.new
171
+ obj = Object.new
172
+
173
+ assert_raises Validation::InvalidWritingError do
174
+ sth.like_str = obj
175
+ end
176
+
177
+ sth.like_str = 'str'
178
+ assert_equal true, sth.valid?(:like_str)
179
+ sth.like_str = :sym
180
+ assert_equal true, sth.valid?(:like_str)
181
+
182
+ obj.singleton_class.class_eval do
183
+ def to_str
184
+ end
185
+ end
186
+
187
+ sth.like_str = obj
188
+ assert_equal true, sth.valid?(:like_str)
189
+ end
190
+
191
+ def test_responsible_arg1
192
+ sth = Sth.new
193
+ obj = Object.new
194
+
195
+ raise if obj.respond_to? :foo
196
+
197
+ assert_raises Validation::InvalidWritingError do
198
+ sth.has_foo = obj
199
+ end
200
+
201
+ obj.singleton_class.class_eval do
202
+ def foo
203
+ end
204
+ end
205
+
206
+ raise unless obj.respond_to? :foo
207
+
208
+ sth.has_foo = obj
209
+ assert_equal obj, sth.has_foo
210
+ assert_equal true, sth.valid?(:has_foo)
211
+ end
212
+
213
+ def test_responsible_arg2
214
+ sth = Sth.new
215
+ obj = Object.new
216
+
217
+ raise if obj.respond_to? :foo
218
+ raise if obj.respond_to? :bar
219
+
220
+ assert_raises Validation::InvalidWritingError do
221
+ sth.has_foo_and_bar = obj
222
+ end
223
+
224
+ obj.singleton_class.class_eval do
225
+ def foo
226
+ end
227
+ end
228
+
229
+ assert_raises Validation::InvalidWritingError do
230
+ sth.has_foo_and_bar = obj
231
+ end
232
+
233
+ raise unless obj.respond_to? :foo
234
+
235
+ obj.singleton_class.class_eval do
236
+ def bar
237
+ end
238
+ end
239
+
240
+ raise unless obj.respond_to? :bar
241
+
242
+ sth.has_foo_and_bar = obj
243
+ assert_equal obj, sth.has_foo_and_bar
244
+ assert_equal true, sth.valid?(:has_foo_and_bar)
245
+ end
246
+
247
+ end
@@ -1,33 +1,33 @@
1
- require_relative 'helper'
2
-
3
- class Test_Striuct_Subclass_Instance_GetterValidation < Test::Unit::TestCase
4
-
5
- Sth = Striuct.define do
6
- member :plus_getter, /./, getter_validation: true
7
- member :only_getter, /./, getter_validation: true,
8
- setter_validation: false
9
- end
10
-
11
- def test_getter_validation
12
- sth = Sth.new
13
-
14
- assert_raises Validation::InvalidWritingError do
15
- sth.plus_getter = ''
16
- end
17
-
18
- sth.plus_getter = 'abc'
19
- assert_equal 'abc', sth.plus_getter
20
- sth.plus_getter.clear
21
-
22
- assert_raises Validation::InvalidReadingError do
23
- sth.plus_getter
24
- end
25
-
26
- sth.only_getter = ''
27
-
28
- assert_raises Validation::InvalidReadingError do
29
- sth.only_getter
30
- end
31
- end
32
-
33
- end
1
+ require_relative 'helper'
2
+
3
+ class Test_Striuct_Subclass_Instance_GetterValidation < Test::Unit::TestCase
4
+
5
+ Sth = Striuct.define do
6
+ member :plus_getter, /./, getter_validation: true
7
+ member :only_getter, /./, getter_validation: true,
8
+ setter_validation: false
9
+ end
10
+
11
+ def test_getter_validation
12
+ sth = Sth.new
13
+
14
+ assert_raises Validation::InvalidWritingError do
15
+ sth.plus_getter = ''
16
+ end
17
+
18
+ sth.plus_getter = 'abc'
19
+ assert_equal 'abc', sth.plus_getter
20
+ sth.plus_getter.clear
21
+
22
+ assert_raises Validation::InvalidReadingError do
23
+ sth.plus_getter
24
+ end
25
+
26
+ sth.only_getter = ''
27
+
28
+ assert_raises Validation::InvalidReadingError do
29
+ sth.only_getter
30
+ end
31
+ end
32
+
33
+ end