{"id":13602831,"url":"https://github.com/felipec/sharness","last_synced_at":"2025-12-29T23:05:17.736Z","repository":{"id":1431240,"uuid":"1615916","full_name":"felipec/sharness","owner":"felipec","description":"Shell library to test your tools like Git does","archived":false,"fork":false,"pushed_at":"2024-06-17T17:18:44.000Z","size":428,"stargazers_count":374,"open_issues_count":1,"forks_count":58,"subscribers_count":20,"default_branch":"master","last_synced_at":"2024-08-02T18:43:18.800Z","etag":null,"topics":["bash","ci","shell","test-anything-protocol","test-harness","testing"],"latest_commit_sha":null,"homepage":"http://felipec.github.io/sharness/","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"processone/ejabberd-contrib","license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/felipec.png","metadata":{"files":{"readme":"README.git","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2011-04-14T19:46:25.000Z","updated_at":"2024-07-30T21:13:55.000Z","dependencies_parsed_at":"2023-01-11T16:04:00.649Z","dependency_job_id":"e2d6bd21-8602-458c-bf0d-4b80496407e5","html_url":"https://github.com/felipec/sharness","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felipec%2Fsharness","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felipec%2Fsharness/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felipec%2Fsharness/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felipec%2Fsharness/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/felipec","download_url":"https://codeload.github.com/felipec/sharness/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223470281,"owners_count":17150526,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","ci","shell","test-anything-protocol","test-harness","testing"],"created_at":"2024-08-01T18:01:39.284Z","updated_at":"2024-11-07T06:30:27.606Z","avatar_url":"https://github.com/felipec.png","language":"Shell","funding_links":[],"categories":["Shell","bash"],"sub_categories":[],"readme":"Core GIT Tests\n==============\n\nThis directory holds many test scripts for core GIT tools.  The\nfirst part of this short document describes how to run the tests\nand read their output.\n\nWhen fixing the tools or adding enhancements, you are strongly\nencouraged to add tests in this directory to cover what you are\ntrying to fix or enhance.  The later part of this short document\ndescribes how your test scripts should be organized.\n\n\nRunning Tests\n-------------\n\nThe easiest way to run tests is to say \"make\".  This runs all\nthe tests.\n\n    *** t0000-basic.sh ***\n    ok 1 - .git/objects should be empty after git init in an empty repo.\n    ok 2 - .git/objects should have 3 subdirectories.\n    ok 3 - success is reported like this\n    ...\n    ok 43 - very long name in the index handled sanely\n    # fixed 1 known breakage(s)\n    # still have 1 known breakage(s)\n    # passed all remaining 42 test(s)\n    1..43\n    *** t0001-init.sh ***\n    ok 1 - plain\n    ok 2 - plain with GIT_WORK_TREE\n    ok 3 - plain bare\n\nSince the tests all output TAP (see http://testanything.org) they can\nbe run with any TAP harness. Here's an example of parallel testing\npowered by a recent version of prove(1):\n\n    $ prove --timer --jobs 15 ./t[0-9]*.sh\n    [19:17:33] ./t0005-signals.sh ................................... ok       36 ms\n    [19:17:33] ./t0022-crlf-rename.sh ............................... ok       69 ms\n    [19:17:33] ./t0024-crlf-archive.sh .............................. ok      154 ms\n    [19:17:33] ./t0004-unwritable.sh ................................ ok      289 ms\n    [19:17:33] ./t0002-gitfile.sh ................................... ok      480 ms\n    ===(     102;0  25/?  6/?  5/?  16/?  1/?  4/?  2/?  1/?  3/?  1... )===\n\nprove and other harnesses come with a lot of useful options. The\n--state option in particular is very useful:\n\n    # Repeat until no more failures\n    $ prove -j 15 --state=failed,save ./t[0-9]*.sh\n\nYou can give DEFAULT_TEST_TARGET=prove on the make command (or define it\nin config.mak) to cause \"make test\" to run tests under prove.\nGIT_PROVE_OPTS can be used to pass additional options, e.g.\n\n    $ make DEFAULT_TEST_TARGET=prove GIT_PROVE_OPTS='--timer --jobs 16' test\n\nYou can also run each test individually from command line, like this:\n\n    $ sh ./t3010-ls-files-killed-modified.sh\n    ok 1 - git update-index --add to add various paths.\n    ok 2 - git ls-files -k to show killed files.\n    ok 3 - validate git ls-files -k output.\n    ok 4 - git ls-files -m to show modified files.\n    ok 5 - validate git ls-files -m output.\n    # passed all 5 test(s)\n    1..5\n\nYou can pass --verbose (or -v), --debug (or -d), and --immediate\n(or -i) command line argument to the test, or by setting GIT_TEST_OPTS\nappropriately before running \"make\".\n\n--verbose::\n\tThis makes the test more verbose.  Specifically, the\n\tcommand being run and their output if any are also\n\toutput.\n\n--debug::\n\tThis may help the person who is developing a new test.\n\tIt causes the command defined with test_debug to run.\n\tThe \"trash\" directory (used to store all temporary data\n\tduring testing) is not deleted even if there are no\n\tfailed tests so that you can inspect its contents after\n\tthe test finished.\n\n--immediate::\n\tThis causes the test to immediately exit upon the first\n\tfailed test.\n\n--long-tests::\n\tThis causes additional long-running tests to be run (where\n\tavailable), for more exhaustive testing.\n\n--valgrind::\n\tExecute all Git binaries with valgrind and exit with status\n\t126 on errors (just like regular tests, this will only stop\n\tthe test script when running under -i).  Valgrind errors\n\tgo to stderr, so you might want to pass the -v option, too.\n\n\tSince it makes no sense to run the tests with --valgrind and\n\tnot see any output, this option implies --verbose.  For\n\tconvenience, it also implies --tee.\n\n\tNote that valgrind is run with the option --leak-check=no,\n\tas the git process is short-lived and some errors are not\n\tinteresting. In order to run a single command under the same\n\tconditions manually, you should set GIT_VALGRIND to point to\n\tthe 't/valgrind/' directory and use the commands under\n\t't/valgrind/bin/'.\n\n--tee::\n\tIn addition to printing the test output to the terminal,\n\twrite it to files named 't/test-results/$TEST_NAME.out'.\n\tAs the names depend on the tests' file names, it is safe to\n\trun the tests with this option in parallel.\n\n--verbose-log::\n\tWrite verbose output to the same logfile as `--tee`, but do\n\t_not_ write it to stdout. Unlike `--tee --verbose`, this option\n\tis safe to use when stdout is being consumed by a TAP parser\n\tlike `prove`. Implies `--tee` and `--verbose`.\n\n--with-dashes::\n\tBy default tests are run without dashed forms of\n\tcommands (like git-commit) in the PATH (it only uses\n\twrappers from ../bin-wrappers).  Use this option to include\n\tthe build directory (..) in the PATH, which contains all\n\tthe dashed forms of commands.  This option is currently\n\timplied by other options like --valgrind and\n\tGIT_TEST_INSTALLED.\n\n--root=\u003cdirectory\u003e::\n\tCreate \"trash\" directories used to store all temporary data during\n\ttesting under \u003cdirectory\u003e, instead of the t/ directory.\n\tUsing this option with a RAM-based filesystem (such as tmpfs)\n\tcan massively speed up the test suite.\n\n--chain-lint::\n--no-chain-lint::\n\tIf --chain-lint is enabled, the test harness will check each\n\ttest to make sure that it properly \"\u0026\u0026-chains\" all commands (so\n\tthat a failure in the middle does not go unnoticed by the final\n\texit code of the test). This check is performed in addition to\n\trunning the tests themselves.\n\nYou can also set the GIT_TEST_INSTALLED environment variable to\nthe bindir of an existing git installation to test that installation.\nYou still need to have built this git sandbox, from which various\ntest-* support programs, templates, and perl libraries are used.\nIf your installed git is incomplete, it will silently test parts of\nyour built version instead.\n\nWhen using GIT_TEST_INSTALLED, you can also set GIT_TEST_EXEC_PATH to\noverride the location of the dashed-form subcommands (what\nGIT_EXEC_PATH would be used for during normal operation).\nGIT_TEST_EXEC_PATH defaults to `$GIT_TEST_INSTALLED/git --exec-path`.\n\n\nSkipping Tests\n--------------\n\nIn some environments, certain tests have no way of succeeding\ndue to platform limitation, such as lack of 'unzip' program, or\nfilesystem that do not allow arbitrary sequence of non-NUL bytes\nas pathnames.\n\nYou should be able to say something like\n\n    $ GIT_SKIP_TESTS=t9200.8 sh ./t9200-git-cvsexport-commit.sh\n\nand even:\n\n    $ GIT_SKIP_TESTS='t[0-4]??? t91?? t9200.8' make\n\nto omit such tests.  The value of the environment variable is a\nSP separated list of patterns that tells which tests to skip,\nand either can match the \"t[0-9]{4}\" part to skip the whole\ntest, or t[0-9]{4} followed by \".$number\" to say which\nparticular test to skip.\n\nNote that some tests in the existing test suite rely on previous\ntest item, so you cannot arbitrarily disable one and expect the\nremainder of test to check what the test originally was intended\nto check.\n\n\nNaming Tests\n------------\n\nThe test files are named as:\n\n\ttNNNN-commandname-details.sh\n\nwhere N is a decimal digit.\n\nFirst digit tells the family:\n\n\t0 - the absolute basics and global stuff\n\t1 - the basic commands concerning database\n\t2 - the basic commands concerning the working tree\n\t3 - the other basic commands (e.g. ls-files)\n\t4 - the diff commands\n\t5 - the pull and exporting commands\n\t6 - the revision tree commands (even e.g. merge-base)\n\t7 - the porcelainish commands concerning the working tree\n\t8 - the porcelainish commands concerning forensics\n\t9 - the git tools\n\nSecond digit tells the particular command we are testing.\n\nThird digit (optionally) tells the particular switch or group of switches\nwe are testing.\n\nIf you create files under t/ directory (i.e. here) that is not\nthe top-level test script, never name the file to match the above\npattern.  The Makefile here considers all such files as the\ntop-level test script and tries to run all of them.  Care is\nespecially needed if you are creating a common test library\nfile, similar to test-lib.sh, because such a library file may\nnot be suitable for standalone execution.\n\n\nWriting Tests\n-------------\n\nThe test script is written as a shell script.  It should start\nwith the standard \"#!/bin/sh\" with copyright notices, and an\nassignment to variable 'test_description', like this:\n\n\t#!/bin/sh\n\t#\n\t# Copyright (c) 2005 Junio C Hamano\n\t#\n\n\ttest_description='xxx test (option --frotz)\n\n\tThis test registers the following structure in the cache\n\tand tries to run git-ls-files with option --frotz.'\n\n\nSource 'test-lib.sh'\n--------------------\n\nAfter assigning test_description, the test script should source\ntest-lib.sh like this:\n\n\t. ./test-lib.sh\n\nThis test harness library does the following things:\n\n - If the script is invoked with command line argument --help\n   (or -h), it shows the test_description and exits.\n\n - Creates an empty test directory with an empty .git/objects database\n   and chdir(2) into it.  This directory is 't/trash\n   directory.$test_name_without_dotsh', with t/ subject to change by\n   the --root option documented above.\n\n - Defines standard test helper functions for your scripts to\n   use.  These functions are designed to make all scripts behave\n   consistently when command line arguments --verbose (or -v),\n   --debug (or -d), and --immediate (or -i) is given.\n\nDo's, don'ts \u0026 things to keep in mind\n-------------------------------------\n\nHere are a few examples of things you probably should and shouldn't do\nwhen writing tests.\n\nDo:\n\n - Put all code inside test_expect_success and other assertions.\n\n   Even code that isn't a test per se, but merely some setup code\n   should be inside a test assertion.\n\n - Chain your test assertions\n\n   Write test code like this:\n\n\tgit merge foo \u0026\u0026\n\tgit push bar \u0026\u0026\n\ttest ...\n\n   Instead of:\n\n\tgit merge hla\n\tgit push gh\n\ttest ...\n\n   That way all of the commands in your tests will succeed or fail. If\n   you must ignore the return value of something, consider using a\n   helper function (e.g. use sane_unset instead of unset, in order\n   to avoid unportable return value for unsetting a variable that was\n   already unset), or prepending the command with test_might_fail or\n   test_must_fail.\n\n - Check the test coverage for your tests. See the \"Test coverage\"\n   below.\n\n   Don't blindly follow test coverage metrics; if a new function you added\n   doesn't have any coverage, then you're probably doing something wrong,\n   but having 100% coverage doesn't necessarily mean that you tested\n   everything.\n\n   Tests that are likely to smoke out future regressions are better\n   than tests that just inflate the coverage metrics.\n\n - When a test checks for an absolute path that a git command generated,\n   construct the expected value using $(pwd) rather than $PWD,\n   $TEST_DIRECTORY, or $TRASH_DIRECTORY. It makes a difference on\n   Windows, where the shell (MSYS bash) mangles absolute path names.\n   For details, see the commit message of 4114156ae9.\n\nDon't:\n\n - exit() within a \u003cscript\u003e part.\n\n   The harness will catch this as a programming error of the test.\n   Use test_done instead if you need to stop the tests early (see\n   \"Skipping tests\" below).\n\n - use '! git cmd' when you want to make sure the git command exits\n   with failure in a controlled way by calling \"die()\".  Instead,\n   use 'test_must_fail git cmd'.  This will signal a failure if git\n   dies in an unexpected way (e.g. segfault).\n\n - use perl without spelling it as \"$PERL_PATH\". This is to help our\n   friends on Windows where the platform Perl often adds CR before\n   the end of line, and they bundle Git with a version of Perl that\n   does not do so, whose path is specified with $PERL_PATH.\n\n - use sh without spelling it as \"$SHELL_PATH\", when the script can\n   be misinterpreted by broken platform shell (e.g. Solaris).\n\n - chdir around in tests.  It is not sufficient to chdir to\n   somewhere and then chdir back to the original location later in\n   the test, as any intermediate step can fail and abort the test,\n   causing the next test to start in an unexpected directory.  Do so\n   inside a subshell if necessary.\n\n - Break the TAP output\n\n   The raw output from your test may be interpreted by a TAP harness. TAP\n   harnesses will ignore everything they don't know about, but don't step\n   on their toes in these areas:\n\n   - Don't print lines like \"$x..$y\" where $x and $y are integers.\n\n   - Don't print lines that begin with \"ok\" or \"not ok\".\n\n   TAP harnesses expect a line that begins with either \"ok\" and \"not\n   ok\" to signal a test passed or failed (and our harness already\n   produces such lines), so your script shouldn't emit such lines to\n   their output.\n\n   You can glean some further possible issues from the TAP grammar\n   (see http://search.cpan.org/perldoc?TAP::Parser::Grammar#TAP_Grammar)\n   but the best indication is to just run the tests with prove(1),\n   it'll complain if anything is amiss.\n\nKeep in mind:\n\n - Inside \u003cscript\u003e part, the standard output and standard error\n   streams are discarded, and the test harness only reports \"ok\" or\n   \"not ok\" to the end user running the tests. Under --verbose, they\n   are shown to help debugging the tests.\n\n\nSkipping tests\n--------------\n\nIf you need to skip tests you should do so by using the three-arg form\nof the test_* functions (see the \"Test harness library\" section\nbelow), e.g.:\n\n    test_expect_success PERL 'I need Perl' '\n        \"$PERL_PATH\" -e \"hlagh() if unf_unf()\"\n    '\n\nThe advantage of skipping tests like this is that platforms that don't\nhave the PERL and other optional dependencies get an indication of how\nmany tests they're missing.\n\nIf the test code is too hairy for that (i.e. does a lot of setup work\noutside test assertions) you can also skip all remaining tests by\nsetting skip_all and immediately call test_done:\n\n\tif ! test_have_prereq PERL\n\tthen\n\t    skip_all='skipping perl interface tests, perl not available'\n\t    test_done\n\tfi\n\nThe string you give to skip_all will be used as an explanation for why\nthe test was skipped.\n\nEnd with test_done\n------------------\n\nYour script will be a sequence of tests, using helper functions\nfrom the test harness library.  At the end of the script, call\n'test_done'.\n\n\nTest harness library\n--------------------\n\nThere are a handful helper functions defined in the test harness\nlibrary for your script to use.\n\n - test_expect_success [\u003cprereq\u003e] \u003cmessage\u003e \u003cscript\u003e\n\n   Usually takes two strings as parameters, and evaluates the\n   \u003cscript\u003e.  If it yields success, test is considered\n   successful.  \u003cmessage\u003e should state what it is testing.\n\n   Example:\n\n\ttest_expect_success \\\n\t    'git-write-tree should be able to write an empty tree.' \\\n\t    'tree=$(git-write-tree)'\n\n   If you supply three parameters the first will be taken to be a\n   prerequisite; see the test_set_prereq and test_have_prereq\n   documentation below:\n\n\ttest_expect_success TTY 'git --paginate rev-list uses a pager' \\\n\t    ' ... '\n\n   You can also supply a comma-separated list of prerequisites, in the\n   rare case where your test depends on more than one:\n\n\ttest_expect_success PERL,PYTHON 'yo dawg' \\\n\t    ' test $(perl -E 'print eval \"1 +\" . qx[python -c \"print 2\"]') == \"4\" '\n\n - test_expect_failure [\u003cprereq\u003e] \u003cmessage\u003e \u003cscript\u003e\n\n   This is NOT the opposite of test_expect_success, but is used\n   to mark a test that demonstrates a known breakage.  Unlike\n   the usual test_expect_success tests, which say \"ok\" on\n   success and \"FAIL\" on failure, this will say \"FIXED\" on\n   success and \"still broken\" on failure.  Failures from these\n   tests won't cause -i (immediate) to stop.\n\n   Like test_expect_success this function can optionally use a three\n   argument invocation with a prerequisite as the first argument.\n\n - test_debug \u003cscript\u003e\n\n   This takes a single argument, \u003cscript\u003e, and evaluates it only\n   when the test script is started with --debug command line\n   argument.  This is primarily meant for use during the\n   development of a new test script.\n\n - test_done\n\n   Your test script must have test_done at the end.  Its purpose\n   is to summarize successes and failures in the test script and\n   exit with an appropriate error code.\n\n - test_tick\n\n   Make commit and tag names consistent by setting the author and\n   committer times to defined state.  Subsequent calls will\n   advance the times by a fixed amount.\n\n - test_commit \u003cmessage\u003e [\u003cfilename\u003e [\u003ccontents\u003e]]\n\n   Creates a commit with the given message, committing the given\n   file with the given contents (default for both is to reuse the\n   message string), and adds a tag (again reusing the message\n   string as name).  Calls test_tick to make the SHA-1s\n   reproducible.\n\n - test_merge \u003cmessage\u003e \u003ccommit-or-tag\u003e\n\n   Merges the given rev using the given message.  Like test_commit,\n   creates a tag and calls test_tick before committing.\n\n - test_set_prereq \u003cprereq\u003e\n\n   Set a test prerequisite to be used later with test_have_prereq. The\n   test-lib will set some prerequisites for you, see the\n   \"Prerequisites\" section below for a full list of these.\n\n   Others you can set yourself and use later with either\n   test_have_prereq directly, or the three argument invocation of\n   test_expect_success and test_expect_failure.\n\n - test_have_prereq \u003cprereq\u003e\n\n   Check if we have a prerequisite previously set with\n   test_set_prereq. The most common use of this directly is to skip\n   all the tests if we don't have some essential prerequisite:\n\n\tif ! test_have_prereq PERL\n\tthen\n\t    skip_all='skipping perl interface tests, perl not available'\n\t    test_done\n\tfi\n\n - test_external [\u003cprereq\u003e] \u003cmessage\u003e \u003cexternal\u003e \u003cscript\u003e\n\n   Execute a \u003cscript\u003e with an \u003cexternal\u003e interpreter (like perl). This\n   was added for tests like t9700-perl-git.sh which do most of their\n   work in an external test script.\n\n\ttest_external \\\n\t    'GitwebCache::*FileCache*' \\\n\t    \"$PERL_PATH\" \"$TEST_DIRECTORY\"/t9503/test_cache_interface.pl\n\n   If the test is outputting its own TAP you should set the\n   test_external_has_tap variable somewhere before calling the first\n   test_external* function. See t9700-perl-git.sh for an example.\n\n\t# The external test will outputs its own plan\n\ttest_external_has_tap=1\n\n - test_external_without_stderr [\u003cprereq\u003e] \u003cmessage\u003e \u003cexternal\u003e \u003cscript\u003e\n\n   Like test_external but fail if there's any output on stderr,\n   instead of checking the exit code.\n\n\ttest_external_without_stderr \\\n\t    'Perl API' \\\n\t    \"$PERL_PATH\" \"$TEST_DIRECTORY\"/t9700/test.pl\n\n - test_expect_code \u003cexit-code\u003e \u003ccommand\u003e\n\n   Run a command and ensure that it exits with the given exit code.\n   For example:\n\n\ttest_expect_success 'Merge with d/f conflicts' '\n\t\ttest_expect_code 1 git merge \"merge msg\" B master\n\t'\n\n - test_must_fail \u003cgit-command\u003e\n\n   Run a git command and ensure it fails in a controlled way.  Use\n   this instead of \"! \u003cgit-command\u003e\".  When git-command dies due to a\n   segfault, test_must_fail diagnoses it as an error; \"! \u003cgit-command\u003e\"\n   treats it as just another expected failure, which would let such a\n   bug go unnoticed.\n\n - test_might_fail \u003cgit-command\u003e\n\n   Similar to test_must_fail, but tolerate success, too.  Use this\n   instead of \"\u003cgit-command\u003e || :\" to catch failures due to segv.\n\n - test_cmp \u003cexpected\u003e \u003cactual\u003e\n\n   Check whether the content of the \u003cactual\u003e file matches the\n   \u003cexpected\u003e file.  This behaves like \"cmp\" but produces more\n   helpful output when the test is run with \"-v\" option.\n\n - test_line_count (= | -lt | -ge | ...) \u003clength\u003e \u003cfile\u003e\n\n   Check whether a file has the length it is expected to.\n\n - test_path_is_file \u003cpath\u003e [\u003cdiagnosis\u003e]\n   test_path_is_dir \u003cpath\u003e [\u003cdiagnosis\u003e]\n   test_path_is_missing \u003cpath\u003e [\u003cdiagnosis\u003e]\n\n   Check if the named path is a file, if the named path is a\n   directory, or if the named path does not exist, respectively,\n   and fail otherwise, showing the \u003cdiagnosis\u003e text.\n\n - test_when_finished \u003cscript\u003e\n\n   Prepend \u003cscript\u003e to a list of commands to run to clean up\n   at the end of the current test.  If some clean-up command\n   fails, the test will not pass.\n\n   Example:\n\n\ttest_expect_success 'branch pointing to non-commit' '\n\t\tgit rev-parse HEAD^{tree} \u003e.git/refs/heads/invalid \u0026\u0026\n\t\ttest_when_finished \"git update-ref -d refs/heads/invalid\" \u0026\u0026\n\t\t...\n\t'\n\n - test_pause\n\n\tThis command is useful for writing and debugging tests and must be\n\tremoved before submitting. It halts the execution of the test and\n\tspawns a shell in the trash directory. Exit the shell to continue\n\tthe test. Example:\n\n\ttest_expect_success 'test' '\n\t\tgit do-something \u003eactual \u0026\u0026\n\t\ttest_pause \u0026\u0026\n\t\ttest_cmp expected actual\n\t'\n\nPrerequisites\n-------------\n\nThese are the prerequisites that the test library predefines with\ntest_have_prereq.\n\nSee the prereq argument to the test_* functions in the \"Test harness\nlibrary\" section above and the \"test_have_prereq\" function for how to\nuse these, and \"test_set_prereq\" for how to define your own.\n\n - PERL \u0026 PYTHON\n\n   Git wasn't compiled with NO_PERL=YesPlease or\n   NO_PYTHON=YesPlease. Wrap any tests that need Perl or Python in\n   these.\n\n - POSIXPERM\n\n   The filesystem supports POSIX style permission bits.\n\n - BSLASHPSPEC\n\n   Backslashes in pathspec are not directory separators. This is not\n   set on Windows. See 6fd1106a for details.\n\n - EXECKEEPSPID\n\n   The process retains the same pid across exec(2). See fb9a2bea for\n   details.\n\n - SYMLINKS\n\n   The filesystem we're on supports symbolic links. E.g. a FAT\n   filesystem doesn't support these. See 704a3143 for details.\n\n - SANITY\n\n   Test is not run by root user, and an attempt to write to an\n   unwritable file is expected to fail correctly.\n\n - LIBPCRE\n\n   Git was compiled with USE_LIBPCRE=YesPlease. Wrap any tests\n   that use git-grep --perl-regexp or git-grep -P in these.\n\n - CASE_INSENSITIVE_FS\n\n   Test is run on a case insensitive file system.\n\n - UTF8_NFD_TO_NFC\n\n   Test is run on a filesystem which converts decomposed utf-8 (nfd)\n   to precomposed utf-8 (nfc).\n\nTips for Writing Tests\n----------------------\n\nAs with any programming projects, existing programs are the best\nsource of the information.  However, do _not_ emulate\nt0000-basic.sh when writing your tests.  The test is special in\nthat it tries to validate the very core of GIT.  For example, it\nknows that there will be 256 subdirectories under .git/objects/,\nand it knows that the object ID of an empty tree is a certain\n40-byte string.  This is deliberately done so in t0000-basic.sh\nbecause the things the very basic core test tries to achieve is\nto serve as a basis for people who are changing the GIT internal\ndrastically.  For these people, after making certain changes,\nnot seeing failures from the basic test _is_ a failure.  And\nsuch drastic changes to the core GIT that even changes these\notherwise supposedly stable object IDs should be accompanied by\nan update to t0000-basic.sh.\n\nHowever, other tests that simply rely on basic parts of the core\nGIT working properly should not have that level of intimate\nknowledge of the core GIT internals.  If all the test scripts\nhardcoded the object IDs like t0000-basic.sh does, that defeats\nthe purpose of t0000-basic.sh, which is to isolate that level of\nvalidation in one place.  Your test also ends up needing\nupdating when such a change to the internal happens, so do _not_\ndo it and leave the low level of validation to t0000-basic.sh.\n\nTest coverage\n-------------\n\nYou can use the coverage tests to find code paths that are not being\nused or properly exercised yet.\n\nTo do that, run the coverage target at the top-level (not in the t/\ndirectory):\n\n    make coverage\n\nThat'll compile Git with GCC's coverage arguments, and generate a test\nreport with gcov after the tests finish. Running the coverage tests\ncan take a while, since running the tests in parallel is incompatible\nwith GCC's coverage mode.\n\nAfter the tests have run you can generate a list of untested\nfunctions:\n\n    make coverage-untested-functions\n\nYou can also generate a detailed per-file HTML report using the\nDevel::Cover module. To install it do:\n\n   # On Debian or Ubuntu:\n   sudo aptitude install libdevel-cover-perl\n\n   # From the CPAN with cpanminus\n   curl -L http://cpanmin.us | perl - --sudo --self-upgrade\n   cpanm --sudo Devel::Cover\n\nThen, at the top-level:\n\n    make cover_db_html\n\nThat'll generate a detailed cover report in the \"cover_db_html\"\ndirectory, which you can then copy to a webserver, or inspect locally\nin a browser.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelipec%2Fsharness","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffelipec%2Fsharness","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelipec%2Fsharness/lists"}