विकिपीडिया:लुआ: रिवीजन सभ के बीचा में अंतर

Content deleted Content added
imported>TheDJ
→‎Unit testing: Let's keep the same name we use in Template namespaces.
imported>TheDJ
छो →‎Unit testing: one more
लाइन 55:
A unit testing framework for Lua scripts on Wikipedia is available at [[Module:UnitTests]]. It allows you to execute your script on a given set of inputs and verify that the expected outputs are produced. Unit tests are especially useful for rapidly detecting regressions, where modifications to a script introduce new problems.
 
By convention, unit tests for a module like [[Module:Bananas]] are placed in [[Module:Bananas/testcases]], and are executed on [[Module talk:Bananas/testcases]] with e.g. <code><nowiki>{{#invoke: Bananas/testcases | run_tests}}</nowiki></code>. Test methods must begin with "test". A simple example from [[Module:Bananas/teststestcases]] is below.
<syntaxhighlight lang="lua">
-- Unit tests for [[Module:Bananas]]. Click talk page to run tests.