Why and how Implement ClassNameTests in Scribunto?
- To enhance central modules stability.
- In a way which insure a stric protocol, easy to use, in the respect of ClassNameTests specifications.
- Display the same tests cases for users in p.tests(frame) mode to permit at them to better understand functions, to verify if tests are well made and well checked, and to propose new tests for missing case types.
Proposed functions in Mediawiki and central modules, to adjust in cooperation, in advanced debug state:
* mw.ClassNameTests(mw_tests, nmaxi) -- To initialise, to limit all tests in time and to limit cases in coherence with nmaxi. * mw.ClassNameCase(case, n), used inside mw.ClassNameTests() to run each test case of number 1 to nmaxi. * The case object contains fields: count, OK="OK"..., n, name, type, args{}, expect{}, NameTest{}, func(), provide(), run() * Functions used in central modules: tests_cases.ClassNameTests(), .init(), .expectdiffs(), .gettestsgroups(), .getcases(), .expectdiffs(), .normalcase(case), viewer.form9en()
- In the tests_cases library, tests cases are in recursive groups of groups of cases.
- Groups levels: main module, sub modules or libraries, functions and their tests cases.
- An anti loop system protect against mistakes in groups names declarations.