{
    "content": [
        {
            "type": "text",
            "text": "# Test::Unit::Assertion::CodeRef (perldoc)\n\n## NAME\n\nTest::Unit::Assertion::CodeRef - A delayed evaluation assertion using a Coderef\n\n## SYNOPSIS\n\nrequire Test::Unit::Assertion::CodeRef;\nmy $asserteq =\nTest::Unit::Assertion::CodeRef->new(sub {\n$[0] eq $[1]\nor Test::Unit::Failure->throw(-text =>\n\"Expected '$[0]', got '$[1]'\\n\");\n});\n$asserteq->doassertion('foo', 'bar');\nAlthough this is how you'd use Test::Unit::Assertion::CodeRef directly, it is more usually used\nindirectly via Test::Unit::Test::assert, which instantiates a Test::Unit::Assertion::CodeRef\nwhen passed a Coderef as its first argument.\n\n## DESCRIPTION\n\nThis class is used by the framework to allow us to do assertions in a 'functional' manner. It is\ntypically used generated automagically in code like:\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **IMPLEMENTS**\n- **DESCRIPTION**\n- **AUTHOR**\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Test::Unit::Assertion::CodeRef",
        "section": "",
        "mode": "perldoc",
        "summary": "Test::Unit::Assertion::CodeRef - A delayed evaluation assertion using a Coderef",
        "synopsis": "require Test::Unit::Assertion::CodeRef;\nmy $asserteq =\nTest::Unit::Assertion::CodeRef->new(sub {\n$[0] eq $[1]\nor Test::Unit::Failure->throw(-text =>\n\"Expected '$[0]', got '$[1]'\\n\");\n});\n$asserteq->doassertion('foo', 'bar');\nAlthough this is how you'd use Test::Unit::Assertion::CodeRef directly, it is more usually used\nindirectly via Test::Unit::Test::assert, which instantiates a Test::Unit::Assertion::CodeRef\nwhen passed a Coderef as its first argument.",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 15,
                "subsections": []
            },
            {
                "name": "IMPLEMENTS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 19,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 4,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Test::Unit::Assertion::CodeRef - A delayed evaluation assertion using a Coderef\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "require Test::Unit::Assertion::CodeRef;\n\nmy $asserteq =\nTest::Unit::Assertion::CodeRef->new(sub {\n$[0] eq $[1]\nor Test::Unit::Failure->throw(-text =>\n\"Expected '$[0]', got '$[1]'\\n\");\n});\n\n$asserteq->doassertion('foo', 'bar');\n\nAlthough this is how you'd use Test::Unit::Assertion::CodeRef directly, it is more usually used\nindirectly via Test::Unit::Test::assert, which instantiates a Test::Unit::Assertion::CodeRef\nwhen passed a Coderef as its first argument.\n",
                "subsections": []
            },
            "IMPLEMENTS": {
                "content": "Test::Unit::Assertion::CodeRef implements the Test::Unit::Assertion interface, which means it\ncan be plugged into the Test::Unit::TestCase and friends' \"assert\" method with no ill effects.\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This class is used by the framework to allow us to do assertions in a 'functional' manner. It is\ntypically used generated automagically in code like:\n\n$self->assert(sub {\n$[0] == $[1]\nor $self->fail(\"Expected $[0], got $[1]\");\n}, 1, 2);\n\n(Note that if Damian Conway's Perl6 RFC for currying ever comes to pass then we'll be able to do\nthis as:\n\n$self->assert(^1 == ^2 || $self->fail(\"Expected ^1, got ^2\"), 1, 2)\n\nwhich will be nice...)\n\nIf you have a working B::Deparse installed with your perl installation then, if an assertion\nfails, you'll see a listing of the decompiled coderef (which will be sadly devoid of comments,\nbut should still be useful)\n",
                "subsections": []
            },
            "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::TestCase\n\n*   Test::Unit::Assertion\n",
                "subsections": []
            }
        }
    }
}