GithubHelp home page GithubHelp logo

jacsoyyo / assert-refute-perl Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dallaylaen/assert-refute-perl

0.0 2.0 0.0 309 KB

Test script-alike code snippets usable in production code

Perl 99.28% Shell 0.72%

assert-refute-perl's Introduction

NAME

Assert::Refute - unified testing, assertion, and design-by-contract tool

SYNOPSIS

This module allows to create snippets of code called contracts that behave just as a unit test would, but do not require the enclosing code to be a unit test:

use Assert::Refute qw(:all) { on_fail => 'croak' };

# deep in the production code
my $data = Some::Module->bloated_untestable_sub;
try_refute {
    like $data->{foo}, qr/f?o?r?m?a?t/;
    is $data->{bar}, 42;
    can_ok $data->{baz}, qw(do_this do_that frobnicate);
}; # this dies if conditions are not met

This can be transferred verbatim into a unit-test, allowing to find the sweet spot on the speed <---> accuracy scale.

WHY REFUTE

Communicating a passing test/check requires 1 bit of information: exerything is fine. When something's not right, however, the more details, the better.

Thus refute, an inverted assertion, is the central building block of this module.

INSTALLATION

To install this module, run the following commands:

perl Makefile.PL
make
make test
make install

CONTENT OF THIS PACKAGE

  • Changes - change log
  • examples - really simple scripts demonstrating usage
  • lib - modules
  • elib - experimental modules that don't get released to CPAN
  • Makefile.PL
  • README.md/README - this file
  • t - tests required for installation
  • TODO - approximate roadmap
  • et - tests required for development only
  • .githooks - author's default pre-commit hooks

The modules include:

  • Assert::Refute - the main frontend with a lot of exports. It also handles runtime assertions.

  • Assert::Refute::Build - helper module to build more test conditions (those would also work fine under Test::More).

  • Assert::Refute::Contract - implementations of contract specification.

  • Assert::Refute::Report - implementation of contract execution report. This is where refute is implemented.

  • Assert::Refute::Driver::* - assertion/testing protocol implementations (currently only Test::More compatibility layer there).

  • Assert::Refute::T::* - extra conditions and checks.

SUPPORT AND DOCUMENTATION

See https://metacpan.org/pod/Assert::Refute

This package is under heavy development. Bugs may be lurking!

Please report bugs and ask for features here:

https://github.com/dallaylaen/assert-refute-perl/issues

LICENSE AND COPYRIGHT

Copyright (C) 2017-2018 Konstantin S. Uvarin [email protected]

This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at:

Lhttp://www.perlfoundation.org/artistic_license_2_0

Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license.

If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license.

This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder.

This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed.

Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

assert-refute-perl's People

Contributors

dallaylaen avatar jacobo-cloudbeds avatar

Watchers

Jacobo Chamorro avatar James Cloos avatar

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.