SHTK_UNITTEST_ADD_FIXTURE(3)
π SHTK_UNITTEST_ADD_FIXTURE(3) π
okay bestie, this is the Library Functions Manual page for SHTK_UNITTEST_ADD_FIXTURE(3), and it's literally about one tiny function that sets up a whole test fixture vibe. it's giving βsmall call, big structureβ β¨
π NAME π
shtk_unittest_add_fixture β defines a test fixture π§
π¦ LIBRARY π¦
you pull it in with:
shtk_import unittest
πΈ SYNOPSIS πΈ
shtk_unittest_add_fixture name
β¨ DESCRIPTION β¨
shtk_unittest_add_fixture registers the fixture given by name. that's the registration step, and it's literally one line π
okay, now the rule that actually matters: after you've made the call to shtk_unittest_add_fixture, you must define a function named <name>_fixture. like, the call happens first, then the function definition. no cap π«Ά
and the vibe check for fixture functions: they must not directly contain any code. not even one tiny line, bestie. All they can do is:
- define other functions, such as
setupandteardown - execute calls to
shtk_unittest_add_test(3)
that's the whole allowed list. periodt π
π EXAMPLES π
the following piece of code illustrates the components of a test fixture β keep the shape exactly like this:
shtk_unittest_add_fixture my_collection
my_collection_fixture() {
setup() {
... optional function providing per-test setup code ...
}
teardown() {
... optional function providing per-test teardown code ...
}
shtk_unittest_add_test first_scenario
first_scenario_test() {
... test code for the first test case ...
}
shtk_unittest_add_test second_scenario
second_scenario_test() {
... test code for the second test case ...
}
}
π SEE ALSO π
π HISTORY π
shtk_unittest_add_fixture first appeared in shtk 1.6. iconic behavior π
π okay bye bestie β this page is stamped Debian, dated November 8, 2014, and filed under SHTK_UNITTEST_ADD_FIXTURE(3). stay slay π
π¦ where this page comes from
- nixos 26.05: shtk 1.7
- nixpkgs unstable: shtk 1.7
- Copyright 2014 Google Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms