{"id":17252193,"url":"https://github.com/eagletmt/tinytest","last_synced_at":"2026-01-06T21:08:07.312Z","repository":{"id":7749874,"uuid":"9117276","full_name":"eagletmt/tinytest","owner":"eagletmt","description":null,"archived":false,"fork":false,"pushed_at":"2013-03-30T14:54:59.000Z","size":104,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T09:50:59.460Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"VimL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eagletmt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-03-30T14:49:27.000Z","updated_at":"2014-09-08T23:27:25.000Z","dependencies_parsed_at":"2022-09-18T11:11:08.651Z","dependency_job_id":null,"html_url":"https://github.com/eagletmt/tinytest","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eagletmt%2Ftinytest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eagletmt%2Ftinytest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eagletmt%2Ftinytest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eagletmt%2Ftinytest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eagletmt","download_url":"https://codeload.github.com/eagletmt/tinytest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245606603,"owners_count":20643212,"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":[],"created_at":"2024-10-15T06:53:17.130Z","updated_at":"2026-01-06T21:08:07.284Z","avatar_url":"https://github.com/eagletmt.png","language":"VimL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tinytest\n\n## Usage\n\n```vim\nlet s:unit = tinytest#new()\n\nfunction! s:unit.setup()\n  let self.value = 1\nendfunction\n\nfunction! s:unit.teardown()\n  unlet self.value\nendfunction\n\nfunction! s:unit.test_plus()\n  call self.assert.equal(3, self.value + 2)\n  call self.assert.equal([1, 2, 3], [self.value] + [2, 3])\nendfunction\n\ncall s:unit.run()\n```\n\n1. Create a tinytest object by `tinytest#new()`\n2. Write test cases as a dictionary function whose name has `test_` prefix\n  - Special methods `setup` and `teardown` are supported.\n3. Write assertions by asserter object\n4. Invoke `run` method and the result is reported by reporter object\n\n## Mechanism\n\n### asserter\nAsserter's methods should throw an exception prefixed with `tinytest:` if the assertion fails.\n\nThe default asserter is located at `autoload/tinytest/asserter/default.vim`.\n\n### reporter\nA reporter object is hold by each test unit internally.\nYou cannot touch reporter object from test cases and asserters.\nA reporter must have these methods:\n\n- `on_start` will called when a test unit starts.\n- `on_case_start` will called each time a test case starts.\n- `on_case_success` will called each time a test case succeeds, i.e., no exceptions are thrown.\n- `on_case_failure` will called each time a test case fails, i.e., an exception prefixed with `tinytest:` is thrown.\n- `on_case_exception` will called each time a test case throws other exception.\n- `on_finish` will called when a test unit finishes.\n\nNote that only one of `on_case_success`, `on_case_failure` and `on_case_exception` is called for each test case.\n\nThe default reporter echoes the result.\n\n`cli` reporter writes the result to `stdout.log` file.\nIt is supposed to be used when you run tests from command line.\n\n## Design policy\n\n### Don't parse\nTest cases should be written as an ordinal Vim script.\nParsing string arguments are evil.\n\n### Easy to change reporting format\n- When you execute tests in Vim, `:echo` or `:call setline()` to a special buffer would be suitable (default reporter).\n- When you execute tests from command line, reporting to a file and changing exit status according to the result would be useful (cli reporter).\n\n### Tiny\nNo very useful but complex functionalities.\n\n## License\n[MIT license](http://www.opensource.org/licenses/MIT)\n\nCopyright (c) 2013, eagletmt\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feagletmt%2Ftinytest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feagletmt%2Ftinytest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feagletmt%2Ftinytest/lists"}