#!/usr/bin/env qore
# -*- mode: qore; indent-tabs-mode: nil -*-

%new-style
%enable-all-warnings
%require-types
%strict-args

%requires ../../../../qlib/QUnit.qm

%exec-class TldTest

Thr thr;
Mutex m;

class Thr {
    destructor() {
        if (m) {
        }
    }
}

public class TldTest inherits QUnit::Test {
    constructor() : Test("TLD test", "1.0") {
        addTestCase("test", \test());

        set_thread_init(sub () {
            m = new Mutex();
            thr = new Thr();
        });

        # Return for compatibility with test harness that checks return value.
        set_return_value(main());
    }

    test() {
        Counter cnt(1);

        background sub () {
            cnt.dec();
        }();
        assertTrue(True);
    }
}
