After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 590237 - Reusable tests and generics
Reusable tests and generics
Status: RESOLVED OBSOLETE
Product: libgee
Classification: Platform
Component: general
git master
Other All
: Normal enhancement
: ---
Assigned To: libgee-maint
libgee-maint
Depends on:
Blocks:
 
 
Reported: 2009-07-30 10:04 UTC by Julien Peeters
Modified: 2009-09-03 15:51 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch for generic testing (20.57 KB, patch)
2009-08-05 10:12 UTC, Julien Peeters
none Details | Review

Description Julien Peeters 2009-07-30 10:04:17 UTC
Until now tests are encapsulated in global functions. It would be simpler and more powerful to encapsulate tests in fixtures with a common setup and teardown method call respectively before and after each test like many other testing framework do.

The use case could be as followed:

class MyTest: TestFixture {

    public MyTest(string name) {
        base(name);
        add_test("test1", test1);
        add_test("test2", test2);
    }

    public void setup () { ... }
    public void teardown () { ... }

    public void test1 () { ... }
    public void test2 () { ... }
    ....
}

void main () {

    MyTest test = new MyTest ("MyTest");

    Test.get_root ().add_suite (test.get_suite ());

    Test.run ();
}

A first try was already implemented about test fixture but need to be validated.

Furthermore, tests on generic containers are currently containing several common code then the goal is here, if possible, to make tests as generic as possible for those cases.
Comment 1 Julien Peeters 2009-08-03 17:37:05 UTC
(In reply to comment #0)

The first step of the work (make CollectionTests generic) is done but need to be validated.

My personal branch 'jpeeters' is accessible at http://github.com/jpeeters/libgee/tree/jpeeters

A error remains at runtime but it depends on Vala instead of Gee I think.

Comment 2 Julien Peeters 2009-08-05 10:12:05 UTC
Created attachment 139931 [details] [review]
Patch for generic testing
Comment 3 Julien Peeters 2009-09-03 15:51:05 UTC
Generic tests will be no longer used. So this bug report does not have sense anymore.