Files
cell/tests/test_actor_access.js

18 lines
590 B
JavaScript

// Test that actors have access to $_
log.console("Testing actor access to $_:");
// In an actor script, $_ should be available
if (typeof $_ !== 'undefined') {
log.console("✓ Actor has access to $_");
log.console(" $_.random is a", typeof $_.random);
log.console(" $_.clock is a", typeof $_.clock);
// Test spawning another actor
var child = this.spawn('test_child_actor.js');
// Test using a module
var testModule = use('test_module');
log.console("✓ Module loaded, result:", testModule.test());
} else {
log.error("✗ Actor does NOT have access to $_");
}