Code Monkey home page Code Monkey logo

Comments (8)

matryer avatar matryer commented on May 23, 2024

see also #1

from testify.

tylerstillwater avatar tylerstillwater commented on May 23, 2024

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.

matryer avatar matryer commented on May 23, 2024

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.

matryer avatar matryer commented on May 23, 2024

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.

tylerstillwater avatar tylerstillwater commented on May 23, 2024

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 the t
// the calling functions are responsible for writing the meaningful failureMessage
}


Reply to this email directly or view it on GitHub.

from testify.

matryer avatar matryer commented on May 23, 2024

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 the t
// 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.

tylerstillwater avatar tylerstillwater commented on May 23, 2024

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 the t
// 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.

tylerstillwater avatar tylerstillwater commented on May 23, 2024

This was done ages ago, it seems.

from testify.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.