Extension:Pickle/zh

“Pickle”（或“行为驱动开发”、“BDD”、以前的“Spec”）扩展是的“Spec”风格测试的扩展. 规范类型测试与Rspec、Busted和其他类似测试框架中的单元测试类型相同. 它将为PHP和一些Lua模块及其本地化提供非常精简的集成. 实际的代码仍然是有效的Lua，所有的编辑工具都可以工作，除了在各种编辑器中缺少intellisense的定义.

该扩展名被称为“Pickle”，因为您可以随意选择代码. 这也是一场文字游戏；gherkins用于pickles.. 在您的代码上. 小黄瓜也是一种“步骤”式测试的语言，一种验收测试，所以你可能会说这类代码片段是“pickles”.

从用户角度对pickle扩展的概述可以在处找到.

安裝
pickle依赖于的扩展. 要重新创建基于Vagrant的开发环境，请参见Pickle: Topics/Vagrant.

使用
The extension can be configured for implicit style or explicit style of tests. The implicit style piggybacks the installation on the  call, but this depends on a functional   call. The Scribunto extension limits the  call, and according to Extension:Scribunto/Lua reference manual it is not quite predictable, thus only the explicit style will work.

The reason for the dependency on  is that the functions are constructed before the   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  call use. Without the  call the correct run-time environment must be present while creating the functions. Thus a call  must install the global functions.

Switching between the styles are done by the config  or.

If you have a module like "Module:HelloWorld", the ubiquitous and quite pesky example, it will be coded as something like

Then on a subpage  you would test this like like the following


 * Implicit form


 * Explicit form

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  call is available, and how many   calls that can be made.