Code Monkey home page Code Monkey logo

Comments (7)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 26, 2024
The patch does not include fixes to the unit tests. As such, this patch fails
testing. Could you please resubmit the patch, but one that fixes the unit tests 
as well?

Original comment by [email protected] on 30 Aug 2008 at 4:29

from shunit2.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 26, 2024
(In reply to comment #1)

> The patch does not include fixes to the unit tests. As such, this patch fails
> testing. Could you please resubmit the patch, but one that fixes the unit 
tests as 
> well?

Sure, but first let me ask you a doubt about the documentation of such those 
failXXX
functions, since it's a bit confusing to me and I'd prefer to be sure before 
sending
another incorrect or incomplete patch to you :-).

From
http://shunit2.googlecode.com/svn/trunk/source/2.1/doc/shunit2.html#shelldoc-sec
tion-failures:

-failSame([message]):Indicate test failure because arguments were not the same. 
The
message is optional.

Is this ok? I'd understand that this function should fail when arguments were 
the
same, and not the other way around

-failNotsame([message],expected,actual): Fails the test if expected and actual 
are
equal to one another. The message is optional.

Is this ok? Because of the same reason explained for failSame, I'd understand 
this
function should fail when arguments were NOT the same, and not the other way 
around.

In other words, I would say the description for failSame and failNotSame is 
swapped,
isn't it?

Thanks in advance.

Mario

Original comment by [email protected] on 1 Sep 2008 at 11:40

from shunit2.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 26, 2024
As I myself am not really sure either, I will look into PyUnit, and perhaps 
some xUnit documentation on what the 
actual functionality should be. You are correct that the documentation does not 
match the functionality, so one 
or the other needs to be fixed.

If you happen across some good documentation for another unit testing framework 
that is clear on this, I'd be 
glad to look at it.

Original comment by [email protected] on 1 Sep 2008 at 10:49

  • Changed state: Accepted

from shunit2.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 26, 2024
Looking at some xUnit documentation on Single Outcome Assertions 
(http://xunitpatterns.com/Assertion%20Method.html#Single%20Outcome%20Assertion) 
I found a section that 
talks about failNotEquals. "The method failNotEquals is a Test Utility Method 
that fails the test and provides a 
diagnostic assertion message."

Basically, shUnit2 is doing the correct thing in that the failNotEquals is not 
an assertion, meaning it is not 
testing that the values are equal or not. It is supposed to provide a nice 
message explaining that the values 
are not equal, but it never actually tests them. They have a code sample in 
Java that clearly demonstrates its 
usage, so I will look at porting that sample to shell and including it in the 
documentation.

Original comment by [email protected] on 1 Sep 2008 at 11:02

from shunit2.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 26, 2024
Hmmm... So after all it seems the current shunit2 is working properly, that is, 
just
always failing regardless of the passed values being equal or not... therefore 
the
only bug in shunit2 would be in the documentation :-)

IMO, this is pretty clear as far as I understand from the following excerpt 
(from
http://xunitpatterns.com/Assertion%20Method.html#Single%20Outcome%20Assertion)

   /**
    * Asserts that two objects are equal. If they are not
    * an AssertionFailedError is thrown with the given message.*/
   static public void assertEquals(String message, Object expected, Object actual) {
      if (expected == null && actual == null)
         return;
      if (expected != null && expected.equals(actual))
         return;
      failNotEquals(message, expected, actual);
   }

It seems the failX functions are no more than private helper functions, but the 
real
test of the values must be performed previously. In fact, in JUnit the 
failNotEquals
function is a static private function indeed: 

http://www.javaresearch.org/source/junit3.8.1/junit/framework/Assert.java.html

So, it seems there's no need of any patch after all, and that I just 
misunderstood
the meaning of the functions, so excuse me for the "noise" :-)... and thanks a 
lot
for your work in shUnit2: I'm using it from some weeks in my day-a-day work and 
it
works like a charm!

Original comment by [email protected] on 2 Sep 2008 at 7:44

from shunit2.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 26, 2024
No worries! And I don't mind the noise as it required me to actually do the 
research to verify why JUnit did what 
it did. I hadn't understood that before either believe it or not.

I'm leaving this bug open until I have fixed the documentation.

Original comment by [email protected] on 7 Oct 2008 at 11:19

from shunit2.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 26, 2024
Fixed in revision# 246.

Original comment by [email protected] on 24 Oct 2008 at 12:59

  • Changed state: Done
  • Added labels: Type-Documentation
  • Removed labels: Type-Defect

from shunit2.

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.