Skip to content

Commit

Permalink
Merge pull request #1944 from actonlang/test-testing
Browse files Browse the repository at this point in the history
Make sure we find test functions
  • Loading branch information
plajjan authored Oct 11, 2024
2 parents b36997c + 3de7d03 commit 6b7f220
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions test/stdlib_tests/src/test_testing2.act
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()

0 comments on commit 6b7f220

Please sign in to comment.