Skip to content

Commit

Permalink
I am an idiot... fixed a last-day-of-month testing bug. I don't think…
Browse files Browse the repository at this point in the history
… I've done that in 15+ years. :P

[git-p4: depot-paths = "//src/minitest/dev/": change = 12818]
  • Loading branch information
zenspider committed Aug 31, 2020
1 parent 32d49db commit 0e6c44a
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions test/minitest/test_minitest_assertions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1118,16 +1118,20 @@ def test_epsilon_consistency
end
end

def assert_fail_after t
@tc.fail_after t.year, t.month, t.day, "remove the deprecations"
end

def test_fail_after
t = Time.now
y, m, d = t.year, t.month, t.day
d0 = Time.now
d1 = d0 + 86_400 # I am an idiot

assert_silent do
@tc.fail_after y, m, d+1, "remove the deprecations"
assert_fail_after d1
end

assert_triggered "remove the deprecations" do
@tc.fail_after y, m, d, "remove the deprecations"
assert_fail_after d0
end
end

Expand Down Expand Up @@ -1342,18 +1346,22 @@ def test_skip
end
end

def assert_skip_until t, msg
@tc.skip_until t.year, t.month, t.day, msg
end

def test_skip_until
@assertion_count = 0

t = Time.now
y, m, d = t.year, t.month, t.day
d0 = Time.now
d1 = d0 + 86_400 # I am an idiot

assert_output "", /Stale skip_until \"not yet\" at .*?:\d+$/ do
@tc.skip_until y, m, d, "not yet"
assert_skip_until d0, "not yet"
end

assert_triggered "not ready yet", Minitest::Skip do
@tc.skip_until y, m, d+1, "not ready yet"
assert_skip_until d1, "not ready yet"
end
end

Expand Down

0 comments on commit 0e6c44a

Please sign in to comment.