Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abstract tests classes in utest #28

Open
Aidan63 opened this issue Mar 30, 2024 · 0 comments
Open

Abstract tests classes in utest #28

Aidan63 opened this issue Mar 30, 2024 · 0 comments

Comments

@Aidan63
Copy link

Aidan63 commented Mar 30, 2024

Hello,

I have an abstract class which extends utest's Test class and contains a bunch of generic tests against an interface. I then have two sub classes which extend this abstract and provide a concrete implementation for it to run its tests against. I do this as utest doesn't allow adding the multiple instances of the same type to a runner.

class TestCurrentProcessWriteStdout extends TestCurrentProcessWriteTty {
    public function new() {
        super(Process.current.stdout);
    }
}

class TestCurrentProcessWriteStderr extends TestCurrentProcessWriteTty {
    public function new() {
        super(Process.current.stderr);
    }
}

abstract class TestCurrentProcessWriteTty extends Test {
    final writable : IWritable;

    public function new(_writable) {
        super();
        writable = _writable;
    }

    // tests
}

While all the tests appear in the test viewer tab in vscode this causes two issues.

  • Double clicking on a test to navigate to the function location no longer works, instead it just navigates you to the declaration of the specific sub class.

  • Icons no longer appear in the gutter next to the test functions in the abstract class, instead you get a single icon in the gutter next to the sub class declaration.

image
Icon next to sub classes

image
No icons next to test functions.

I appreciate displaying icons next to actual functions in these cases might be tricky as one sub class might be passing and another failing, not to mention if vscode even supports stuff like this in the first place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant