"వికీపీడియా:Lua" కూర్పుల మధ్య తేడాలు

→‎Unit testing: Let's keep the same name we use in Template namespaces.
(→‎About Lua: Rewriting comments a little for clarity; also changing placement as, weirdly, our syntax highlighter doesn't do monospaced whitespace correctly.)
(→‎Unit testing: Let's keep the same name we use in Template namespaces.)
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.
0

edits

"https://te.wikipedia.org/wiki/ప్రత్యేక:MobileDiff/1387548" నుండి వెలికితీశారు