Comments (8)
see also #1
from testify.
Difficult to do as what is printed is different for most failures.
Sent from my iPhone
On Nov 21, 2012, at 7:36 AM, matryer [email protected] wrote:
t.Errorf("\r%s\r\tLocation:\t%s\n\r\tError:\t\tShould be true\n\r\tMessages:\t%s\n\r", getWhitespaceString(), CallerInfo(), message)
Put all of these into one place.
—
Reply to this email directly or view it on GitHub.
from testify.
Why not:
Fail(t *testing.T, failureMessage, messageAndArgs ...interface{}) bool {
// just write this out to the `t`
// the calling functions are responsible for writing the meaningful failureMessage
}
from testify.
NOTE: it should be a public method too... to allow people to just Fail in their test code.
assert.Fail(t, "This shouldn't happen")
from testify.
What is the goal? I don't see how this would result in less code in the methods?
Then again, I just woke up and I'm not quite functional.
On Nov 21, 2012, at 8:13 AM, matryer [email protected] wrote:
Why not:
Fail(t *testing.T, failureMessage, messageAndArgs ...interface{}) bool {
// just write this out to thet
// the calling functions are responsible for writing the meaningful failureMessage
}—
Reply to this email directly or view it on GitHub.
from testify.
It provides:
- People will be able to directly Fail using
assert.Fail
(this is useful for advanced code or if people want to write their own assertion methods - like AssertContextHasDatabaseSession(t, context)) - We would have ONE place where we can change the output of failures, so if we change it (i.e. decide that we need to prefix the filename so it's double-clickable in Sublime) we can do so easily.
- It is consistent with other assertion/testing packages that offer a general fail method
- If we decide in the future to output a machine readable result (i.e. Something went wrong (if they set a specific flag) then we would only do so in one place.
What is the goal? I don't see how this would result in less code in the methods?
Then again, I just woke up and I'm not quite functional.
On Nov 21, 2012, at 8:13 AM, matryer [email protected] wrote:
Why not:
Fail(t *testing.T, failureMessage, messageAndArgs ...interface{}) bool {
// just write this out to thet
// the calling functions are responsible for writing the meaningful failureMessage
}—
Reply to this email directly or view it on GitHub.—
Reply to this email directly or view it on GitHub.
from testify.
Sounds good to me.
On Nov 21, 2012, at 8:30 AM, matryer [email protected] wrote:
It provides:
- People will be able to directly Fail using
assert.Fail
(this is useful for advanced code or if people want to write their own assertion methods - like AssertContextHasDatabaseSession(t, context))- We would have ONE place where we can change the output of failures, so if we change it (i.e. decide that we need to prefix the filename so it's double-clickable in Sublime) we can do so easily.
- It is consistent with other assertion/testing packages that offer a general fail method
- If we decide in the future to output a machine readable result (i.e. Something went wrong (if they set a specific flag) then we would only do so in one place.
What is the goal? I don't see how this would result in less code in the methods?
Then again, I just woke up and I'm not quite functional.
On Nov 21, 2012, at 8:13 AM, matryer [email protected] wrote:
Why not:
Fail(t *testing.T, failureMessage, messageAndArgs ...interface{}) bool {
// just write this out to thet
// the calling functions are responsible for writing the meaningful failureMessage
}—
Reply to this email directly or view it on GitHub.—
Reply to this email directly or view it on GitHub.—
Reply to this email directly or view it on GitHub.
from testify.
This was done ages ago, it seems.
from testify.
Related Issues (20)
- assert: EqualBody to check if two io.Readers have same data HOT 1
- suite.TestTeardown fail/panic is shadowing the cause panic HOT 2
- proposal: analogue of `InDeltaMapValues` with different deltas HOT 2
- proposal: new assertion`InEpsilonMapValues` HOT 3
- assert package deserve to be STD HOT 1
- Detect and fail on `require.*` methods called from a wrong goroutine HOT 5
- suite: TestSubtestPanic is failing HOT 6
- suite: missing signature check before calling Test* method HOT 3
- Support colorized output, indentation in accordance with subtest depth, and one more assertion HOT 3
- wall clock HOT 10
- assert.EqualExportedValues - panic: reflect.MakeSlice of non-slice type [recovered] HOT 6
- `suite.Require` deadlock HOT 1
- Assert: go test output shows subtests that fail as PASS HOT 3
- `YAMLEq` does not validate YAML HOT 1
- Is it possible to assert for multiple allowed values? HOT 2
- Proposal: guard or support comparing with untyped nil HOT 5
- assert/require.Len doesn't print anything if the slice is too long HOT 7
- Allow user to skip (ignore) specific caller frames in assert.CallerInfo() HOT 1
- Unexpected call when interface is parameter HOT 4
- How can I get coverage in the Suite package HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from testify.