Open IanTrudel opened 2 weeks ago
Can you open a draft PR with these for easy review and inline feedback?
Can you open a draft PR with these for easy review and inline feedback?
What workflow do you suggest? Clone or fork and then submit a PR?
Which directory should these files go? unittest.icn is the package and tests.icn is the unit tests testing unittest package.
We use Fork/PR workflow (here ).
Who are you targeting with this package? The language developers? or the language users, writing their own applications in Unicon and using the package to write tests? If it is the former, then it should go under unicon/tests/
, if it is the latter (or both), then it should go under uniccon/uni/lib
. The test itself should go under under unicon/tests/lib
or unicon/tests/unicon
.
There you go, as you requested! https://github.com/uniconproject/unicon/pull/432
I haven't programmed in Icon since Ralph Griswold passed away and only few weeks with Unicon. There are most certainly a few things I would like to improve upon. Bootstrapping is the highlight at the moment, since the unittest package is used to test the unittest package. Looking forward to your feedback.
Thank you @IanTrudel. We would love to grow the community and have more people contribute to Unicon.
There is a working version updated in the draft with a reasonable test coverage. There is still a bit of work to do but the question is this worthy of a PR?
The output looks like the following. exit(ts.run())
ensures that if one or more test fail, the build will fail.
TestTestSuite_testInitialState
TestTestSuite_testAddTest
TestTestSuite_testAddNonTest
TestTestSuite_testRunTests
=== TEST SUMMARY ===
passed: 0, failed: 0
ran 0 tests in 0.000000s
SimpleTest_testAssertEqual
SimpleTest_testAssert
=== TEST SUMMARY ===
passed: 2, failed: 0
ran 2 tests in 0.000092s
TestTestSuite_testRuntime
SlowTest_testSlow
=== TEST SUMMARY ===
passed: 1, failed: 0
ran 1 tests in 2.001685s
TestTestSuite_testRunFailureTests
FailureTest_testFailAssertEqual
Assertion failed: expected 0, but got 9
Assertion failed: expected Unicon, but got Icon
FailureTest_testFailAssertNotEqual
Assertion failed: unexpected 0, but got 0
Assertion failed: unexpected Unicon, but got Unicon
FailureTest_testFailAssert
Assertion failed.
Assertion failed.
Assertion failed.
Assertion failed.
=== TEST SUMMARY ===
passed: 0, failed: 3
ran 3 tests in 0.000122s
TestTestCase_testInitialState
TestTestCase_testResetStatus
TestTestCase_testAssertEqual
TestTestCase_testAssertNotEqual
TestTestCase_testAssert
TestTestCase_testAssertFail
TestMock_testInitialState
TestMock_testExpect
TestMock_testVerify
TestMock_testInvoke
TestTestReporter_testInitialState
TestTestReporter_testResult
TestTestReporter_testRuntime
TestTestReporter_testSummary
=== TEST SUMMARY ===
passed: 0, failed: 0
ran 0 tests in 0.000000s
=== TEST SUMMARY ===
passed: 1, failed: 0
ran 1 tests in 0.000000s
=== TEST SUMMARY ===
passed: 1, failed: 1
ran 2 tests in 0.000000s
=== TEST SUMMARY ===
passed: 20, failed: 0
ran 20 tests in 2.002867s
This is an early implementation of an Unicon Unit Test Framework. Your feedback would be invaluable. @cjeffery @StephenWampler @brucerennie @Jafaral
setupClass()
,teardownClass()
,setup
andteardown
.assertEqual(expected, actual)
,assertNotEqual(unexpected, actual)
,assert { expression }
andassertFail { expression }
.EXIT SUCCESS
when all tests pass.EXIT FAILURE
when one or more tests fail.The draft PR is located here: https://github.com/uniconproject/unicon/pull/432 unittest.icn tests.icn