Skip to content

Commit

Permalink
support for tagging and filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
linkrope committed Aug 26, 2016
1 parent 797c6ca commit 89741aa
Show file tree
Hide file tree
Showing 4 changed files with 161 additions and 58 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@ Thanks to D's User Defined Attributes, test names no longer have to start with
"test".

Put `mixin UnitTest;` in your test class and attach `@Test`,
`@BeforeEach`, `@AfterEach`, `@BeforeAll`, `@AfterAll`, and `@Disabled("...")`
(borrowed from JUnit 5) to the member functions to state their purpose.
`@BeforeEach`, `@AfterEach`, `@BeforeAll`, `@AfterAll`, `@Tag("...")`,
and `@Disabled("...")`
(borrowed from [JUnit 5](http://junit.org/junit5/docs/current/user-guide/))
to the member functions to state their purpose.

Test Results
------------
Expand Down
4 changes: 4 additions & 0 deletions example.d
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,10 @@ class TestingThisAndThat
}

// test function can even be private
// tagged test functions can be selected to be included or excluded
@Test
@Tag("fast")
@Tag("smoke")
private void success()
{
testResult(true);
Expand Down Expand Up @@ -207,6 +210,7 @@ class TestingAsynchronousCode
}

@Test
@Tag("slow")
public void test()
{
assertFalse(done);
Expand Down
5 changes: 5 additions & 0 deletions src/dunit/attributes.d
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ struct Disabled
string reason;
}

struct Tag
{
string name;
}

deprecated("use AfterEach instead") alias After = AfterEach;
deprecated("use AfterAll instead") alias AfterClass = AfterAll;
deprecated("use BeforeEach instead") alias Before = BeforeEach;
Expand Down
Loading

0 comments on commit 89741aa

Please sign in to comment.