-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1944 from actonlang/test-testing
Make sure we find test functions
- Loading branch information
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import logging | ||
import testing | ||
|
||
actor MathTester(): | ||
def add(a, b): | ||
return a + b | ||
|
||
|
||
actor SyncTester(log_handler): | ||
log = logging.Logger(log_handler) | ||
def test(): | ||
m = MathTester() | ||
log.info("SyncTester.test()", None) | ||
testing.assertEqual(m.add(1, 2), 3, "1 + 2 = 3") | ||
|
||
actor AsyncTester(report_result, log_handler): | ||
log = logging.Logger(log_handler) | ||
def test(): | ||
log.info("AsyncTester.test()", None) | ||
report_result(True, None) | ||
|
||
actor EnvTester(report_result, env, log_handler): | ||
log = logging.Logger(log_handler) | ||
def test(): | ||
log.info("EnvTester.test()", None) | ||
report_result(True, None) | ||
|
||
def _test_foo() -> None: | ||
pass | ||
|
||
def _test_syncact(log_handler: logging.Handler) -> None: | ||
s = SyncTester(log_handler) | ||
return s.test() | ||
|
||
# Make sure test discovery works with the proper type signature | ||
def _test_asyncact1(report_result: action(?bool, ?Exception) -> None, log_handler: logging.Handler) -> None: | ||
s = AsyncTester(report_result, log_handler) | ||
s.test() | ||
|
||
def _test_asyncact2(report_result: action(?bool, ?Exception) -> None, log_handler: logging.Handler) -> None: | ||
s = AsyncTester(report_result, log_handler) | ||
s.test() | ||
|
||
def _test_envtest1(report_result: action(?bool, ?Exception) -> None, env: Env, log_handler: logging.Handler) -> None: | ||
s = EnvTester(report_result, env, log_handler) | ||
s.test() | ||
|
||
def _test_envtest2(report_result: action(?bool, ?Exception) -> None, env: Env, log_handler: logging.Handler) -> None: | ||
s = EnvTester(report_result, env, log_handler) | ||
s.test() |