add_func


Description:

[ Version ( since = "2.16" ) ]
public void add_func (string testpath, owned TestFunc test_funcvoid)

Create a new test case, similar to TestCase.

However the test is assumed to use no fixture, and test suites are automatically created on the fly and added to the root fixture, based on the slash-separated portions of testpath.

If testpath includes the component "subprocess" anywhere in it, the test will be skipped by default, and only run if explicitly required via the `-p` command-line option or trap_subprocess.

No component of testpath may start with a dot (`.`) if the g_test_option_isolate_dirs option is being used; and it is recommended to do so even if it isn’t.

Example: Register a new test case:

public static int main (string[] args) {
Test.init (ref args);

Test.add_func ("/libvaladoc/driver-0.12.x", () => {
// TODO: test
});

Test.run ();
return 0;
}

valac --pkg glib-2.0 GLib.Test.add_func.vala

./GLib.Test.add_func --verbose

Parameters:

testpath

/-separated test case path name for the test.

test_func

The test function to invoke for this test.


Namespace: GLib.Test
Package: glib-2.0