trap_has_passed


Description:

[ Version ( since = "2.16" ) ]
public bool trap_has_passed ()

Check the result of the last trap_subprocess call.

Example: Check the result of the last fork:

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

Test.add_func ("/valadoc/driver-0.14.x", () => {
Test.trap_subprocess ("/valadoc/driver-0.14.x/subprocess", 0, 0);
// assert_not_reached () causes the subprocess to fail
// => trap_has_passed is false!
// See also: Test.trap_assert_passed ()
if (Test.trap_has_passed ()) {
// ...
} else {
// ...
}
});

Test.add_func ("/valadoc/driver-0.14.x/subprocess", () => {
assert_not_reached ();
});

Test.run ();
return 0;
}

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

./GLib.Test.trap_has_passed --verbose

Returns:

true if the last test subprocess terminated successfully.


Namespace: GLib.Test
Package: glib-2.0