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

Content deleted Content added
imported>Scott
→‎About Lua: Rewriting comments a little for clarity; also changing placement as, weirdly, our syntax highlighter doesn't do monospaced whitespace correctly.
imported>TheDJ
→‎Unit testing: Let's keep the same name we use in Template namespaces.
लाइन 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/teststestcases]], and are executed on [[Module talk:Bananas/teststestcases]] with e.g. <code><nowiki>{{#invoke: Bananas/teststestcases | run_tests}}</nowiki></code>. Test methods must begin with "test". A simple example from [[Module:Bananas/tests]] is below.
<syntaxhighlight lang="lua">
-- Unit tests for [[Module:Bananas]]. Click talk page to run tests.