Extension:Expect/pl

This page is a translated version of the page Extension:Expect and the translation is 8% complete.
Podręcznik rozszerzeń MediaWiki
OOjs UI icon advanced.svg
Expect
Status wydania: beta
Keepcalms.png
Realizacja API
Opis Provides extended assertions for Scribunto.
Autor(zy)
  • John Erling Blad (Jebladdyskusja)
Ostatnia wersja 0.1.0
Polityka zgodności Master maintains backward compatibility.
MediaWiki >= 1.33
Zmiany w bazie danych Nie
Composer jeblad/expect
Licencja GNU General Public License 2.0 lub późniejsza
Pobieranie
README, LDoc
Translate the Expect extension

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.

  • Pobierz i umieść plik(i) w katalogu o nazwie Expect w folderze extensions/.
  • Dodaj poniższy kod na dole twojego pliku LocalSettings.php :
    wfLoadExtension( 'Expect' );
    
  • Yes Zrobione – Przejdź do Special:Version na twojej wiki, aby sprawdzić czy rozszerzenie zostało pomyślnie zainstalowane.

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.

Zobacz też