Extension:Expect/ko
Appearance
출시 상태: 베타 |
|
|---|---|
| 구현 | API |
| 설명 | Provides extended assertions for Scribunto. |
| 만든 이 | |
| 최신 버전 | 0.1.0 |
| 호환성 정책 | Master maintains backward compatibility. |
| MediaWiki | >= 1.33 |
| 데이터베이스 변경 | 아니오 |
| Licence | GNU General Public License 2.0 or later |
| 다운로드 | GitHub:
Note: 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.
설치
Expect depends on modules from the Scribunto extension.
- 파일을 다운로드하고
Expect폴더를extensions/디렉토리에 넣어 주세요. - 아래의 코드를 LocalSettings.php 코드의 마지막에 추가합니다.
wfLoadExtension( 'Expect' );
완료 – 위키의 ‘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
local expect = require 'expect'
-- Create a few compute graphs
local expectString = expect:create():asType():toBeEqual( 'string' )
local expectNoColon = expect:create():toBeUMatch( '^[^:]*$' )
-- Create an exported hash
local p = {}
-- Add a function
function p.helloWorld( name )
-- Call the compute graphs
expectString( name )
expectNoColon( name )
-- Should be safe to do whatever now
return mw.ustring.format( 'Hi there %s!', name )
end
-- Return the exported hash
return p
For further help, see the generated LDoc documentation.
Development
For recreating the Vagrant-based development environment, see Expect: Topics/Vagrant.
