glib: modular test fixtures?



Maybe I've just been up too late and am not thinking straight, but I
suppose it doesn't hurt to ask... is there some way to use the Glib
testing framework so as to have modular fixtures that could be combined
or separated on a per-test basis? I'm staring at the API, but not seeing it.

What I mean is: Say, I have test function A, which needs a fixture
providing an open FILE stream, and test function B, which needs a
fixture providing an character buffer, and test function C, which needs
both. Ideally, I would be able to simply write a "file stream" fixture,
and a "character buffer" fixture, and then somehow use both in test
function C.

Obviously, one approach would be to write a single fixture which
provides both the FILE stream and the character buffer, and pass that to
all functions. But then it starts to get complicated if, say, I add a
test function D, which needs the same FILE stream, but a character
buffer of a different size. Add enough functions, and I end up with a
bunch of massive, clumsy fixtures (and fixture functions) that repeat a
lot of the same code, yet differ slightly from each other.

-- 
frigidcode.com
indicium.us



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]