Comments (7)
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.
(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.
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.
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.
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.
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.
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)
- "Ran X tests." message is not accurate if a test exits
- fail fails to fail the test immediately HOT 4
- shunit2 Debian/Ubuntu packages out of date HOT 20
- Use https://bpkg.sh/ as package manager
- Warning "can only `return' from a function or sourced script" when executing in standalone mode (in Bash shell) HOT 1
- Should there be a counter for skipped tests in addition to the number of skipped asserts? HOT 5
- "[[: not found" error when sourcing files
- Test with bash in posix mode
- Next release ? HOT 4
- Mock and expect HOT 3
- Update version distributed through apt HOT 3
- [BASH] _SHUNIT_LINENO_ error if IFS is redefined HOT 4
- How to only execute specified test cases instead of all ? HOT 1
- What scenarios and how to use Error handling?
- Cannot source unit tests from unit tests HOT 1
- 执行单个案例,是否可以打印他的执行过程
- assertNotNull not working with set -e HOT 2
- egrep: warning: egrep is obsolescent; using grep -E HOT 5
- Add snapshot testing support
- want new version HOT 2
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 shunit2.