Re: [Vala] Gee.Testcase

Am 25.07.2012 22:07, schrieb Joseph Montanez:
So I ran across this blog:

I gave it a try and I can't seem to compile. I tried compiling the
lastest libgee and changing my package config to local.

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
valac --pkg gee-1.0 main.vala TestExample.vala

TestExample.vala:1.21-1.32: error: The type name `Gee.TestCase' could
not be found
class TestExample : Gee.TestCase {

Using Gee.TestCase is ok but in my case I missed support for testing async methods. Thats why I created libfsotest which enables you to test async methods too. See [0] for the library and the following lines for a small example:

public class TestCase0 : FsoFramework.Test.TestCase
    public TestCase0()
        base( "TestCase0" );

        add_async_test( "AsyncWithTimeout",
                        cb => test_async_with_timeout( cb ),
                        res => test_async_with_timeout.end( res ),
                        4000 );

public async void test_async_with_timeout() throws GLib.Error, AssertError
        bool done = false;

        Timeout.add_seconds( 3, () => {
            done = true;
            return false;
        } );

        Assert.is_true( done );

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

    TestSuite root = TestSuite.get_root();
    root.add_suite( new TestCase0().get_suite() );;

    return 0;



Simon Busch -

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