Skip to content

Latest commit

 

History

History
92 lines (72 loc) · 1.9 KB

bdd-spec.md

File metadata and controls

92 lines (72 loc) · 1.9 KB

echo delayed-echo bob blihblih one one more time: one one more time: two one more time: three end: one

TOC

Formula

should be parsed into list of string, with an additionnal property 'index' equals to 0.

var book = new spellcast.Book( fs.readFileSync( 'spellbook' ).toString() ) ;

expect( book.formula.alert ).to.be.eql( [ 'bob' ] ) ;
expect( book.formula.list ).to.be.eql( [ 'one' , 'two' , 'three' ] ) ;

'sh' block

should echoing echo.

cleanup( function() {
	
	var book = new spellcast.Book( fs.readFileSync( 'spellbook' ).toString() ) ;
	
	book.cast( 'echo' , function( error )
	{
		expect( error ).not.ok() ;
		expect( getCastedLog( 'echo' ) ).to.be( 'echo\n' ) ;
		done() ;
	} ) ;
} ) ;

should echoing delayed-echo after one second.

cleanup( function() {
	
	var book = new spellcast.Book( fs.readFileSync( 'spellbook' ).toString() ) ;
	
	book.cast( 'delayed-echo' , function( error )
	{
		expect( error ).not.ok() ;
		expect( getCastedLog( 'delayed-echo' ) ).to.be( 'delayed-echo\n' ) ;
		done() ;
	} ) ;
} ) ;

should substitute variable (aka formula) accordingly.

cleanup( function() {
	
	var book = new spellcast.Book( fs.readFileSync( 'spellbook' ).toString() ) ;
	
	book.cast( 'kawarimi' , function( error )
	{
		expect( error ).not.ok() ;
		expect( getCastedLog( 'kawarimi' ) ).to.be( 'bob blihblih one\n' ) ;
		done() ;
	} ) ;
} ) ;

'foreach' block

should .

cleanup( function() {
	
	var book = new spellcast.Book( fs.readFileSync( 'spellbook' ).toString() ) ;
	
	book.cast( 'foreach' , function( error )
	{
		expect( error ).not.ok() ;
		expect( getCastedLog( 'foreach' ) ).to.be( 'one more time: one\none more time: two\none more time: three\nend: one\n' ) ;
		done() ;
	} ) ;
} ) ;