Erweiterung:Pickle
Diese Erweiterung ist mit der MediaWiki 1.42 oder neueren Veröffentlichung inkompatibel! Du wirst davon abgeraten, diese Erweiterung auf einer Live-Seite zu verwenden. MediaWiki developers are invited to pledge their efforts to updating this extension to make it compatible with MediaWiki 1.42 by replacing the {{Incompatible }} template with {{Incompatible |version=1.42|pledge=~~~~}} . |
Pickle Freigabestatus: experimentell |
|
---|---|
Einbindung | Benutzer-Schnittstelle, Daten-Extraktion, API |
Beschreibung | Provides a basic on-site testing framework for Scribunto. |
Autor(en) |
|
Letzte Version | 0.1.0 |
Kompatibilitätspolitik | Der Master behält die Abwärtskompatibilität bei. |
MediaWiki | 1.33 - 1.35 |
Datenbankänderungen | Nein |
Lizenz | GNU General Public License 2.0 oder später |
Herunterladen | GitHub: Hinweis: README, LDoc |
Hilfe | Hilfe:Pickle |
|
|
Übersetze die Pickle-Erweiterung | |
The Pickle (or Behavior-driven development, BDD, previously Spec) extension is an extension for "spec" style testing for Scribunto . Spec type testing is the same type of unit testing that is done in Rspec, Busted and other similar testing frameworks. It will provide a very thin integration to PHP and a few Lua modules and their localizations. The actual code is still valid Lua, and all editing tools will work, except for missing definitions for intellisense in the various editors.
The extension is called Pickle because you pick on your code. It is also a play with words; gherkins are used for pickles. Gherkin is also a language for "step" style testing, a kind of acceptance testing, so you might say these kinds of code snippets are pickles.
An overview of the pickle extension from a user perspective can be found at Hilfe:Pickle .
Installation
Pickle depends on the Scribunto extension. For recreating the Vagrant-based development environment, see Pickle: Topics/Vagrant.
- Die Erweiterung herunterladen und die Datei(en) in ein Verzeichnis namens
Pickle
im Ordnerextensions/
ablegen. - Folgenden Code am Ende deiner LocalSettings.php -Datei einfügen:
wfLoadExtension( 'Pickle' );
- Erledigt – Navigiere zu Special:Version in deinem Wiki, um zu überprüfen, ob die Erweiterung erfolgreich installiert wurde.
Verwendung
The extension can be configured for implicit style or explicit style of tests.
The implicit style piggybacks the installation on the describe()
call, but this depends on a functional getfenv()
call.
The Scribunto extension limits the getfenv()
call, and according to Extension:Scribunto/Lua reference manual#Differences from standard Lua it is not quite predictable, thus only the explicit style will work.
The reason for the dependency on getfenv()
is that the functions are constructed before the describe()
function is called, and thus the calling run-time environment are bound without the global functions.
To insert the global functions in the correct run-time environment the describe()
call use getfenv()
.
Without the getfenv()
call the correct run-time environment must be present while creating the functions.
Thus a call describe()
must install the global functions.
Switching between the styles are done by the config { "Setup": "implicit" }
or { "Setup": "explicit" }
.
If you have a module like "Module:HelloWorld", the ubiquitous and quite pesky example, it will be coded as something like
local p = {}
function p.helloWorld()
return "Hi there!"
end
return p
Then on a subpage /pickle
you would test this like like the following
- Implicit form
return describe 'Hello world' (function()
subject .helloWorld()
it 'says hello' (function()
expect :toBe("Hi there!");
end)
end)
- Explicit form
mw.pickle:install()
describe 'Hello world' (function()
subject .helloWorld()
it 'says hello' (function()
expect :toBe("Hi there!");
end)
end)
return mw.pickle:reports()
The implicit form has the lines in the beginning and end removed, and the return statement moved down to the new end of code.
There might be additional changes, like where the tap()
call is available, and how many describe()
calls that can be made.
- Extensions incompatible with 1.42/de
- Experimental extensions/de
- User interface extensions/de
- Data extraction extensions/de
- API extensions/de
- GPL licensed extensions/de
- Extensions in GitHub version control/de
- SpecTesterGadgets extensions/de
- SpecTesteeGadgets extensions/de
- ParserFirstCallInit extensions/de
- ContentAlterParserOutput extensions/de
- OutputPageParserOutput extensions/de
- EditPage::showStandardInputs:options extensions/de
- EditPage::showReadOnlyForm:initial extensions/de
- ScribuntoExternalLibraries extensions/de
- ScribuntoExternalLibraryPaths extensions/de
- All extensions/de