{
    "mode": "perldoc",
    "parameter": "Test::Unit::Assertion",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Test%3A%3AUnit%3A%3AAssertion/json",
    "generated": "2026-10-09T10:23:18Z",
    "sections": {
        "NAME": {
            "content": "Any assertion class that expects to plug into Test::Unit::Assert needs to implement this\ninterface.\n",
            "subsections": [
                {
                    "name": "Required methods",
                    "content": "new Creates a new assertion object. Takes whatever arguments you desire. Isn't strictly\nnecessary for the framework to work with this class but is generally considered a good idea.\n\ndoassertion\nThis is the important one. If Test::Unit::Assert::assert is called with an object as its\nfirst argument then it does:\n\n$[0]->doassertion(@[1 .. $#]) ||\n$self->fail(\"Assertion failed\");\n\nThis means that \"doassertion\" should return true if the assertion succeeds and false if it\ndoesn't. Or, you can fail by throwing a Test::Unit::Failure object, which will get caught\nfurther up the stack and used to produce a sensible error report. Generally it's good\npractice for doassertion to die with a meaningful error on assertion failure rather than\njust returning false.\n"
                }
            ]
        },
        "AUTHOR": {
            "content": "Copyright (c) 2001 Piers Cawley <pdcawley@iterative-software.com>.\n\nAll rights reserved. This program is free software; you can redistribute it and/or modify it\nunder the same terms as Perl itself.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "*   Test::Unit::Assert\n\n*   Test::Unit::CodeRef\n\n*   Test::Unit::Regexp\n",
            "subsections": []
        }
    },
    "summary": "Test::Unit::Assertion - The abstract base class for assertions",
    "flags": [],
    "examples": [],
    "see_also": []
}