Jump to content

Extension:Expect/ko

From mediawiki.org
This page is a translated version of the page Extension:Expect and the translation is 8% complete.
미디어위키 확장 기능 설명서
Expect
출시 상태: 베타
구현 API
설명 Provides extended assertions for Scribunto.
만든 이
  • John Erling Blad (Jeblad토론)
최신 버전 0.1.0
호환성 정책 Master maintains backward compatibility.
MediaWiki >= 1.33
데이터베이스 변경 아니오
Licence GNU General Public License 2.0 or later
다운로드
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' );
    
  • Yes 완료 – 위키의 ‘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.

See also