Sha256: b9013d53252f47c73cd0b9668389b482345d4abebc2677707e2df6c928a67049

Contents?: true

Size: 1.02 KB

Versions: 9

Compression:

Stored size: 1.02 KB

Contents

// ==========================================================================
// Project:   Spade - CommonJS Runtime
// Copyright: ©2011 Strobe Inc. All rights reserved.
// License:   Licened under MIT license (see __preamble__.js)
// ==========================================================================

var Ct = require('core-test/sync'),
    Spade = require('spade').Spade,
    Sandbox = require('spade').Sandbox;

Ct.module('spade: Sandbox compilation');

Ct.setup(function(t) {
  t.sandbox = new Sandbox(new Spade());
});

Ct.teardown(function(t) {
  delete t.sandbox;
});

Ct.test('normal', function(t){
  t.equal(t.sandbox._compilerInited, undefined);
  t.equal(t.sandbox.compile('2 * 2'), 4);
  t.equal(t.sandbox._compilerInited, true);
});

Ct.test('already initialized', function(t){
  // Initialize
  t.sandbox.compile('');
  // Test
  t.equal(t.sandbox.compile('3 * 3'), 9);
});

Ct.test('destroyed', function(t){
  t.sandbox.destroy();
  t.throws(function(){ t.sandbox.compile('4 * 4'); }, Error, "Sandbox destroyed");
});

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
spade-runtime-0.1.0.1 spec/javascript/sandbox/compile.js
spade-0.0.8.1 spec/javascript/sandbox/compile.js
spade-0.0.7 spec/javascript/sandbox/compile.js
spade-0.0.6 spec/javascript/sandbox/compile.js
spade-0.0.5 spec/javascript/sandbox/compile.js
spade-0.0.4 spec/javascript/sandbox/compile.js
spade-0.0.3 spec/javascript/sandbox/compile.js
spade-0.0.2 spec/javascript/sandbox/compile.js
spade-0.0.1 spec/javascript/sandbox/compile.js