Extension:Expect/zh
Appearance
From mediawiki.org
This page is a translated version of the page Extension:Expect and the translation is 0% complete.
Languages:
发行状态: 测试版 |
|
|---|---|
| 实现 | API |
| 描述 | Provides extended assertions for Scribunto. |
| 作者 | |
| 最新版本 | 0.1.0 |
| 兼容性政策 | master分支维持向后兼容。 |
| MediaWiki | >= 1.33 |
| 数据库更改 | 否 |
| 许可证 | GNU General Public License 2.0 or later |
| 下載 | GitHub:
注意: README, LDoc |
| 翻译Expect扩展 | |
Expect provides an extended framework for assertions.
It is based upon compute graphs that are predefined before being used for extensive checks.
Installation
Expect depends on modules from the Scribunto extension.
- 下载文件,并将其放置在您
extensions/文件夹中的Expect目录内。 - 請新增下列代码到您的LocalSettings.php 文件的底部:
wfLoadExtension( 'Expect' );
- Yes 完成 – 請导航至您的wiki上的
Special:Version,以验证此扩展已成功安装。
Usage
The workflow is to define a graph, and then provide arguments to that graph. The definition is done once, but the graph can be reused several times.
-- Load the lib localexpect=require'expect' -- Create a few compute graphs localexpectString=expect:create():asType():toBeEqual('string') localexpectNoColon=expect:create():toBeUMatch('^[^:]*$') -- Create an exported hash localp={} -- Add a function functionp.helloWorld(name) -- Call the compute graphs expectString(name) expectNoColon(name) -- Should be safe to do whatever now returnmw.ustring.format('Hi there %s!',name) end -- Return the exported hash returnp
For further help, see the generated LDoc documentation.
Development
For recreating the Vagrant-based development environment, see Expect: Topics/Vagrant.