mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
ruby: tests: use more asserts instead of manual checks
Make more use of assert_equal/refute_equal instead of manually checking values and raising errors.
This commit is contained in:
@@ -30,9 +30,7 @@ class TestLoad < MiniTest::Unit::TestCase
|
||||
g.lvcreate("LV2", "VG", 200);
|
||||
|
||||
lvs = g.lvs()
|
||||
if lvs != ["/dev/VG/LV1", "/dev/VG/LV2"]
|
||||
raise "incorrect lvs returned"
|
||||
end
|
||||
assert_equal ["/dev/VG/LV1", "/dev/VG/LV2"], lvs
|
||||
|
||||
g.sync()
|
||||
end
|
||||
|
||||
@@ -29,12 +29,8 @@ class TestLoad < MiniTest::Unit::TestCase
|
||||
# Check that the close event is called.
|
||||
g.set_event_callback(close, Guestfs::EVENT_CLOSE)
|
||||
|
||||
if close_invoked != 0
|
||||
raise "close_invoked should be 0"
|
||||
end
|
||||
assert_equal 0, close_invoked
|
||||
g.close()
|
||||
if close_invoked != 1
|
||||
raise "close_invoked should be 1"
|
||||
end
|
||||
assert_equal 1, close_invoked
|
||||
end
|
||||
end
|
||||
|
||||
@@ -45,8 +45,6 @@ class TestLoad < MiniTest::Unit::TestCase
|
||||
g.set_autosync(1)
|
||||
|
||||
g.close()
|
||||
if log_invoked == 0
|
||||
raise "log_invoked should be > 0"
|
||||
end
|
||||
refute_equal 0, log_invoked
|
||||
end
|
||||
end
|
||||
|
||||
@@ -38,8 +38,6 @@ class TestLoad < MiniTest::Unit::TestCase
|
||||
# This should call the close callback.
|
||||
g.close()
|
||||
|
||||
if close_invoked != 1
|
||||
raise "close_invoked should be 1"
|
||||
end
|
||||
assert_equal 1, close_invoked
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user