rethinkdbdash
Version:
A Node.js driver for RethinkDB with promises and a connection pool
1,716 lines (1,505 loc) • 136 kB
JavaScript
var config = require(__dirname+'/config.js');
var r = require(__dirname+'/../lib')(config);
var util = require(__dirname+'/util/common.js');
var assert = require('assert');
var uuid = util.uuid;
var It = util.It;
var uuid = util.uuid;
var dbName, tableName, pks, result;
It('Init for backtraces', function* (done) {
try {
dbName = uuid();
tableName = uuid();
result = yield r.dbCreate(dbName).run();
assert.equal(result.dbs_created, 1);
result = yield r.db(dbName).tableCreate(tableName).run();
assert.equal(result.tables_created, 1);
result = yield r.db(dbName).table(tableName).insert(eval('['+new Array(100).join('{}, ')+'{}]')).run();
assert.equal(result.inserted, 100);
done();
}
catch(e) {
console.log(e.message); done(e);
}
})
/*
*** NOTE ***
*
* Most of the backtraces are broken on the server.
* By broken, I mean they are most of the time not precise, like when a table doesn't exists,
* it underlines the database and the table. Or when you add a string to a number, it underlines
* everything and not just the string.
*
* We still keep tests for all the terms to be sure that at least, we properly print them.
*
************
*/
/*
Frames:
[ { type: 'POS', pos: 0 } ]
Error:
Expected type STRING but found NUMBER in:
r.dbDrop(1)
^
*/
It('Test backtrace for r.dbDrop(1)', function* (done) {
try {
r.nextVarId=1;
yield r.dbDrop(1).run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Expected type STRING but found NUMBER in:\nr.dbDrop(1)\n ^ \n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
Frames:
[ { type: 'POS', pos: 0 } ]
Error:
Expected type STRING but found NUMBER in:
r.dbCreate(1)
^
*/
It('Test backtrace for r.dbCreate(1)', function* (done) {
try {
r.nextVarId=1;
yield r.dbCreate(1).run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Expected type STRING but found NUMBER in:\nr.dbCreate(1)\n ^ \n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
//TODO Broken on the server
Frames:
[ { type: 'POS', pos: 0 }, { type: 'POS', pos: 1 } ]
Error:
Expected type ARRAY but found STRING in:
r.dbList().do(function(var_1) {
return var_1.add("a")
^^^^^^^^^^^^^^
})
*/
It('Test backtrace for r.dbList().do(function(x) { return x.add("a") })', function* (done) {
try {
r.nextVarId=1;
yield r.dbList().do(function(x) { return x.add("a") }).run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Expected type ARRAY but found STRING in:\nr.dbList().do(function(var_1) {\n return var_1.add(\"a\")\n ^^^^^^^^^^^^^^\n})\n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
//TODO Broken on the server
Frames:
[ { type: 'POS', pos: 0 }, { type: 'POS', pos: 1 } ]
Error:
Expected type NUMBER but found STRING in:
r.expr(2).do(function(var_1) {
return var_1.add("a")
^^^^^^^^^^^^^^
})
*/
It('Test backtrace for r.expr(2).do(function(x) { return x.add("a") })', function* (done) {
try {
r.nextVarId=1;
yield r.expr(2).do(function(x) { return x.add("a") }).run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Expected type NUMBER but found STRING in:\nr.expr(2).do(function(var_1) {\n return var_1.add(\"a\")\n ^^^^^^^^^^^^^^\n})\n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
//TODO Broken on the server
Frames:
[]
Error:
Table `551f695a834f94e0fe215e19441b01c9` already exists in:
r.db("7debc6e4a249569a1a6280fd6e871270").tableCreate("551f695a834f94e0fe215e19441b01c9")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*/
It('Test backtrace for r.db(dbName).tableCreate(tableName)', function* (done) {
try {
r.nextVarId=1;
yield r.db(dbName).tableCreate(tableName).run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Table `"+dbName+"."+tableName+"` already exists in:\nr.db(\""+dbName+"\").tableCreate(\""+tableName+"\")\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
//TODO Broken on the server
Frames:
[]
Error:
Table `nonExistingTable` does not exist in:
r.db("4ab068e0ed6b05f71dcd4b07034698c4").tableDrop("nonExistingTable")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*/
It('Test backtrace for r.db(dbName).tableDrop("nonExistingTable")', function* (done) {
try {
r.nextVarId=1;
yield r.db(dbName).tableDrop("nonExistingTable").run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Table `"+dbName+".nonExistingTable` does not exist in:\nr.db(\""+dbName+"\").tableDrop(\"nonExistingTable\")\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
//TODO Broken on the server
Frames:
[ { type: 'POS', pos: 0 }, { type: 'POS', pos: 1 } ]
Error:
Expected type ARRAY but found STRING in:
r.db("9cdeba73602f74f7ad67f77c76a87528").tableList().do(function(var_1) {
return var_1.add("a")
^^^^^^^^^^^^^^
})
*/
It('Test backtrace for r.db(dbName).tableList().do(function(x) { return x.add("a") })', function* (done) {
try {
r.nextVarId=1;
yield r.db(dbName).tableList().do(function(x) { return x.add("a") }).run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Expected type ARRAY but found STRING in:\nr.db(\""+dbName+"\").tableList().do(function(var_1) {\n return var_1.add(\"a\")\n ^^^^^^^^^^^^^^\n})\n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
Frames:
[ { type: 'POS', pos: 1 }, { type: 'POS', pos: 1 } ]
Error:
Index `zoo` already exists in:
r.expr(["zoo", "zoo"]).forEach(function(var_1) {
return r.db("428a2a382eb5982146afe283b811f367").table("32ae19310d055f18500b41db757337f2")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.indexCreate(var_1)
^^^^^^^^^^^^^^^^^^^
})
*/
It('Test backtrace for r.expr(["zoo", "zoo"]).forEach(function(index) { return r.db(dbName).table(tableName).indexCreate(index) })', function* (done) {
try {
r.nextVarId=1;
yield r.expr(["zoo", "zoo"]).forEach(function(index) { return r.db(dbName).table(tableName).indexCreate(index) }).run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Index `zoo` already exists on table `"+dbName+"."+tableName+"` in:\nr.expr([\"zoo\", \"zoo\"]).forEach(function(var_1) {\n return r.db(\""+dbName+"\").table(\""+tableName+"\")\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n .indexCreate(var_1)\n ^^^^^^^^^^^^^^^^^^^\n})\n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
//TODO Broken on the server
Frames:
[]
Error:
Index `nonExistingIndex` does not exist in:
r.db("91105f3567295643808ed9bab508ec25").table("35adbd4339c2fd4d285f27543e1663ec")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.indexDrop("nonExistingIndex")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*/
It('Test backtrace for r.db(dbName).table(tableName).indexDrop("nonExistingIndex")', function* (done) {
try {
r.nextVarId=1;
yield r.db(dbName).table(tableName).indexDrop("nonExistingIndex").run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Index `nonExistingIndex` does not exist on table `"+dbName+"."+tableName+"` in:\nr.db(\""+dbName+"\").table(\""+tableName+"\")\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n .indexDrop(\"nonExistingIndex\")\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
//TODO Broken on the server
Frames:
[ { type: 'POS', pos: 0 }, { type: 'POS', pos: 1 } ]
Error:
Expected type ARRAY but found STRING in:
r.db("7973e432e0aed7e4b1e6951f6049157d").table("37c62a0922bc471c6d751f8f75560cb8")
.indexList().do(function(var_1) {
return var_1.add("a")
^^^^^^^^^^^^^^
})
*/
It('Test backtrace for r.db(dbName).table(tableName).indexList().do(function(x) { return x.add("a") })', function* (done) {
try {
r.nextVarId=1;
yield r.db(dbName).table(tableName).indexList().do(function(x) { return x.add("a") }).run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Expected type ARRAY but found STRING in:\nr.db(\""+dbName+"\").table(\""+tableName+"\")\n .indexList().do(function(var_1) {\n return var_1.add(\"a\")\n ^^^^^^^^^^^^^^\n })\n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
Frames:
//TODO Broken on the server
[ { type: 'POS', pos: 0 }, { type: 'POS', pos: 1 } ]
Error:
Expected type ARRAY but found STRING in:
r.db("a0d88feb61e3d0743bde45b625e7f237").table("8e1f71fefc1f86b66348c96466951df3")
.indexWait().do(function(var_1) {
return var_1.add("a")
^^^^^^^^^^^^^^
})
*/
It('Test backtrace for r.db(dbName).table(tableName).indexWait().do(function(x) { return x.add("a") })', function* (done) {
try {
r.nextVarId=1;
yield r.db(dbName).table(tableName).indexWait().do(function(x) { return x.add("a") }).run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Expected type ARRAY but found STRING in:\nr.db(\""+dbName+"\").table(\""+tableName+"\")\n .indexWait().do(function(var_1) {\n return var_1.add(\"a\")\n ^^^^^^^^^^^^^^\n })\n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
Frames:
[ { type: 'POS', pos: 0 } ]
Error:
Index `bar` was not found in:
r.db("d095569a80834591e8053539e111299a").table("be4967584fdf58b6a5dab0cd633ba046")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.indexWait("foo", "bar")
*/
// https://github.com/rethinkdb/rethinkdb/issues/4501
/*
It('Test backtrace for r.db(dbName).table(tableName).indexWait("foo", "bar")', function* (done) {
try {
r.nextVarId=1;
yield r.db(dbName).table(tableName).indexWait("foo", "bar").run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Index `bar` was not found on table `"+dbName+"."+tableName+"` in:\nr.db(\""+dbName+"\").table(\""+tableName+"\")\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n .indexWait(\"foo\", \"bar\")\n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
*/
/*
//TODO Broken on the server
Frames:
[ { type: 'POS', pos: 1 } ]
Error:
Expected type NUMBER but found STRING in:
r.db("340daf900a4168235e5e21e53f8ccdd1").table("9276ce6940b79f4b4f64ab7812532c6e")
.indexStatus().and(r.expr(1).add("a"))
^^^^^^^^^^^^^^^^^^
*/
It('Test backtrace for r.db(dbName).table(tableName).indexStatus().and( r.expr(1).add("a"))', function* (done) {
try {
r.nextVarId=1;
yield r.db(dbName).table(tableName).indexStatus().and( r.expr(1).add("a")).run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Expected type NUMBER but found STRING in:\nr.db(\""+dbName+"\").table(\""+tableName+"\")\n .indexStatus().and(r.expr(1).add(\"a\"))\n ^^^^^^^^^^^^^^^^^^ \n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
Frames:
[ 1 ]
Error:
Index `bar` was not found on table `64f4fc7f01449d2b7aa567576b291659.449aba951895d77bc975046902f51310` in:
r.db("64f4fc7f01449d2b7aa567576b291659").table("449aba951895d77bc975046902f51310")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.indexStatus("foo", "bar").do(function(var_1) {
^^^^^^^^^^^^^^^^^^^^^^^^^^
return var_1.add("a")
})
*/
It('Test backtrace for r.db(dbName).table(tableName).indexStatus("foo", "bar").do(function(x) { return x.add("a") })', function* (done) {
try {
r.nextVarId=1;
yield r.db(dbName).table(tableName).indexStatus("foo", "bar").do(function(x) { return x.add("a") }).run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Index `bar` was not found on table `"+dbName+"."+tableName+"` in:\nr.db(\""+dbName+"\").table(\""+tableName+"\")\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n .indexStatus(\"foo\", \"bar\").do(function(var_1) {\n ^^^^^^^^^^^^^^^^^^^^^^^^^^ \n return var_1.add(\"a\")\n })\n") {
done()
}
else {
done(e);
}
}
})
/*
Frames:
[ 0 ]
Error:
Table `882c5069473a016b03069a24679271c5.nonExistingTable` does not exist in:
r.db("882c5069473a016b03069a24679271c5").table("nonExistingTable").update({
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
foo: "bar"
})
*/
It('Test backtrace for r.db(dbName).table("nonExistingTable").update({foo: "bar"})', function* (done) {
try {
r.nextVarId=1;
yield r.db(dbName).table("nonExistingTable").update({foo: "bar"}).run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Table `"+dbName+".nonExistingTable` does not exist in:\nr.db(\""+dbName+"\").table(\"nonExistingTable\").update({\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n foo: \"bar\"\n})\n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
Frames:
[ 0 ]
Error:
Table `8d192301ed6e6937c7d2e6d836f79b20.nonExistingTable` does not exist in:
r.db("8d192301ed6e6937c7d2e6d836f79b20").table("nonExistingTable").update(function(var_1) {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
return var_1("foo")
})
*/
It('Test backtrace for r.db(dbName).table("nonExistingTable").update(function(doc) { return doc("foo") })', function* (done) {
try {
r.nextVarId=1;
yield r.db(dbName).table("nonExistingTable").update(function(doc) { return doc("foo") }).run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Table `"+dbName+".nonExistingTable` does not exist in:\nr.db(\""+dbName+"\").table(\"nonExistingTable\").update(function(var_1) {\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n return var_1(\"foo\")\n})\n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
//TODO Broken on the server
Frames:
[ { type: 'POS', pos: 0 } ]
Error:
Table `nonExistingTable` does not exist in:
r.db("e7e04bbadd0f0b43f3561b32f2e1b5d6").table("nonExistingTable").replace({
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
foo: "bar"
})
*/
It('Test backtrace for r.db(dbName).table("nonExistingTable").replace({foo: "bar"})', function* (done) {
try {
r.nextVarId=1;
yield r.db(dbName).table("nonExistingTable").replace({foo: "bar"}).run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Table `"+dbName+".nonExistingTable` does not exist in:\nr.db(\""+dbName+"\").table(\"nonExistingTable\").replace({\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n foo: \"bar\"\n})\n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
//TODO Broken on the server
Frames:
[ { type: 'POS', pos: 0 } ]
Error:
Table `nonExistingTable` does not exist in:
r.db("9ca06265cbe173eeb27decb1baedb031").table("nonExistingTable").replace(function(var_1) {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
return var_1("foo")
})
*/
It('Test backtrace for r.db(dbName).table("nonExistingTable").replace(function(doc) { return doc("foo") })', function* (done) {
try {
r.nextVarId=1;
yield r.db(dbName).table("nonExistingTable").replace(function(doc) { return doc("foo") }).run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Table `"+dbName+".nonExistingTable` does not exist in:\nr.db(\""+dbName+"\").table(\"nonExistingTable\").replace(function(var_1) {\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n return var_1(\"foo\")\n})\n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
//TODO Broken on the server
Frames:
[ { type: 'POS', pos: 0 } ]
Error:
Table `nonExistingTable` does not exist in:
r.db("0ec51cb31ddf56339cd7acab73b08a2c").table("nonExistingTable").delete()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*/
It('Test backtrace for r.db(dbName).table("nonExistingTable").delete()', function* (done) {
try {
r.nextVarId=1;
yield r.db(dbName).table("nonExistingTable").delete().run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Table `"+dbName+".nonExistingTable` does not exist in:\nr.db(\""+dbName+"\").table(\"nonExistingTable\").delete()\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
//TODO Broken on the server
Frames:
[ { type: 'POS', pos: 0 } ]
Error:
Table `nonExistingTable` does not exist in:
r.db("a01528b1d8902639d48b9c0adcc397a5").table("nonExistingTable").sync()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*/
It('Test backtrace for r.db(dbName).table("nonExistingTable").sync()', function* (done) {
try {
r.nextVarId=1;
yield r.db(dbName).table("nonExistingTable").sync().run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Table `"+dbName+".nonExistingTable` does not exist in:\nr.db(\""+dbName+"\").table(\"nonExistingTable\").sync()\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
Frames:
[ { type: 'POS', pos: 0 } ]
Error:
Database `nonExistingDb` does not exist in:
r.db("nonExistingDb").table("nonExistingTable")
^^^^^^^^^^^^^^^^^^^^^
*/
It('Test backtrace for r.db("nonExistingDb").table("nonExistingTable")', function* (done) {
try {
r.nextVarId=1;
yield r.db("nonExistingDb").table("nonExistingTable").run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Database `nonExistingDb` does not exist in:\nr.db(\"nonExistingDb\").table(\"nonExistingTable\")\n^^^^^^^^^^^^^^^^^^^^^ \n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
//TODO Broken on the server
Frames:
[]
Error:
Table `nonExistingTable` does not exist in:
r.db("d1869ecfd2f2e939f5f9ff18b7293370").table("nonExistingTable")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*/
It('Test backtrace for r.db(dbName).table("nonExistingTable")', function* (done) {
try {
r.nextVarId=1;
yield r.db(dbName).table("nonExistingTable").run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Table `"+dbName+".nonExistingTable` does not exist in:\nr.db(\""+dbName+"\").table(\"nonExistingTable\")\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n") {
done()
}
else {
}
}
})
/*
Frames:
[ { type: 'POS', pos: 0 }, { type: 'POS', pos: 1 } ]
Error:
Expected type NUMBER but found NULL in:
r.db("9a3275b288394920100ca6cd5d9ebc77").table("aaf8fd26eb4093b4bcd1c051acd44b80")
.get(1).do(function(var_1) {
return var_1.add(3)
^^^^^^^^^^^^
})
*/
It('Test backtrace for r.db(dbName).table(tableName).get(1).do(function(x) { return x.add(3) })', function* (done) {
try {
r.nextVarId=1;
yield r.db(dbName).table(tableName).get(1).do(function(x) { return x.add(3) }).run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Expected type NUMBER but found NULL in:\nr.db(\""+dbName+"\").table(\""+tableName+"\")\n .get(1).do(function(var_1) {\n return var_1.add(3)\n ^^^^^^^^^^^^\n })\n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
Frames:
[ 1 ]
Error:
Expected type DATUM but found SELECTION:
SELECTION ON table(0c2967f3799eb2025b4cd92342dfe4a9) in:
r.db("cd911f3c958c1ec7637f7f2dc2827245").table("0c2967f3799eb2025b4cd92342dfe4a9")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.getAll(1, 2, 3).do(function(var_1) {
^^^^^^^^^^^^^^^^
return var_1.add(3)
})
*/
It('Test backtrace for r.db(dbName).table(tableName).getAll(1, 2, 3).do(function(x) { return x.add(3) })', function* (done) {
try {
r.nextVarId=1;
yield r.db(dbName).table(tableName).getAll(1, 2, 3).do(function(x) { return x.add(3) }).run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Expected type DATUM but found SELECTION:\nSELECTION ON table("+tableName+") in:\nr.db(\""+dbName+"\").table(\""+tableName+"\")\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n .getAll(1, 2, 3).do(function(var_1) {\n ^^^^^^^^^^^^^^^^ \n return var_1.add(3)\n })\n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
Frames:
[ 1 ]
Error:
Expected type DATUM but found SELECTION:
SELECTION ON table(2fb59ffdec1b6605369953703547f82d) in:
r.db("52bdcbc788f0c0b00357fa1840f62a81").table("2fb59ffdec1b6605369953703547f82d")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.getAll(1, 2, 3, {
^^^^^^^^^^^^^^^^^^
index: "foo"
^^^^^^^^^^^^
}).do(function(var_1) {
^^
return var_1.add(3)
})
*/
It('Test backtrace for r.db(dbName).table(tableName).getAll(1, 2, 3, { index: "foo"}).do(function(x) { return x.add(3) })', function* (done) {
try {
r.nextVarId=1;
yield r.db(dbName).table(tableName).getAll(1, 2, 3, { index: "foo"}).do(function(x) { return x.add(3) }).run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Expected type DATUM but found SELECTION:\nSELECTION ON table("+tableName+") in:\nr.db(\""+dbName+"\").table(\""+tableName+"\")\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n .getAll(1, 2, 3, {\n ^^^^^^^^^^^^^^^^^^\n index: \"foo\"\n ^^^^^^^^^^^^\n }).do(function(var_1) {\n ^^ \n return var_1.add(3)\n })\n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
Frames:
[ 1 ]
Error:
Expected type DATUM but found TABLE_SLICE:
SELECTION ON table(a163b9372202a469fa7485f6c20b9f4f) in:
r.db("8bd65d3ca931f3587cc5f3acee0e9f6d").table("a163b9372202a469fa7485f6c20b9f4f")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.between(2, 3, {
^^^^^^^^^^^^^^^^
index: "foo"
^^^^^^^^^^^^
}).do(function(var_1) {
^^
return var_1.add(3)
})
*/
It('Test backtrace for r.db(dbName).table(tableName).between(2, 3, { index: "foo"}).do(function(x) { return x.add(3) })', function* (done) {
try {
r.nextVarId=1;
yield r.db(dbName).table(tableName).between(2, 3, { index: "foo"}).do(function(x) { return x.add(3) }).run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Expected type DATUM but found TABLE_SLICE:\nSELECTION ON table("+tableName+") in:\nr.db(\""+dbName+"\").table(\""+tableName+"\")\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n .between(2, 3, {\n ^^^^^^^^^^^^^^^^\n index: \"foo\"\n ^^^^^^^^^^^^\n }).do(function(var_1) {\n ^^ \n return var_1.add(3)\n })\n") {
done()
}
else {
done(e);
}
}
})
/*
Frames:
[ 1 ]
Error:
Expected type DATUM but found SELECTION:
SELECTION ON table(775cb364800937836f7ecaafc6405cf0) in:
r.db("39ae0baa00e8cb2da57783c544f569d3").table("775cb364800937836f7ecaafc6405cf0")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.filter({
^^^^^^^^^
foo: "bar"
^^^^^^^^^^
}).do(function(var_1) {
^^
return var_1.add(3)
})
*/
It('Test backtrace for r.db(dbName).table(tableName).filter({foo: "bar"}).do(function(x) { return x.add(3) })', function* (done) {
try {
r.nextVarId=1;
yield r.db(dbName).table(tableName).filter({foo: "bar"}).do(function(x) { return x.add(3) }).run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Expected type DATUM but found SELECTION:\nSELECTION ON table("+tableName+") in:\nr.db(\""+dbName+"\").table(\""+tableName+"\")\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n .filter({\n ^^^^^^^^^\n foo: \"bar\"\n ^^^^^^^^^^\n }).do(function(var_1) {\n ^^ \n return var_1.add(3)\n })\n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
Frames:
[ { type: 'POS', pos: 1 } ]
Error:
Expected type SEQUENCE but found FUNCTION:
VALUE FUNCTION in:
r.expr([1, 2, 3]).innerJoin(function(var_1, var_2) {
^^^^^^^^^^^^^^^^^^^^^^^^
return var_1.eq(var_2("bar").add(1))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
}, r.db("3fdf480de398b8b0c5dee11b4594a38d").table("5f728046b728da8d63ace65a40aca6a6"))
^
*/
It('Test backtrace for r.expr([1,2,3]).innerJoin( function(left, right) { return left.eq(right("bar").add(1)) }, r.db(dbName).table(tableName))', function* (done) {
try {
r.nextVarId=1;
yield r.expr([1,2,3]).innerJoin( function(left, right) { return left.eq(right("bar").add(1)) }, r.db(dbName).table(tableName)).run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Expected type SEQUENCE but found FUNCTION:\nVALUE FUNCTION in:\nr.expr([1, 2, 3]).innerJoin(function(var_1, var_2) {\n ^^^^^^^^^^^^^^^^^^^^^^^^\n return var_1.eq(var_2(\"bar\").add(1))\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n}, r.db(\""+dbName+"\").table(\""+tableName+"\"))\n^ \n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
Frames:
[ { type: 'POS', pos: 2 },
{ type: 'POS', pos: 1 },
{ type: 'POS', pos: 0 } ]
Error:
Expected type NUMBER but found STRING in:
r.expr([1, 2, 3]).innerJoin([1, 2, 3], function(var_1, var_2) {
return r.expr(1).add("str").add(var_1.eq(var_2("bar").add(1)))
^^^^^^^^^^^^^^^^^^^^
})
*/
It('Test backtrace for r.expr([1,2,3]).innerJoin(r.expr([1,2,3]), function(left, right) { return r.expr(1).add("str").add(left.eq(right("bar").add(1))) })', function* (done) {
try {
r.nextVarId=1;
yield r.expr([1,2,3]).innerJoin(r.expr([1,2,3]), function(left, right) { return r.expr(1).add("str").add(left.eq(right("bar").add(1))) }).run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Expected type NUMBER but found STRING in:\nr.expr([1, 2, 3]).innerJoin([1, 2, 3], function(var_1, var_2) {\n return r.expr(1).add(\"str\").add(var_1.eq(var_2(\"bar\").add(1)))\n ^^^^^^^^^^^^^^^^^^^^ \n})\n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
Frames:
[ { type: 'POS', pos: 1 } ]
Error:
Expected type SEQUENCE but found FUNCTION:
VALUE FUNCTION in:
r.expr([1, 2, 3]).outerJoin(function(var_1, var_2) {
^^^^^^^^^^^^^^^^^^^^^^^^
return var_1.eq(var_2("bar").add(1))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
}, r.db("5f21a25338fff022c0f698f8681c03c0").table("1653b107790bf38e48448f3db99ab776"))
^
*/
It('Test backtrace for r.expr([1,2,3]).outerJoin( function(left, right) { return left.eq(right("bar").add(1)) }, r.db(dbName).table(tableName))', function* (done) {
try {
r.nextVarId=1;
yield r.expr([1,2,3]).outerJoin( function(left, right) { return left.eq(right("bar").add(1)) }, r.db(dbName).table(tableName)).run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Expected type SEQUENCE but found FUNCTION:\nVALUE FUNCTION in:\nr.expr([1, 2, 3]).outerJoin(function(var_1, var_2) {\n ^^^^^^^^^^^^^^^^^^^^^^^^\n return var_1.eq(var_2(\"bar\").add(1))\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n}, r.db(\""+dbName+"\").table(\""+tableName+"\"))\n^ \n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
Frames:
[ { type: 'POS', pos: 0 }, { type: 'POS', pos: 1 } ]
Error:
Cannot perform get_field on a non-object non-sequence `1` in:
r.expr([1, 2, 3]).eqJoin("id", r.db("5500af7b5c2c94b2672a5f0029512757").table("85bbcc72331aa82bfe0306204997613e"))
^^^^
.add(1)
*/
It('Test backtrace for r.expr([1,2,3]).eqJoin("id", r.db(dbName).table(tableName)).add(1)', function* (done) {
try {
r.nextVarId=1;
yield r.expr([1,2,3]).eqJoin("id", r.db(dbName).table(tableName)).add(1).run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Cannot perform get_field on a non-object non-sequence `1` in:\nr.expr([1, 2, 3]).eqJoin(\"id\", r.db(\""+dbName+"\").table(\""+tableName+"\"))\n ^^^^ \n .add(1)\n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
Frames:
[ { type: 'POS', pos: 0 },
{ type: 'POS', pos: 0 },
{ type: 'POS', pos: 1 } ]
Error:
Cannot perform get_field on a non-object non-sequence `1` in:
r.expr([1, 2, 3]).eqJoin("id", r.db("2c1030e5160e4af3bb19923d43fe7d6c").table("8895da1f043cb7443f322ce849d7fced"))
^^^^
.zip().add(1)
*/
It('Test backtrace for r.expr([1,2,3]).eqJoin("id", r.db(dbName).table(tableName)).zip().add(1)', function* (done) {
try {
r.nextVarId=1;
yield r.expr([1,2,3]).eqJoin("id", r.db(dbName).table(tableName)).zip().add(1).run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Cannot perform get_field on a non-object non-sequence `1` in:\nr.expr([1, 2, 3]).eqJoin(\"id\", r.db(\""+dbName+"\").table(\""+tableName+"\"))\n ^^^^ \n .zip().add(1)\n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
Frames:
[]
Error:
Expected type ARRAY but found NUMBER in:
r.expr([1, 2, 3]).map(function(var_1) {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
return var_1
^^^^^^^^^^^^
}).add(1)
^^^^^^^^^
*/
It('Test backtrace for r.expr([1,2,3]).map(function(v) { return v}).add(1)', function* (done) {
try {
r.nextVarId=1;
yield r.expr([1,2,3]).map(function(v) { return v}).add(1).run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Expected type ARRAY but found NUMBER in:\nr.expr([1, 2, 3]).map(function(var_1) {\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n return var_1\n ^^^^^^^^^^^^\n}).add(1)\n^^^^^^^^^\n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
Frames:
[ { type: 'POS', pos: 0 } ]
Error:
Cannot perform has_fields on a non-object non-sequence `1` in:
r.expr([1, 2, 3]).withFields("foo", "bar").add(1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*/
It('Test backtrace for r.expr([1,2,3]).withFields("foo", "bar").add(1)', function* (done) {
try {
r.nextVarId=1;
yield r.expr([1,2,3]).withFields("foo", "bar").add(1).run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Cannot perform has_fields on a non-object non-sequence `1` in:\nr.expr([1, 2, 3]).withFields(\"foo\", \"bar\").add(1)\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
Frames:
[ 0, 1 ]
Error:
Cannot convert NUMBER to SEQUENCE in:
r.expr([1, 2, 3]).concatMap(function(var_1) {
^^^^^^^^^^^^^^^^^
return var_1
^^^^^^^^^^^^
}).add(1)
^
*/
It('Test backtrace for r.expr([1,2,3]).concatMap(function(v) { return v}).add(1)', function* (done) {
try {
r.nextVarId=1;
yield r.expr([1,2,3]).concatMap(function(v) { return v}).add(1).run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Cannot convert NUMBER to SEQUENCE in:\nr.expr([1, 2, 3]).concatMap(function(var_1) {\n ^^^^^^^^^^^^^^^^^\n return var_1\n ^^^^^^^^^^^^\n}).add(1)\n^ \n") {
done()
}
else {
done(e);
}
}
})
/*
Frames:
[ { type: 'POS', pos: 0 }, { type: 'POS', pos: 1 } ]
Error:
Cannot perform get_field on a non-object non-sequence `2` in:
r.expr([1, 2, 3]).orderBy("foo").add(1)
^^^^^
*/
It('Test backtrace for r.expr([1,2,3]).orderBy("foo").add(1)', function* (done) {
try {
r.nextVarId=1;
yield r.expr([1,2,3]).orderBy("foo").add(1).run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Cannot perform get_field on a non-object non-sequence `2` in:\nr.expr([1, 2, 3]).orderBy(\"foo\").add(1)\n ^^^^^ \n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
Frames:
[ { type: 'POS', pos: 0 }, { type: 'POS', pos: 1 } ]
Error:
Expected type NUMBER but found STRING in:
r.expr([1, 2, 3]).skip("foo").add(1)
^^^^^
*/
It('Test backtrace for r.expr([1,2,3]).skip("foo").add(1)', function* (done) {
try {
r.nextVarId=1;
yield r.expr([1,2,3]).skip("foo").add(1).run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Expected type NUMBER but found STRING in:\nr.expr([1, 2, 3]).skip(\"foo\").add(1)\n ^^^^^ \n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
Frames:
[ { type: 'POS', pos: 0 }, { type: 'POS', pos: 1 } ]
Error:
Expected type NUMBER but found STRING in:
r.expr([1, 2, 3]).limit("foo").add(1)
^^^^^
*/
It('Test backtrace for r.expr([1,2,3]).limit("foo").add(1)', function* (done) {
try {
r.nextVarId=1;
yield r.expr([1,2,3]).limit("foo").add(1).run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Expected type NUMBER but found STRING in:\nr.expr([1, 2, 3]).limit(\"foo\").add(1)\n ^^^^^ \n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
Frames:
[ { type: 'POS', pos: 0 }, { type: 'POS', pos: 1 } ]
Error:
Expected type NUMBER but found STRING in:
r.expr([1, 2, 3]).slice("foo", "bar").add(1)
^^^^^
*/
It('Test backtrace for r.expr([1,2,3]).slice("foo", "bar").add(1)', function* (done) {
try {
r.nextVarId=1;
yield r.expr([1,2,3]).slice("foo", "bar").add(1).run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Expected type NUMBER but found STRING in:\nr.expr([1, 2, 3]).slice(\"foo\", \"bar\").add(1)\n ^^^^^ \n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
Frames:
[ { type: 'POS', pos: 0 }, { type: 'POS', pos: 1 } ]
Error:
Expected type NUMBER but found STRING in:
r.expr([1, 2, 3]).nth("bar").add(1)
^^^^^
*/
It('Test backtrace for r.expr([1,2,3]).nth("bar").add(1)', function* (done) {
try {
r.nextVarId=1;
yield r.expr([1,2,3]).nth("bar").add(1).run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Expected type NUMBER but found STRING in:\nr.expr([1, 2, 3]).nth(\"bar\").add(1)\n ^^^^^ \n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
Frames:
[]
Error:
Expected type ARRAY but found STRING in:
r.expr([1, 2, 3]).offsetsOf("bar").add("Hello")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*/
It('Test backtrace for r.expr([1, 2, 3]).offsetsOf("bar").add("Hello")', function* (done) {
try {
r.nextVarId=1;
yield r.expr([1, 2, 3]).offsetsOf("bar").add("Hello").run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Expected type ARRAY but found STRING in:\nr.expr([1, 2, 3]).offsetsOf(\"bar\").add(\"Hello\")\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n") {
done()
}
else {
done(e);
}
}
})
/*
Frames:
[]
Error:
Expected type NUMBER but found BOOL in:
r.expr([1, 2, 3]).isEmpty().add("Hello")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*/
It('Test backtrace for r.expr([1,2,3]).isEmpty().add("Hello")', function* (done) {
try {
r.nextVarId=1;
yield r.expr([1,2,3]).isEmpty().add("Hello").run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Expected type NUMBER but found BOOL in:\nr.expr([1, 2, 3]).isEmpty().add(\"Hello\")\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
Frames:
[]
Error:
Expected type ARRAY but found STRING in:
r.expr([1, 2, 3]).union([5, 6]).add("Hello")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*/
It('Test backtrace for r.expr([1,2,3]).union([5,6]).add("Hello")', function* (done) {
try {
r.nextVarId=1;
yield r.expr([1,2,3]).union([5,6]).add("Hello").run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Expected type ARRAY but found STRING in:\nr.expr([1, 2, 3]).union([5, 6]).add(\"Hello\")\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
Frames:
[ { type: 'POS', pos: 1 } ]
Error:
Expected type NUMBER but found STRING in:
r.expr([1, 2, 3]).sample("Hello")
^^^^^^^
*/
It('Test backtrace for r.expr([1,2,3]).sample("Hello")', function* (done) {
try {
r.nextVarId=1;
yield r.expr([1,2,3]).sample("Hello").run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Expected type NUMBER but found STRING in:\nr.expr([1, 2, 3]).sample(\"Hello\")\n ^^^^^^^ \n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
Frames:
[]
Error:
Expected type NUMBER but found STRING in:
r.expr([1, 2, 3]).count(function() {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
return true
^^^^^^^^^^^
}).add("Hello")
^^^^^^^^^^^^^^^
*/
It('Test backtrace for r.expr([1,2,3]).count(function() { return true}).add("Hello")', function* (done) {
try {
r.nextVarId=1;
yield r.expr([1,2,3]).count(function() { return true}).add("Hello").run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Expected type NUMBER but found STRING in:\nr.expr([1, 2, 3]).count(function() {\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n return true\n ^^^^^^^^^^^\n}).add(\"Hello\")\n^^^^^^^^^^^^^^^\n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
Frames:
[]
Error:
Expected type ARRAY but found STRING in:
r.expr([1, 2, 3]).distinct().add("Hello")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*/
It('Test backtrace for r.expr([1,2,3]).distinct().add("Hello")', function* (done) {
try {
r.nextVarId=1;
yield r.expr([1,2,3]).distinct().add("Hello").run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Expected type ARRAY but found STRING in:\nr.expr([1, 2, 3]).distinct().add(\"Hello\")\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
Frames:
[]
Error:
Expected type NUMBER but found BOOL in:
r.expr([1, 2, 3]).contains("foo", "bar").add("Hello")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*/
It('Test backtrace for r.expr([1,2,3]).contains("foo", "bar").add("Hello")', function* (done) {
try {
r.nextVarId=1;
yield r.expr([1,2,3]).contains("foo", "bar").add("Hello").run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Expected type NUMBER but found BOOL in:\nr.expr([1, 2, 3]).contains(\"foo\", \"bar\").add(\"Hello\")\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
Frames:
[ 0, 0 ]
Error:
Expected type SELECTION but found DATUM:
[
1,
2,
3
] in:
r.expr([1, 2, 3]).update(r.row("foo")).add("Hello")
^^^^^^^^^^^^^^^^^
*/
It('Test backtrace for r.expr([1,2,3]).update(r.row("foo")).add("Hello")', function* (done) {
try {
r.nextVarId=1;
yield r.expr([1,2,3]).update(r.row("foo")).add("Hello").run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Expected type SELECTION but found DATUM:\n[\n\t1,\n\t2,\n\t3\n] in:\nr.expr([1, 2, 3]).update(r.row(\"foo\")).add(\"Hello\")\n^^^^^^^^^^^^^^^^^ \n") {
done()
}
else {
done(e);
}
}
})
/*
Frames:
[ { type: 'POS', pos: 0 } ]
Error:
Cannot perform pluck on a non-object non-sequence `1` in:
r.expr([1, 2, 3]).pluck("foo").add("Hello")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*/
It('Test backtrace for r.expr([1,2,3]).pluck("foo").add("Hello")', function* (done) {
try {
r.nextVarId=1;
yield r.expr([1,2,3]).pluck("foo").add("Hello").run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Cannot perform pluck on a non-object non-sequence `1` in:\nr.expr([1, 2, 3]).pluck(\"foo\").add(\"Hello\")\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
Frames:
[ { type: 'POS', pos: 0 } ]
Error:
Cannot perform without on a non-object non-sequence `1` in:
r.expr([1, 2, 3]).without("foo").add("Hello")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*/
It('Test backtrace for r.expr([1,2,3]).without("foo").add("Hello")', function* (done) {
try {
r.nextVarId=1;
yield r.expr([1,2,3]).without("foo").add("Hello").run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Cannot perform without on a non-object non-sequence `1` in:\nr.expr([1, 2, 3]).without(\"foo\").add(\"Hello\")\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
Frames:
[ { type: 'POS', pos: 0 } ]
Error:
Cannot perform merge on a non-object non-sequence `1` in:
r.expr([1, 2, 3]).merge("foo").add("Hello")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*/
It('Test backtrace for r.expr([1,2,3]).merge("foo").add("Hello")', function* (done) {
try {
r.nextVarId=1;
yield r.expr([1,2,3]).merge("foo").add("Hello").run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Cannot perform merge on a non-object non-sequence `1` in:\nr.expr([1, 2, 3]).merge(\"foo\").add(\"Hello\")\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
Frames:
[]
Error:
Expected type ARRAY but found STRING in:
r.expr([1, 2, 3]).append("foo").add("Hello")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*/
It('Test backtrace for r.expr([1,2,3]).append("foo").add("Hello")', function* (done) {
try {
r.nextVarId=1;
yield r.expr([1,2,3]).append("foo").add("Hello").run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Expected type ARRAY but found STRING in:\nr.expr([1, 2, 3]).append(\"foo\").add(\"Hello\")\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
Frames:
[]
Error:
Expected type ARRAY but found STRING in:
r.expr([1, 2, 3]).prepend("foo").add("Hello")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*/
It('Test backtrace for r.expr([1,2,3]).prepend("foo").add("Hello")', function* (done) {
try {
r.nextVarId=1;
yield r.expr([1,2,3]).prepend("foo").add("Hello").run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Expected type ARRAY but found STRING in:\nr.expr([1, 2, 3]).prepend(\"foo\").add(\"Hello\")\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
Frames:
[ { type: 'POS', pos: 0 } ]
Error:
Cannot convert STRING to SEQUENCE in:
r.expr([1, 2, 3]).difference("foo").add("Hello")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*/
It('Test backtrace for r.expr([1,2,3]).difference("foo").add("Hello")', function* (done) {
try {
r.nextVarId=1;
yield r.expr([1,2,3]).difference("foo").add("Hello").run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Cannot convert STRING to SEQUENCE in:\nr.expr([1, 2, 3]).difference(\"foo\").add(\"Hello\")\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
Frames:
[]
Error:
Expected type ARRAY but found STRING in:
r.expr([1, 2, 3]).setInsert("foo").add("Hello")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*/
It('Test backtrace for r.expr([1,2,3]).setInsert("foo").add("Hello")', function* (done) {
try {
r.nextVarId=1;
yield r.expr([1,2,3]).setInsert("foo").add("Hello").run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Expected type ARRAY but found STRING in:\nr.expr([1, 2, 3]).setInsert(\"foo\").add(\"Hello\")\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
Frames:
[ { type: 'POS', pos: 0 } ]
Error:
Expected type ARRAY but found STRING in:
r.expr([1, 2, 3]).setUnion("foo").add("Hello")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*/
It('Test backtrace for r.expr([1,2,3]).setUnion("foo").add("Hello")', function* (done) {
try {
r.nextVarId=1;
yield r.expr([1,2,3]).setUnion("foo").add("Hello").run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Expected type ARRAY but found STRING in:\nr.expr([1, 2, 3]).setUnion(\"foo\").add(\"Hello\")\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
Frames:
[ { type: 'POS', pos: 0 } ]
Error:
Expected type ARRAY but found STRING in:
r.expr([1, 2, 3]).setIntersection("foo").add("Hello")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*/
It('Test backtrace for r.expr([1,2,3]).setIntersection("foo").add("Hello")', function* (done) {
try {
r.nextVarId=1;
yield r.expr([1,2,3]).setIntersection("foo").add("Hello").run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Expected type ARRAY but found STRING in:\nr.expr([1, 2, 3]).setIntersection(\"foo\").add(\"Hello\")\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n") {
done()
}
else {
console.log(e.message); done(e);
}
}
})
/*
Frames:
[ 0 ]
Error:
Cannot perform bracket on a non-object non-sequence `1` in:
r.expr([1, 2, 3])("foo").add("Hello")
^^^^^^^^^^^^^^^^^^^^^^^^
*/
It('Test backtrace for r.expr([1, 2, 3])("foo").add("Hello")', function* (done) {
try {
r.nextVarId=1;
yield r.expr([1, 2, 3])("foo").add("Hello").run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Cannot perform bracket on a non-object non-sequence `1` in:\nr.expr([1, 2, 3])(\"foo\").add(\"Hello\")\n^^^^^^^^^^^^^^^^^^^^^^^^ \n") {
done()
}
else {
done(e);
}
}
})
/*
Frames:
[ { type: 'POS', pos: 0 } ]
Error:
Cannot perform has_fields on a non-object non-sequence `1` in:
r.expr([1, 2, 3]).hasFields("foo").add("Hello")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*/
It('Test backtrace for r.expr([1,2,3]).hasFields("foo").add("Hello")', function* (done) {
try {
r.nextVarId=1;
yield r.expr([1,2,3]).hasFields("foo").add("Hello").run()
done(new Error("Should have thrown an error"))
}
catch(e) {
if (e.message === "Cannot perform has_fields on a non-object non-sequence `1` in:\nr.expr([1, 2, 3]).hasFields(\"foo\").add(\"Hello\")\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n") {
done()