Comments (3)
I use isnt
in TODO tests quite often, when I don't care about what is returned so long as it isn't 'bar'.
TODO: {
local $TODO = 'Question for Answer to the Ultimate Question of Life, The Universe, and Everything not known yet';
isnt( question_for(42), 'How many roads must a man walk down?', 'The secret is out!' );
};
One of the main reasons I like it is the very clear error message:
not ok 1 - The secret is out! # TODO Question for Answer to the Ultimate Question of Life, The Universe, and Everything not known yet
# Failed (TODO) test 'The secret is out!'
# at foo.pl line 6.
# got: 'How many roads must a man walk down?'
# expected: anything else
...
from test2-suite.
How do we currently support something like:
my $id = $obj->next_id;
my $nextid = $obj->next_id;
isnt $nextid, $id, "next_id() returned a new id";
!
only works for defined checks. Maybe what we need is not { ... }
.
is $nextid, not { $id };
from test2-suite.
It simply passes if $left does not match $right in any way.
This is very useful. There are 156 uses of isnt
in my codebase. Here are some examples:
my $custnum_district = get_test_district();
my $custnum_school = get_test_school();
isnt($custnum_district, $custnum_school, 'school and district are different customers');
or
isnt( price_for_flrid( $oldTitle->flrid() ), $newTitle->{price},
'Old price is not equal to the updated payload price before renumber.' );
or
isnt( $list->total_price_local($kwd_ratesheet), $list->total_price_local($usd_ratesheet),
'KWD is not same as explicit USD' );
or
isnt( $portrait->page_width(), $landscape->page_width(), 'page dimensions are different' );
I would be perfectly fine with the removal of the fake isn::t
package and function so that you can no longer write isn't()
calls.
from test2-suite.
Related Issues (20)
- Possible incompatibility with Sub::Name v0.26 HOT 5
- Test2::Tools::Warnings a test case which isn't caught as a warning. HOT 1
- FR: Implement debug flag HOT 3
- Return true from Test2::Manual modules.
- Possible to mock CORE sub? HOT 7
- FR: Provide a way to test arrays in reverse HOT 1
- Test2's is() needs better handling of unicode, and some differences
- Tests are consistently failing on perl 5.8 HOT 6
- Add 'stringify_got' attribute to Test2::Compare::Custom HOT 2
- perltidyrc doesnโt match code style, seems invalid and not be be applied or enforced HOT 3
- Test2::Mock should optionally track HiRes timestamps for calls HOT 1
- Should dies() warn when called in void context? HOT 1
- Add ability to call orig subroutine when we override it HOT 2
- Document how to use `in_set` builder HOT 4
- T() and F() do not handle references properly
- Refcount assertions HOT 2
- async_subtest output incompatible with TAP14 spec HOT 3
- context level is incorrect when mocks are used HOT 3
- Improve documentation for Test2::Tools::Subtest and Test2::AsyncSubtest HOT 1
- Dumper-on-fail for `is`, `isnt`, etc HOT 4
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 test2-suite.