This reverts commit 34763e0df3.
time.Time.Equal only tests that the two instances refer to the same instant, but time.Time also carries zone information, so this caused two non-equal instances to be considered equal.
As pointed out in issue #1520, if the suite is not initialised properly
(buy calling the Run function), then calling suite.Require() or
suite.Assert() will result in a deadlock.
This commit fixes that by panicking if the suite is not initialised
properly. This is justified because, the suite is intended to be
triggered in the right way. If the user does not do that, this panic will
nudge them in the right direction.
It has to be a panic because, at this point, we don't have access to any
testing.T context to gracefully call a t.Fail(). Also, these two
functions are not expected to return an error.
Fixes#1520
Previously, the use of %s with array objects meant you would get an
error like this:
"[%!s(int=1) %!s(int=2) %!s(int=3)]\" should have 4 item(s), but has 3
Use %v instead, which provides a much nicer error.
"[1 2 3]" should have 4 item(s), but has 3
Fixes#1482.
The underlying function ObjectsAreEqualValues did not handle
overflow/underflow of values while converting one type to another
for comparison. For example:
EqualValues(t, int(270), int8(14))
would return true, even though the values are not equal. Because, when
you convert int(270) to int8, it overflows and becomes 14 (270 % 256 = 14)
This commit fixes that by making sure that the conversion always happens
from the smaller type to the larger type, and then comparing the values.
Additionally, this commit also seperates out the test cases of
ObjectsAreEqualValues from TestObjectsAreEqual.
Fixes#1462
1. Isolate tests that use the "unsafe" package in a separate package
assert/internal/unsafetests. That way the assert package is not
tainted with unsafe.
2. Remove one reference to the private assert.isNil() in assert tests.
3. Add more tests of assert.Nil and assert.NotNil with unsafe.Pointer.
* suite: fix TestSubtestPanic failure (#1501)
The subtest of TestSubtestPanic is expected to fail, but that must not
make the testuite of package 'suite' to fail. So call Skip to make 'go
test' to ignore that expected failure.
* suite: fix subtests names
We are doing dirty things with testing.InternalTest. It looks like test
names should have the same prefix as the parent test, like if they were
true subtests (testing.T.Run).
So until we drop our usage of testing.InternamTest, let's rename the
tests.
Also added a few checks of the testing.RunTests result.