{
    "content": [
        {
            "type": "text",
            "text": "# Test::Simple (perldoc)\n\n## NAME\n\nTest::Simple - Basic utilities for writing tests.\n\n## SYNOPSIS\n\nuse Test::Simple tests => 1;\nok( $foo eq $bar, 'foo is bar' );\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION** (1 subsections)\n- **EXAMPLE**\n- **CAVEATS**\n- **NOTES**\n- **HISTORY**\n- **SEE ALSO**\n- **AUTHORS**\n- **MAINTAINERS**\n- **COPYRIGHT**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Test::Simple",
        "section": "",
        "mode": "perldoc",
        "summary": "Test::Simple - Basic utilities for writing tests.",
        "synopsis": "use Test::Simple tests => 1;\nok( $foo eq $bar, 'foo is bar' );",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [
            "Here's an example of a simple .t file for the fictional Film module.",
            "use Test::Simple tests => 5;",
            "use Film;  # What you're testing.",
            "my $btaste = Film->new({ Title    => 'Bad Taste',",
            "Director => 'Peter Jackson',",
            "Rating   => 'R',",
            "NumExplodingSheep => 1",
            "});",
            "ok( defined($btaste) && ref $btaste eq 'Film',     'new() works' );",
            "ok( $btaste->Title      eq 'Bad Taste',     'Title() get'    );",
            "ok( $btaste->Director   eq 'Peter Jackson', 'Director() get' );",
            "ok( $btaste->Rating     eq 'R',             'Rating() get'   );",
            "ok( $btaste->NumExplodingSheep == 1,        'NumExplodingSheep() get' );",
            "It will produce output like this:",
            "1..5",
            "ok 1 - new() works",
            "ok 2 - Title() get",
            "ok 3 - Director() get",
            "not ok 4 - Rating() get",
            "#   Failed test 'Rating() get'",
            "#   in t/film.t at line 14.",
            "ok 5 - NumExplodingSheep() get",
            "# Looks like you failed 1 tests of 5",
            "Indicating the Film::Rating() method is broken."
        ],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 1,
                "subsections": [
                    {
                        "name": "If you are unfamiliar with testing read Test::Tutorial first!",
                        "lines": 60
                    }
                ]
            },
            {
                "name": "EXAMPLE",
                "lines": 32,
                "subsections": []
            },
            {
                "name": "CAVEATS",
                "lines": 12,
                "subsections": []
            },
            {
                "name": "NOTES",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "HISTORY",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "AUTHORS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "MAINTAINERS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 7,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Test::Simple - Basic utilities for writing tests.\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use Test::Simple tests => 1;\n\nok( $foo eq $bar, 'foo is bar' );\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "",
                "subsections": [
                    {
                        "name": "If you are unfamiliar with testing read Test::Tutorial first!",
                        "content": "This is an extremely simple, extremely basic module for writing tests suitable for CPAN modules\nand other pursuits. If you wish to do more complicated testing, use the Test::More module (a\ndrop-in replacement for this one).\n\nThe basic unit of Perl testing is the ok. For each thing you want to test your program will\nprint out an \"ok\" or \"not ok\" to indicate pass or fail. You do this with the \"ok()\" function\n(see below).\n\nThe only other constraint is you must pre-declare how many tests you plan to run. This is in\ncase something goes horribly wrong during the test and your test program aborts, or skips a test\nor whatever. You do this like so:\n\nuse Test::Simple tests => 23;\n\nYou must have a plan.\n\nok\nok( $foo eq $bar, $name );\nok( $foo eq $bar );\n\n\"ok()\" is given an expression (in this case \"$foo eq $bar\"). If it's true, the test passed.\nIf it's false, it didn't. That's about it.\n\n\"ok()\" prints out either \"ok\" or \"not ok\" along with a test number (it keeps track of that\nfor you).\n\n# This produces \"ok 1 - Hell not yet frozen over\" (or not ok)\nok( gettemperature($hell) > 0, 'Hell not yet frozen over' );\n\nIf you provide a $name, that will be printed along with the \"ok/not ok\" to make it easier to\nfind your test when if fails (just search for the name). It also makes it easier for the\nnext guy to understand what your test is for. It's highly recommended you use test names.\n\nAll tests are run in scalar context. So this:\n\nok( @stuff, 'I have some stuff' );\n\nwill do what you mean (fail if stuff is empty)\n\nTest::Simple will start by printing number of tests run in the form \"1..M\" (so \"1..5\" means\nyou're going to run 5 tests). This strange format lets Test::Harness know how many tests you\nplan on running in case something goes horribly wrong.\n\nIf all your tests passed, Test::Simple will exit with zero (which is normal). If anything failed\nit will exit with how many failed. If you run less (or more) tests than you planned, the missing\n(or extras) will be considered failures. If no tests were ever run Test::Simple will throw a\nwarning and exit with 255. If the test died, even after having successfully completed all its\ntests, it will still be considered a failure and will exit with 255.\n\nSo the exit codes are...\n\n0                   all tests successful\n255                 test died or all passed but wrong # of tests run\nany other number    how many failed (including missing or extras)\n\nIf you fail more than 254 tests, it will be reported as 254.\n\nThis module is by no means trying to be a complete testing system. It's just to get you started.\nOnce you're off the ground its recommended you look at Test::More.\n"
                    }
                ]
            },
            "EXAMPLE": {
                "content": "Here's an example of a simple .t file for the fictional Film module.\n\nuse Test::Simple tests => 5;\n\nuse Film;  # What you're testing.\n\nmy $btaste = Film->new({ Title    => 'Bad Taste',\nDirector => 'Peter Jackson',\nRating   => 'R',\nNumExplodingSheep => 1\n});\nok( defined($btaste) && ref $btaste eq 'Film',     'new() works' );\n\nok( $btaste->Title      eq 'Bad Taste',     'Title() get'    );\nok( $btaste->Director   eq 'Peter Jackson', 'Director() get' );\nok( $btaste->Rating     eq 'R',             'Rating() get'   );\nok( $btaste->NumExplodingSheep == 1,        'NumExplodingSheep() get' );\n\nIt will produce output like this:\n\n1..5\nok 1 - new() works\nok 2 - Title() get\nok 3 - Director() get\nnot ok 4 - Rating() get\n#   Failed test 'Rating() get'\n#   in t/film.t at line 14.\nok 5 - NumExplodingSheep() get\n# Looks like you failed 1 tests of 5\n\nIndicating the Film::Rating() method is broken.\n",
                "subsections": []
            },
            "CAVEATS": {
                "content": "Test::Simple will only report a maximum of 254 failures in its exit code. If this is a problem,\nyou probably have a huge test script. Split it into multiple files. (Otherwise blame the Unix\nfolks for using an unsigned short integer as the exit status).\n\nBecause VMS's exit codes are much, much different than the rest of the universe, and perl does\nhorrible mangling to them that gets in my way, it works like this on VMS.\n\n0     SS$NORMAL        all tests successful\n4     SS$ABORT         something went wrong\n\nUnfortunately, I can't differentiate any further.\n",
                "subsections": []
            },
            "NOTES": {
                "content": "Test::Simple is explicitly tested all the way back to perl 5.6.0.\n\nTest::Simple is thread-safe in perl 5.8.1 and up.\n",
                "subsections": []
            },
            "HISTORY": {
                "content": "This module was conceived while talking with Tony Bowden in his kitchen one night about the\nproblems I was having writing some really complicated feature into the new Testing module. He\nobserved that the main problem is not dealing with these edge cases but that people hate to\nwrite tests at all. What was needed was a dead simple module that took all the hard work out of\ntesting and was really, really easy to learn. Paul Johnson simultaneously had this idea\n(unfortunately, he wasn't in Tony's kitchen). This is it.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "Test::More\nMore testing functions! Once you outgrow Test::Simple, look at Test::More. Test::Simple is\n100% forward compatible with Test::More (i.e. you can just use Test::More instead of\nTest::Simple in your programs and things will still work).\n\nLook in Test::More's SEE ALSO for more testing modules.\n",
                "subsections": []
            },
            "AUTHORS": {
                "content": "Idea by Tony Bowden and Paul Johnson, code by Michael G Schwern <schwern@pobox.com>, wardrobe by\nCalvin Klein.\n",
                "subsections": []
            },
            "MAINTAINERS": {
                "content": "Chad Granum <exodist@cpan.org>\n",
                "subsections": []
            },
            "COPYRIGHT": {
                "content": "Copyright 2001-2008 by Michael G Schwern <schwern@pobox.com>.\n\nThis program is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself.\n\nSee http://www.perl.com/perl/misc/Artistic.html\n",
                "subsections": []
            }
        }
    }
}