summaryrefslogtreecommitdiff
path: root/test/ruby/test_struct.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_struct.rb')
-rw-r--r--test/ruby/test_struct.rb25
1 files changed, 14 insertions, 11 deletions
diff --git a/test/ruby/test_struct.rb b/test/ruby/test_struct.rb
index e02f791f27..4a57537d37 100644
--- a/test/ruby/test_struct.rb
+++ b/test/ruby/test_struct.rb
@@ -5,19 +5,22 @@ $KCODE = 'none'
class TestStruct < Test::Unit::TestCase
def test_struct
struct_test = Struct.new("Test", :foo, :bar)
- assert_equal(struct_test, Struct::Test)
-
+ assert_equal(Struct::Test, struct_test)
+
test = struct_test.new(1, 2)
- assert(test.foo == 1 && test.bar == 2)
- assert(test[0] == 1 && test[1] == 2)
-
+ assert_equal(1, test.foo)
+ assert_equal(2, test.bar)
+ assert_equal(1, test[0])
+ assert_equal(2, test[1])
+
a, b = test.to_a
- assert(a == 1 && b == 2)
-
+ assert_equal(1, a)
+ assert_equal(2, b)
+
test[0] = 22
- assert_equal(test.foo, 22)
-
+ assert_equal(22, test.foo)
+
test.bar = 47
- assert_equal(test.bar, 47)
- end
+ assert_equal(47, test.bar)
+ end
end