Extension:Expect/pl

Category:GPL licensed extensions/pl
Podręcznik rozszerzeń MediaWiki
Expect
Status wydania: betaCategory:Beta status extensions/pl
Realizacja API Category:API extensions/pl
Opis Provides extended assertions for Scribunto.
Autor(zy)
Ostatnia wersja 0.1.0
Polityka zgodności Master utrzymuje kompatybilność wsteczną.
MediaWiki >= 1.33
Zmiany w bazie danych Nie
Licencja Licencja GNU General Public License 2.0 lub późniejsza
Pobieranie Category:Extensions in GitHub version control/pl
README, LDoc
Translate the Expect extension
Category:All extensions/pl

Expect provides an extended framework for assertions.

It is based upon compute graphs that are predefined before being used for extensive checks.

Instalacja

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.

Użycie

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ż

Category:API extensions/pl Category:All extensions/pl Category:Beta status extensions/pl Category:Extensions in GitHub version control/pl Category:GPL licensed extensions/pl Category:ScribuntoExternalLibraryPaths extensions/pl