remove json as a global
This commit is contained in:
@@ -2,14 +2,14 @@ return {
|
||||
test_contact: function() {
|
||||
function contact_fn(actor,reason) {
|
||||
if (actor) {
|
||||
log.console(`Got an actor: ${json.encode(actor)}`)
|
||||
log.console(`Got an actor: ${actor}`)
|
||||
|
||||
send(actor, {greet: "Hello!"}, e => {
|
||||
log.console(`Got the response ${json.encode(e)}. Goodbye!`);
|
||||
log.console(`Got the response ${e}. Goodbye!`);
|
||||
})
|
||||
}
|
||||
else
|
||||
log.console(`Did not get an actor: ${json.encode(reason)}`)
|
||||
log.console(`Did not get an actor: ${reason}`)
|
||||
}
|
||||
|
||||
$_.contact(contact_fn,
|
||||
|
||||
@@ -9,7 +9,7 @@ return {
|
||||
|
||||
$_.start(e => {
|
||||
send(e.actor, { op: 'get', domain: host, port: 80}, addrs => {
|
||||
log.console(json.encode(addrs[0]))
|
||||
log.console(addrs[0])
|
||||
})
|
||||
}, 'dig')
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ return {
|
||||
if (reason)
|
||||
log.console(reason)
|
||||
else
|
||||
log.console(json.encode(result))
|
||||
log.console(result)
|
||||
|
||||
log.console(`took ${time.number()-st} secs`)
|
||||
});
|
||||
|
||||
@@ -8,7 +8,7 @@ $_.portal(e => {
|
||||
}, 5678);
|
||||
|
||||
$_.receiver(e => {
|
||||
log.console(`Got message: ${json.encode(e)}`)
|
||||
log.console(`Got message: ${e}`)
|
||||
send(e, {greet: "Hello back!"})
|
||||
$_.delay(_ => $_.stop(), 0.2)
|
||||
})
|
||||
|
||||
@@ -128,7 +128,7 @@ return {
|
||||
|
||||
req(function(result, reason) {
|
||||
if (result != null) {
|
||||
log.console(`Objectify result: ${json.encode(result)}`)
|
||||
log.console(`Objectify result: ${result}`)
|
||||
} else {
|
||||
log.console(`Objectify failed: ${reason}`)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
$_.receiver(e => {
|
||||
log.console(`Got a message: ${json.encode(e)}`)
|
||||
log.console(`Got a message: ${e}`)
|
||||
|
||||
send(e, {
|
||||
message: "Good to go."
|
||||
|
||||
@@ -2,7 +2,7 @@ return {
|
||||
test_send: function() {
|
||||
$_.start(e => {
|
||||
send(e.actor, { message: "Hello! Good to go?" }, msg => {
|
||||
log.console(`Original sender got message back: ${json.encode(msg)}. Stopping!`)
|
||||
log.console(`Original sender got message back: ${msg}. Stopping!`)
|
||||
// $_.stop() // Removed
|
||||
})
|
||||
}, "tests/reply_actor")
|
||||
|
||||
@@ -23,8 +23,8 @@ function test_roundtrip(obj, name) {
|
||||
var encoded = toml.encode(obj)
|
||||
var decoded = toml.decode(encoded)
|
||||
if (!deep_equal(obj, decoded)) {
|
||||
log.console(name + " - Original:", json.encode(obj))
|
||||
log.console(name + " - Round-trip:", json.encode(decoded))
|
||||
log.console(name + " - Original:", obj)
|
||||
log.console(name + " - Round-trip:", decoded)
|
||||
throw name + " round-trip failed"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user