test/minitest/test_minitest_assertions.rb in minitest-5.12.2 vs test/minitest/test_minitest_assertions.rb in minitest-5.13.0
- old
+ new
@@ -395,11 +395,11 @@
def test_assert_in_delta
@tc.assert_in_delta 0.0, 1.0 / 1000, 0.1
end
def test_assert_in_delta_triggered
- x = maglev? ? "9.999999xxxe-07" : "1.0e-06"
+ x = "1.0e-06"
assert_triggered "Expected |0.0 - 0.001| (0.001) to be <= #{x}." do
@tc.assert_in_delta 0.0, 1.0 / 1000, 0.000001
end
end
@@ -426,11 +426,11 @@
end
end
def test_assert_in_epsilon_triggered_negative_case
x = (RUBY18 and not maglev?) ? "0.1" : "0.100000xxx"
- y = maglev? ? "0.100000xxx" : "0.1"
+ y = "0.1"
assert_triggered "Expected |-1.1 - -1| (#{x}) to be <= #{y}." do
@tc.assert_in_epsilon(-1.1, -1, 0.1)
end
end
@@ -904,10 +904,20 @@
# do nothing
end
end
end
+ def test_assert_path_exists
+ @tc.assert_path_exists __FILE__
+ end
+
+ def test_assert_path_exists_triggered
+ assert_triggered "Expected path 'blah' to exist." do
+ @tc.assert_path_exists "blah"
+ end
+ end
+
def test_capture_io
@assertion_count = 0
non_verbose do
out, err = capture_io do
@@ -976,10 +986,23 @@
assert_triggered msg do
@tc.refute_in_epsilon 1.0, 1.001
end
end
+ def test_fail_after
+ t = Time.now
+ y, m, d = t.year, t.month, t.day
+
+ assert_silent do
+ @tc.fail_after y, m, d+1, "remove the deprecations"
+ end
+
+ assert_triggered "remove the deprecations" do
+ @tc.fail_after y, m, d, "remove the deprecations"
+ end
+ end
+
def test_flunk
assert_triggered "Epic Fail!" do
@tc.flunk
end
end
@@ -1027,11 +1050,11 @@
def test_refute_in_delta
@tc.refute_in_delta 0.0, 1.0 / 1000, 0.000001
end
def test_refute_in_delta_triggered
- x = maglev? ? "0.100000xxx" : "0.1"
+ x = "0.1"
assert_triggered "Expected |0.0 - 0.001| (0.001) to not be <= #{x}." do
@tc.refute_in_delta 0.0, 1.0 / 1000, 0.1
end
end
@@ -1169,14 +1192,39 @@
assert_triggered "Expected 1 (oid=N) to not be the same as 1 (oid=N)." do
@tc.refute_same 1, 1
end
end
+ def test_refute_path_exists
+ @tc.refute_path_exists "blah"
+ end
+
+ def test_refute_path_exists_triggered
+ assert_triggered "Expected path '#{__FILE__}' to not exist." do
+ @tc.refute_path_exists __FILE__
+ end
+ end
+
def test_skip
@assertion_count = 0
assert_triggered "haha!", Minitest::Skip do
@tc.skip "haha!"
+ end
+ end
+
+ def test_skip_until
+ @assertion_count = 0
+
+ t = Time.now
+ y, m, d = t.year, t.month, t.day
+
+ assert_output "", /Stale skip_until \"not yet\" at .*?:\d+$/ do
+ @tc.skip_until y, m, d, "not yet"
+ end
+
+ assert_triggered "not ready yet", Minitest::Skip do
+ @tc.skip_until y, m, d+1, "not ready yet"
end
end
def util_msg exp, act, msg = nil
s = "Expected: #{exp.inspect}\n Actual: #{act.inspect}"