bob blihblih one 0.1.2 BOB fuuu echo delayed-echo ls default line: one ls line: one ls line: three ls line: two ls line: one ls line: three ls line: two �[32mThis spell is not ready yet. �[39mone more time: one one more time: two one more time: three end: one one - un two - deux three - trois onE two thrEE onE two thrEE
- Formula & variable substitution
- 'scroll' block
- 'summon' block and dependencies
- 'foreach' block
- 'transmute' block
- 'transmute-file' block
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' ] ) ;
should substitute variable (aka formula) accordingly in 'scroll' block.
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() ;
} ) ;
} ) ;
should substitute variable (aka formula) using filters.
cleanup( function() {
var book = new spellcast.Book( fs.readFileSync( 'spellbook' ).toString() ) ;
book.cast( 'kawarimi-filter' , function( error )
{
expect( error ).not.ok() ;
expect( getCastedLog( 'kawarimi-filter' ) ).to.be( '0\\.1\\.2\nBOB\nfuuu\n' ) ;
done() ;
} ) ;
} ) ;
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 write a new formula with the output of an 'scroll' block.
cleanup( function() {
var book = new spellcast.Book( fs.readFileSync( 'spellbook' ).toString() ) ;
book.cast( 'write-formula' , function( error )
{
expect( error ).not.ok() ;
expect( getCastedLog( 'write-formula' ) ).to.be( 'ls default line: one\nls line: one\nls line: three\nls line: two\nls line: one\nls line: three\nls line: two\n' ) ;
done() ;
} ) ;
} ) ;
should consider up to date a summon on a file that have a rule but that does nothing.
cleanup( function() {
var book = new spellcast.Book( fs.readFileSync( 'spellbook' ).toString() ) ;
book.cast( 'summon-top' , function( error )
{
expect( error ).not.ok() ;
expect( getCastedLog( 'summon-top' ) ).to.be( '' ) ;
done() ;
} ) ;
} ) ;
should iterate through a variable as a list.
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() ;
} ) ;
} ) ;
should iterate through a variable as a list using coupled variable substitution.
cleanup( function() {
var book = new spellcast.Book( fs.readFileSync( 'spellbook' ).toString() ) ;
book.cast( 'foreach-coupled' , function( error )
{
expect( error ).not.ok() ;
expect( getCastedLog( 'foreach-coupled' ) ).to.be( 'one - un\ntwo - deux\nthree - trois\n' ) ;
done() ;
} ) ;
} ) ;
should execute a regular expression to a variable as a list.
cleanup( function() {
var book = new spellcast.Book( fs.readFileSync( 'spellbook' ).toString() ) ;
book.cast( 'transmute' , function( error )
{
expect( error ).not.ok() ;
expect( getCastedLog( 'transmute' ) ).to.be( 'onE\ntwo\nthrEE\n' ) ;
done() ;
} ) ;
} ) ;
should execute a regular expression to a variable as a list.
cleanup( function() {
var book = new spellcast.Book( fs.readFileSync( 'spellbook' ).toString() ) ;
book.cast( 'transmute-file' , function( error )
{
expect( error ).not.ok() ;
expect( getCastedLog( 'transmute-file' ) ).to.be( 'onE two thrEE\n' ) ;
done() ;
} ) ;
} ) ;