Extension:Expect/hi
![]() प्रकाशन की स्थिति: बीटा |
|
---|---|
![]() |
|
कार्यान्वयन | API |
विवरण | Provides extended assertions for Scribunto. |
लेखक | |
नवीनतम संस्करण | 0.1.0 |
संगतता नीति | मास्टर में पीछे की तरफ से संगतता है। |
MediaWiki | >= 1.33 |
डेटाबेस बदलता है | नहीं |
Composer | jeblad/expect |
लाइसेंस | GNU साधारण सार्वजनिक लाइसेंस 2.0 या उसके बाद |
डाउनलोड करें | 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.
स्थापित
Expect depends on modules from the Scribunto extension.
- फाइलों को डाउनलोड करें और अपने
extensions/
फोल्डर केExpect
नामक डिरेक्ट्री में डालें। - अपनी LocalSettings.php के नीचे निम्नलिखित कोड जोड़ें:
wfLoadExtension( 'Expect' );
- पूर्ण – अपने विकि पर Special:Version पर जाकर देखें कि एक्सटेंशन को सफलतापूर्वक स्थापित किया गया है कि नहीं।
उपयोग
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.
विकास
For recreating the Vagrant-based development environment, see Expect: Topics/Vagrant.