func (suite *MetaCompositeSuite) TestCases() { suite.T().Log("Running MetaCompositeSuite: Tests meta operations in composite queries") { // meta/composite.py.yaml line #4 /* ({'dbs_created':3,'config_changes':arrlen(3)}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"dbs_created": 3, "config_changes": arrlen(3)} /* r.expr([1,2,3]).for_each(r.db_create('db_' + r.row.coerce_to('string'))) */ suite.T().Log("About to run line #4: r.Expr([]interface{}{1, 2, 3}).ForEach(r.DBCreate(r.Add('db_', r.Row.CoerceTo('string'))))") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).ForEach(r.DBCreate(r.Add("db_", r.Row.CoerceTo("string")))), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #4") } { // meta/composite.py.yaml line #8 /* partial({'tables_created':9}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 9}) /* r.db_list().set_difference(["rethinkdb", "test"]).for_each(lambda db_name: r.expr([1,2,3]).for_each(lambda i: r.db(db_name).table_create('tbl_' + i.coerce_to('string')))) */ suite.T().Log("About to run line #8: r.DBList().SetDifference([]interface{}{'rethinkdb', 'test'}).ForEach(func(db_name r.Term) interface{} { return r.Expr([]interface{}{1, 2, 3}).ForEach(func(i r.Term) interface{} { return r.DB(db_name).TableCreate(r.Add('tbl_', i.CoerceTo('string')))})})") runAndAssert(suite.Suite, expected_, r.DBList().SetDifference([]interface{}{"rethinkdb", "test"}).ForEach(func(db_name r.Term) interface{} { return r.Expr([]interface{}{1, 2, 3}).ForEach(func(i r.Term) interface{} { return r.DB(db_name).TableCreate(r.Add("tbl_", i.CoerceTo("string"))) }) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #8") } { // meta/composite.py.yaml line #13 /* partial({'dbs_dropped':3,'tables_dropped':9}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"dbs_dropped": 3, "tables_dropped": 9}) /* r.db_list().set_difference(["rethinkdb", "test"]).for_each(r.db_drop(r.row)) */ suite.T().Log("About to run line #13: r.DBList().SetDifference([]interface{}{'rethinkdb', 'test'}).ForEach(r.DBDrop(r.Row))") runAndAssert(suite.Suite, expected_, r.DBList().SetDifference([]interface{}{"rethinkdb", "test"}).ForEach(r.DBDrop(r.Row)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #13") } }
func (suite *JoinsSuite) TestCases() { suite.T().Log("Running JoinsSuite: Tests that manipulation data in tables") messages := r.DB("test").Table("messages") _ = messages // Prevent any noused variable errors otbl := r.DB("test").Table("otbl") _ = otbl // Prevent any noused variable errors otbl2 := r.DB("test").Table("otbl2") _ = otbl2 // Prevent any noused variable errors receivers := r.DB("test").Table("receivers") _ = receivers // Prevent any noused variable errors senders := r.DB("test").Table("senders") _ = senders // Prevent any noused variable errors tbl := r.DB("test").Table("tbl") _ = tbl // Prevent any noused variable errors tbl2 := r.DB("test").Table("tbl2") _ = tbl2 // Prevent any noused variable errors { // joins.yaml line #7 /* partial({'tables_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) /* r.db('test').table_create('test3', primary_key='foo') */ suite.T().Log("About to run line #7: r.DB('test').TableCreate('test3').OptArgs(r.TableCreateOpts{PrimaryKey: 'foo', })") runAndAssert(suite.Suite, expected_, r.DB("test").TableCreate("test3").OptArgs(r.TableCreateOpts{PrimaryKey: "foo"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #7") } // joins.yaml line #11 // tbl3 = r.db('test').table('test3') suite.T().Log("Possibly executing: var tbl3 r.Term = r.DB('test').Table('test3')") tbl3 := r.DB("test").Table("test3") _ = tbl3 // Prevent any noused variable errors { // joins.yaml line #13 /* partial({'errors':0, 'inserted':100}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "inserted": 100}) /* tbl.insert(r.range(0, 100).map({'id':r.row, 'a':r.row % 4})) */ suite.T().Log("About to run line #13: tbl.Insert(r.Range(0, 100).Map(map[interface{}]interface{}{'id': r.Row, 'a': r.Row.Mod(4), }))") runAndAssert(suite.Suite, expected_, tbl.Insert(r.Range(0, 100).Map(map[interface{}]interface{}{"id": r.Row, "a": r.Row.Mod(4)})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #13") } { // joins.yaml line #18 /* partial({'errors':0, 'inserted':100}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "inserted": 100}) /* tbl2.insert(r.range(0, 100).map({'id':r.row, 'b':r.row % 4})) */ suite.T().Log("About to run line #18: tbl2.Insert(r.Range(0, 100).Map(map[interface{}]interface{}{'id': r.Row, 'b': r.Row.Mod(4), }))") runAndAssert(suite.Suite, expected_, tbl2.Insert(r.Range(0, 100).Map(map[interface{}]interface{}{"id": r.Row, "b": r.Row.Mod(4)})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #18") } { // joins.yaml line #23 /* partial({'errors':0, 'inserted':100}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "inserted": 100}) /* tbl3.insert(r.range(0, 100).map({'foo':r.row, 'b':r.row % 4})) */ suite.T().Log("About to run line #23: tbl3.Insert(r.Range(0, 100).Map(map[interface{}]interface{}{'foo': r.Row, 'b': r.Row.Mod(4), }))") runAndAssert(suite.Suite, expected_, tbl3.Insert(r.Range(0, 100).Map(map[interface{}]interface{}{"foo": r.Row, "b": r.Row.Mod(4)})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #23") } { // joins.yaml line #28 /* AnythingIsFine */ var expected_ string = compare.AnythingIsFine /* otbl.insert(r.range(1,100).map({'id': r.row, 'a': r.row})) */ suite.T().Log("About to run line #28: otbl.Insert(r.Range(1, 100).Map(map[interface{}]interface{}{'id': r.Row, 'a': r.Row, }))") runAndAssert(suite.Suite, expected_, otbl.Insert(r.Range(1, 100).Map(map[interface{}]interface{}{"id": r.Row, "a": r.Row})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #28") } { // joins.yaml line #29 /* AnythingIsFine */ var expected_ string = compare.AnythingIsFine /* otbl2.insert(r.range(1,100).map({'id': r.row, 'b': 2 * r.row})) */ suite.T().Log("About to run line #29: otbl2.Insert(r.Range(1, 100).Map(map[interface{}]interface{}{'id': r.Row, 'b': r.Mul(2, r.Row), }))") runAndAssert(suite.Suite, expected_, otbl2.Insert(r.Range(1, 100).Map(map[interface{}]interface{}{"id": r.Row, "b": r.Mul(2, r.Row)})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #29") } // joins.yaml line #34 // ij = tbl.inner_join(tbl2, lambda x,y:x['a'] == y['b']).zip() suite.T().Log("Possibly executing: var ij r.Term = tbl.InnerJoin(tbl2, func(x r.Term, y r.Term) interface{} { return x.AtIndex('a').Eq(y.AtIndex('b'))}).Zip()") ij := tbl.InnerJoin(tbl2, func(x r.Term, y r.Term) interface{} { return x.AtIndex("a").Eq(y.AtIndex("b")) }).Zip() _ = ij // Prevent any noused variable errors { // joins.yaml line #37 /* 2500 */ var expected_ int = 2500 /* ij.count() */ suite.T().Log("About to run line #37: ij.Count()") runAndAssert(suite.Suite, expected_, ij.Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #37") } { // joins.yaml line #39 /* 0 */ var expected_ int = 0 /* ij.filter(lambda row:row['a'] != row['b']).count() */ suite.T().Log("About to run line #39: ij.Filter(func(row r.Term) interface{} { return row.AtIndex('a').Ne(row.AtIndex('b'))}).Count()") runAndAssert(suite.Suite, expected_, ij.Filter(func(row r.Term) interface{} { return row.AtIndex("a").Ne(row.AtIndex("b")) }).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #39") } // joins.yaml line #46 // oj = tbl.outer_join(tbl2, lambda x,y:x['a'] == y['b']).zip() suite.T().Log("Possibly executing: var oj r.Term = tbl.OuterJoin(tbl2, func(x r.Term, y r.Term) interface{} { return x.AtIndex('a').Eq(y.AtIndex('b'))}).Zip()") oj := tbl.OuterJoin(tbl2, func(x r.Term, y r.Term) interface{} { return x.AtIndex("a").Eq(y.AtIndex("b")) }).Zip() _ = oj // Prevent any noused variable errors { // joins.yaml line #49 /* 2500 */ var expected_ int = 2500 /* oj.count() */ suite.T().Log("About to run line #49: oj.Count()") runAndAssert(suite.Suite, expected_, oj.Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #49") } { // joins.yaml line #51 /* 0 */ var expected_ int = 0 /* oj.filter(lambda row:row['a'] != row['b']).count() */ suite.T().Log("About to run line #51: oj.Filter(func(row r.Term) interface{} { return row.AtIndex('a').Ne(row.AtIndex('b'))}).Count()") runAndAssert(suite.Suite, expected_, oj.Filter(func(row r.Term) interface{} { return row.AtIndex("a").Ne(row.AtIndex("b")) }).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #51") } // joins.yaml line #57 // blah = otbl.order_by("id").eq_join(r.row['id'], otbl2, ordered=True).zip() suite.T().Log("Possibly executing: var blah r.Term = otbl.OrderBy('id').EqJoin(r.Row.AtIndex('id'), otbl2).OptArgs(r.EqJoinOpts{Ordered: true, }).Zip()") blah := maybeRun(otbl.OrderBy("id").EqJoin(r.Row.AtIndex("id"), otbl2).OptArgs(r.EqJoinOpts{Ordered: true}).Zip(), suite.session, r.RunOpts{}) _ = blah // Prevent any noused variable errors // joins.yaml line #59 // blah = otbl.order_by(r.desc("id")).eq_join(r.row['id'], otbl2, ordered=True).zip() suite.T().Log("Possibly executing: var blah r.Term = otbl.OrderBy(r.Desc('id')).EqJoin(r.Row.AtIndex('id'), otbl2).OptArgs(r.EqJoinOpts{Ordered: true, }).Zip()") blah = maybeRun(otbl.OrderBy(r.Desc("id")).EqJoin(r.Row.AtIndex("id"), otbl2).OptArgs(r.EqJoinOpts{Ordered: true}).Zip(), suite.session, r.RunOpts{}) // joins.yaml line #61 // blah = otbl.order_by("id").eq_join(r.row['a'], otbl2, ordered=True).zip() suite.T().Log("Possibly executing: var blah r.Term = otbl.OrderBy('id').EqJoin(r.Row.AtIndex('a'), otbl2).OptArgs(r.EqJoinOpts{Ordered: true, }).Zip()") blah = maybeRun(otbl.OrderBy("id").EqJoin(r.Row.AtIndex("a"), otbl2).OptArgs(r.EqJoinOpts{Ordered: true}).Zip(), suite.session, r.RunOpts{}) { // joins.yaml line #65 /* 100 */ var expected_ int = 100 /* tbl.eq_join('a', tbl2).zip().count() */ suite.T().Log("About to run line #65: tbl.EqJoin('a', tbl2).Zip().Count()") runAndAssert(suite.Suite, expected_, tbl.EqJoin("a", tbl2).Zip().Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #65") } { // joins.yaml line #68 /* 0 */ var expected_ int = 0 /* tbl.eq_join('fake', tbl2).zip().count() */ suite.T().Log("About to run line #68: tbl.EqJoin('fake', tbl2).Zip().Count()") runAndAssert(suite.Suite, expected_, tbl.EqJoin("fake", tbl2).Zip().Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #68") } { // joins.yaml line #71 /* 100 */ var expected_ int = 100 /* tbl.eq_join(lambda x:x['a'], tbl2).zip().count() */ suite.T().Log("About to run line #71: tbl.EqJoin(func(x r.Term) interface{} { return x.AtIndex('a')}, tbl2).Zip().Count()") runAndAssert(suite.Suite, expected_, tbl.EqJoin(func(x r.Term) interface{} { return x.AtIndex("a") }, tbl2).Zip().Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #71") } { // joins.yaml line #76 /* 0 */ var expected_ int = 0 /* tbl.eq_join(lambda x:x['fake'], tbl2).zip().count() */ suite.T().Log("About to run line #76: tbl.EqJoin(func(x r.Term) interface{} { return x.AtIndex('fake')}, tbl2).Zip().Count()") runAndAssert(suite.Suite, expected_, tbl.EqJoin(func(x r.Term) interface{} { return x.AtIndex("fake") }, tbl2).Zip().Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #76") } { // joins.yaml line #81 /* 0 */ var expected_ int = 0 /* tbl.eq_join(lambda x:null, tbl2).zip().count() */ suite.T().Log("About to run line #81: tbl.EqJoin(func(x r.Term) interface{} { return nil}, tbl2).Zip().Count()") runAndAssert(suite.Suite, expected_, tbl.EqJoin(func(x r.Term) interface{} { return nil }, tbl2).Zip().Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #81") } { // joins.yaml line #86 /* 100 */ var expected_ int = 100 /* tbl.eq_join(lambda x:x['a'], tbl2).count() */ suite.T().Log("About to run line #86: tbl.EqJoin(func(x r.Term) interface{} { return x.AtIndex('a')}, tbl2).Count()") runAndAssert(suite.Suite, expected_, tbl.EqJoin(func(x r.Term) interface{} { return x.AtIndex("a") }, tbl2).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #86") } { // joins.yaml line #92 /* 100 */ var expected_ int = 100 /* tbl.eq_join('a', tbl3).zip().count() */ suite.T().Log("About to run line #92: tbl.EqJoin('a', tbl3).Zip().Count()") runAndAssert(suite.Suite, expected_, tbl.EqJoin("a", tbl3).Zip().Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #92") } { // joins.yaml line #95 /* 100 */ var expected_ int = 100 /* tbl.eq_join(lambda x:x['a'], tbl3).count() */ suite.T().Log("About to run line #95: tbl.EqJoin(func(x r.Term) interface{} { return x.AtIndex('a')}, tbl3).Count()") runAndAssert(suite.Suite, expected_, tbl.EqJoin(func(x r.Term) interface{} { return x.AtIndex("a") }, tbl3).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #95") } { // joins.yaml line #101 /* 100 */ var expected_ int = 100 /* tbl.eq_join(r.row['a'], tbl2).count() */ suite.T().Log("About to run line #101: tbl.EqJoin(r.Row.AtIndex('a'), tbl2).Count()") runAndAssert(suite.Suite, expected_, tbl.EqJoin(r.Row.AtIndex("a"), tbl2).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #101") } // joins.yaml line #106 // left = r.expr([{'a':1},{'a':2},{'a':3}]) suite.T().Log("Possibly executing: var left r.Term = r.Expr([]interface{}{map[interface{}]interface{}{'a': 1, }, map[interface{}]interface{}{'a': 2, }, map[interface{}]interface{}{'a': 3, }})") left := r.Expr([]interface{}{map[interface{}]interface{}{"a": 1}, map[interface{}]interface{}{"a": 2}, map[interface{}]interface{}{"a": 3}}) _ = left // Prevent any noused variable errors // joins.yaml line #107 // right = r.expr([{'b':2},{'b':3}]) suite.T().Log("Possibly executing: var right r.Term = r.Expr([]interface{}{map[interface{}]interface{}{'b': 2, }, map[interface{}]interface{}{'b': 3, }})") right := r.Expr([]interface{}{map[interface{}]interface{}{"b": 2}, map[interface{}]interface{}{"b": 3}}) _ = right // Prevent any noused variable errors { // joins.yaml line #109 /* [{'a':2,'b':2},{'a':3,'b':3}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 2, "b": 2}, map[interface{}]interface{}{"a": 3, "b": 3}} /* left.inner_join(right, lambda l, r:l['a'] == r['b']).zip() */ suite.T().Log("About to run line #109: left.InnerJoin(right, func(l r.Term, r r.Term) interface{} { return l.AtIndex('a').Eq(r.AtIndex('b'))}).Zip()") runAndAssert(suite.Suite, expected_, left.InnerJoin(right, func(l r.Term, r r.Term) interface{} { return l.AtIndex("a").Eq(r.AtIndex("b")) }).Zip(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #109") } { // joins.yaml line #115 /* [{'a':1},{'a':2,'b':2},{'a':3,'b':3}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}, map[interface{}]interface{}{"a": 2, "b": 2}, map[interface{}]interface{}{"a": 3, "b": 3}} /* left.outer_join(right, lambda l, r:l['a'] == r['b']).zip() */ suite.T().Log("About to run line #115: left.OuterJoin(right, func(l r.Term, r r.Term) interface{} { return l.AtIndex('a').Eq(r.AtIndex('b'))}).Zip()") runAndAssert(suite.Suite, expected_, left.OuterJoin(right, func(l r.Term, r r.Term) interface{} { return l.AtIndex("a").Eq(r.AtIndex("b")) }).Zip(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #115") } { // joins.yaml line #132 /* partial({'tables_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) /* r.db('test').table_drop('test3') */ suite.T().Log("About to run line #132: r.DB('test').TableDrop('test3')") runAndAssert(suite.Suite, expected_, r.DB("test").TableDrop("test3"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #132") } }
func (suite *MetaTableSuite) TestCases() { suite.T().Log("Running MetaTableSuite: Tests meta queries for creating and deleting tables") // meta/table.yaml line #4 // db = r.db('test') suite.T().Log("Possibly executing: var db r.Term = r.DB('test')") db := r.DB("test") _ = db // Prevent any noused variable errors { // meta/table.yaml line #6 /* [] */ var expected_ []interface{} = []interface{}{} /* db.table_list() */ suite.T().Log("About to run line #6: db.TableList()") runAndAssert(suite.Suite, expected_, db.TableList(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #6") } { // meta/table.yaml line #9 /* ({'type':'DB','name':'rethinkdb','id':null}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"type": "DB", "name": "rethinkdb", "id": nil} /* r.db('rethinkdb').info() */ suite.T().Log("About to run line #9: r.DB('rethinkdb').Info()") runAndAssert(suite.Suite, expected_, r.DB("rethinkdb").Info(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #9") } { // meta/table.yaml line #12 /* partial({'db':{'type':'DB','name':'rethinkdb','id':null}, 'type':'TABLE','id':null,'name':'stats', 'indexes':[],'primary_key':'id'}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"db": map[interface{}]interface{}{"type": "DB", "name": "rethinkdb", "id": nil}, "type": "TABLE", "id": nil, "name": "stats", "indexes": []interface{}{}, "primary_key": "id"}) /* r.db('rethinkdb').table('stats').info() */ suite.T().Log("About to run line #12: r.DB('rethinkdb').Table('stats').Info()") runAndAssert(suite.Suite, expected_, r.DB("rethinkdb").Table("stats").Info(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #12") } { // meta/table.yaml line #18 /* partial({'tables_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) /* db.table_create('a') */ suite.T().Log("About to run line #18: db.TableCreate('a')") runAndAssert(suite.Suite, expected_, db.TableCreate("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #18") } { // meta/table.yaml line #21 /* ['a'] */ var expected_ []interface{} = []interface{}{"a"} /* db.table_list() */ suite.T().Log("About to run line #21: db.TableList()") runAndAssert(suite.Suite, expected_, db.TableList(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #21") } { // meta/table.yaml line #24 /* partial({'tables_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) /* db.table_create('b') */ suite.T().Log("About to run line #24: db.TableCreate('b')") runAndAssert(suite.Suite, expected_, db.TableCreate("b"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #24") } { // meta/table.yaml line #27 /* bag(['a', 'b']) */ var expected_ compare.Expected = compare.UnorderedMatch([]interface{}{"a", "b"}) /* db.table_list() */ suite.T().Log("About to run line #27: db.TableList()") runAndAssert(suite.Suite, expected_, db.TableList(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #27") } { // meta/table.yaml line #31 /* partial({'tables_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) /* db.table_drop('a') */ suite.T().Log("About to run line #31: db.TableDrop('a')") runAndAssert(suite.Suite, expected_, db.TableDrop("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #31") } { // meta/table.yaml line #34 /* ['b'] */ var expected_ []interface{} = []interface{}{"b"} /* db.table_list() */ suite.T().Log("About to run line #34: db.TableList()") runAndAssert(suite.Suite, expected_, db.TableList(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #34") } { // meta/table.yaml line #37 /* partial({'tables_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) /* db.table_drop('b') */ suite.T().Log("About to run line #37: db.TableDrop('b')") runAndAssert(suite.Suite, expected_, db.TableDrop("b"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #37") } { // meta/table.yaml line #40 /* [] */ var expected_ []interface{} = []interface{}{} /* db.table_list() */ suite.T().Log("About to run line #40: db.TableList()") runAndAssert(suite.Suite, expected_, db.TableList(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #40") } { // meta/table.yaml line #44 /* partial({'tables_created':1,'config_changes':[partial({'new_val':partial({'durability':'soft'})})]}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1, "config_changes": []interface{}{compare.PartialMatch(map[interface{}]interface{}{"new_val": compare.PartialMatch(map[interface{}]interface{}{"durability": "soft"})})}}) /* db.table_create('ab', durability='soft') */ suite.T().Log("About to run line #44: db.TableCreate('ab').OptArgs(r.TableCreateOpts{Durability: 'soft', })") runAndAssert(suite.Suite, expected_, db.TableCreate("ab").OptArgs(r.TableCreateOpts{Durability: "soft"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #44") } { // meta/table.yaml line #49 /* partial({'tables_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) /* db.table_drop('ab') */ suite.T().Log("About to run line #49: db.TableDrop('ab')") runAndAssert(suite.Suite, expected_, db.TableDrop("ab"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #49") } { // meta/table.yaml line #52 /* partial({'tables_created':1,'config_changes':[partial({'new_val':partial({'durability':'hard'})})]}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1, "config_changes": []interface{}{compare.PartialMatch(map[interface{}]interface{}{"new_val": compare.PartialMatch(map[interface{}]interface{}{"durability": "hard"})})}}) /* db.table_create('ab', durability='hard') */ suite.T().Log("About to run line #52: db.TableCreate('ab').OptArgs(r.TableCreateOpts{Durability: 'hard', })") runAndAssert(suite.Suite, expected_, db.TableCreate("ab").OptArgs(r.TableCreateOpts{Durability: "hard"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #52") } { // meta/table.yaml line #57 /* partial({'tables_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) /* db.table_drop('ab') */ suite.T().Log("About to run line #57: db.TableDrop('ab')") runAndAssert(suite.Suite, expected_, db.TableDrop("ab"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #57") } { // meta/table.yaml line #60 /* err('ReqlQueryLogicError', 'Durability option `fake` unrecognized (options are "hard" and "soft").') */ var expected_ Err = err("ReqlQueryLogicError", "Durability option `fake` unrecognized (options are \"hard\" and \"soft\").") /* db.table_create('ab', durability='fake') */ suite.T().Log("About to run line #60: db.TableCreate('ab').OptArgs(r.TableCreateOpts{Durability: 'fake', })") runAndAssert(suite.Suite, expected_, db.TableCreate("ab").OptArgs(r.TableCreateOpts{Durability: "fake"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #60") } { // meta/table.yaml line #65 /* partial({'tables_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) /* db.table_create('ab', primary_key='bar', shards=2, replicas=1) */ suite.T().Log("About to run line #65: db.TableCreate('ab').OptArgs(r.TableCreateOpts{PrimaryKey: 'bar', Shards: 2, Replicas: 1, })") runAndAssert(suite.Suite, expected_, db.TableCreate("ab").OptArgs(r.TableCreateOpts{PrimaryKey: "bar", Shards: 2, Replicas: 1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #65") } { // meta/table.yaml line #70 /* partial({'tables_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) /* db.table_drop('ab') */ suite.T().Log("About to run line #70: db.TableDrop('ab')") runAndAssert(suite.Suite, expected_, db.TableDrop("ab"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #70") } { // meta/table.yaml line #73 /* partial({'tables_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) /* db.table_create('ab', primary_key='bar', primary_replica_tag='default') */ suite.T().Log("About to run line #73: db.TableCreate('ab').OptArgs(r.TableCreateOpts{PrimaryKey: 'bar', PrimaryReplicaTag: 'default', })") runAndAssert(suite.Suite, expected_, db.TableCreate("ab").OptArgs(r.TableCreateOpts{PrimaryKey: "bar", PrimaryReplicaTag: "default"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #73") } { // meta/table.yaml line #78 /* partial({'tables_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) /* db.table_drop('ab') */ suite.T().Log("About to run line #78: db.TableDrop('ab')") runAndAssert(suite.Suite, expected_, db.TableDrop("ab"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #78") } { // meta/table.yaml line #81 /* partial({'tables_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) /* db.table_create('ab', nonvoting_replica_tags=['default']) */ suite.T().Log("About to run line #81: db.TableCreate('ab').OptArgs(r.TableCreateOpts{NonVotingReplicaTags: []interface{}{'default'}, })") runAndAssert(suite.Suite, expected_, db.TableCreate("ab").OptArgs(r.TableCreateOpts{NonVotingReplicaTags: []interface{}{"default"}}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #81") } { // meta/table.yaml line #86 /* partial({'tables_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) /* db.table_drop('ab') */ suite.T().Log("About to run line #86: db.TableDrop('ab')") runAndAssert(suite.Suite, expected_, db.TableDrop("ab"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #86") } { // meta/table.yaml line #90 /* partial({'tables_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) /* db.table_create('a') */ suite.T().Log("About to run line #90: db.TableCreate('a')") runAndAssert(suite.Suite, expected_, db.TableCreate("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #90") } { // meta/table.yaml line #93 /* partial({'reconfigured':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"reconfigured": 1}) /* db.table('a').reconfigure(shards=1, replicas=1) */ suite.T().Log("About to run line #93: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 1, })") runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #93") } { // meta/table.yaml line #98 /* partial({'reconfigured':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"reconfigured": 1}) /* db.table('a').reconfigure(shards=1, replicas={"default":1}, nonvoting_replica_tags=['default'], primary_replica_tag='default') */ suite.T().Log("About to run line #98: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{'default': 1, }, NonVotingReplicaTags: []interface{}{'default'}, PrimaryReplicaTag: 'default', })") runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{"default": 1}, NonVotingReplicaTags: []interface{}{"default"}, PrimaryReplicaTag: "default"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #98") } { // meta/table.yaml line #103 /* partial({'reconfigured':0}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"reconfigured": 0}) /* db.table('a').reconfigure(shards=1, replicas=1, dry_run=True) */ suite.T().Log("About to run line #103: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 1, DryRun: true, })") runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 1, DryRun: true}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #103") } { // meta/table.yaml line #108 /* err('ReqlOpFailedError', 'This table doesn\'t need to be repaired.', []) */ var expected_ Err = err("ReqlOpFailedError", "This table doesn't need to be repaired.") /* db.table('a').reconfigure(emergency_repair="unsafe_rollback") */ suite.T().Log("About to run line #108: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: 'unsafe_rollback', })") runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: "unsafe_rollback"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #108") } { // meta/table.yaml line #113 /* err('ReqlOpFailedError', 'This table doesn\'t need to be repaired.', []) */ var expected_ Err = err("ReqlOpFailedError", "This table doesn't need to be repaired.") /* db.table('a').reconfigure(emergency_repair="unsafe_rollback", dry_run=True) */ suite.T().Log("About to run line #113: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: 'unsafe_rollback', DryRun: true, })") runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: "unsafe_rollback", DryRun: true}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #113") } { // meta/table.yaml line #118 /* err('ReqlOpFailedError', 'This table doesn\'t need to be repaired.', []) */ var expected_ Err = err("ReqlOpFailedError", "This table doesn't need to be repaired.") /* db.table('a').reconfigure(emergency_repair="unsafe_rollback_or_erase") */ suite.T().Log("About to run line #118: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: 'unsafe_rollback_or_erase', })") runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: "unsafe_rollback_or_erase"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #118") } { // meta/table.yaml line #123 /* partial({'reconfigured':0}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"reconfigured": 0}) /* db.table('a').reconfigure(emergency_repair=None, shards=1, replicas=1, dry_run=True) */ suite.T().Log("About to run line #123: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: nil, Shards: 1, Replicas: 1, DryRun: true, })") runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: nil, Shards: 1, Replicas: 1, DryRun: true}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #123") } { // meta/table.yaml line #128 /* partial({'tables_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) /* db.table_drop('a') */ suite.T().Log("About to run line #128: db.TableDrop('a')") runAndAssert(suite.Suite, expected_, db.TableDrop("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #128") } { // meta/table.yaml line #132 /* partial({'tables_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) /* db.table_create('foo') */ suite.T().Log("About to run line #132: db.TableCreate('foo')") runAndAssert(suite.Suite, expected_, db.TableCreate("foo"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #132") } { // meta/table.yaml line #135 /* err('ReqlOpFailedError', 'Table `test.foo` already exists.', [0]) */ var expected_ Err = err("ReqlOpFailedError", "Table `test.foo` already exists.") /* db.table_create('foo') */ suite.T().Log("About to run line #135: db.TableCreate('foo')") runAndAssert(suite.Suite, expected_, db.TableCreate("foo"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #135") } { // meta/table.yaml line #138 /* partial({'tables_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) /* db.table_drop('foo') */ suite.T().Log("About to run line #138: db.TableDrop('foo')") runAndAssert(suite.Suite, expected_, db.TableDrop("foo"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #138") } { // meta/table.yaml line #141 /* err('ReqlOpFailedError', 'Table `test.foo` does not exist.', [0]) */ var expected_ Err = err("ReqlOpFailedError", "Table `test.foo` does not exist.") /* db.table_drop('foo') */ suite.T().Log("About to run line #141: db.TableDrop('foo')") runAndAssert(suite.Suite, expected_, db.TableDrop("foo"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #141") } { // meta/table.yaml line #158 /* partial({'tables_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) /* db.table_create('a') */ suite.T().Log("About to run line #158: db.TableCreate('a')") runAndAssert(suite.Suite, expected_, db.TableCreate("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #158") } { // meta/table.yaml line #161 /* err('ReqlQueryLogicError', 'Every table must have at least one shard.', []) */ var expected_ Err = err("ReqlQueryLogicError", "Every table must have at least one shard.") /* db.table('a').reconfigure(shards=0, replicas=1) */ suite.T().Log("About to run line #161: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 0, Replicas: 1, })") runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 0, Replicas: 1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #161") } { // meta/table.yaml line #166 /* err('ReqlOpFailedError', 'Can\'t use server tag `foo` for primary replicas because you specified no replicas in server tag `foo`.', []) */ var expected_ Err = err("ReqlOpFailedError", "Can't use server tag `foo` for primary replicas because you specified no replicas in server tag `foo`.") /* db.table('a').reconfigure(shards=1, replicas={"default":1}, primary_replica_tag="foo") */ suite.T().Log("About to run line #166: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{'default': 1, }, PrimaryReplicaTag: 'foo', })") runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{"default": 1}, PrimaryReplicaTag: "foo"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #166") } { // meta/table.yaml line #171 /* err('ReqlOpFailedError', 'You specified that the replicas in server tag `foo` should be non-voting, but you didn\'t specify a number of replicas in server tag `foo`.', []) */ var expected_ Err = err("ReqlOpFailedError", "You specified that the replicas in server tag `foo` should be non-voting, but you didn't specify a number of replicas in server tag `foo`.") /* db.table('a').reconfigure(shards=1, replicas={"default":1}, primary_replica_tag="default", nonvoting_replica_tags=["foo"]) */ suite.T().Log("About to run line #171: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{'default': 1, }, PrimaryReplicaTag: 'default', NonVotingReplicaTags: []interface{}{'foo'}, })") runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{"default": 1}, PrimaryReplicaTag: "default", NonVotingReplicaTags: []interface{}{"foo"}}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #171") } { // meta/table.yaml line #176 /* err('ReqlOpFailedError', 'You must set `replicas` to at least one. `replicas` includes the primary replica; if there are zero replicas, there is nowhere to put the data.', []) */ var expected_ Err = err("ReqlOpFailedError", "You must set `replicas` to at least one. `replicas` includes the primary replica; if there are zero replicas, there is nowhere to put the data.") /* db.table('a').reconfigure(shards=1, replicas={"foo":0}, primary_replica_tag="foo") */ suite.T().Log("About to run line #176: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{'foo': 0, }, PrimaryReplicaTag: 'foo', })") runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{"foo": 0}, PrimaryReplicaTag: "foo"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #176") } { // meta/table.yaml line #181 /* err('ReqlQueryLogicError', '`primary_replica_tag` must be specified when `replicas` is an OBJECT.', []) */ var expected_ Err = err("ReqlQueryLogicError", "`primary_replica_tag` must be specified when `replicas` is an OBJECT.") /* db.table('a').reconfigure(shards=1, replicas={"default":0}) */ suite.T().Log("About to run line #181: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{'default': 0, }, })") runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{"default": 0}}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #181") } { // meta/table.yaml line #186 /* err('ReqlQueryLogicError', 'Can\'t have a negative number of replicas', []) */ var expected_ Err = err("ReqlQueryLogicError", "Can't have a negative number of replicas") /* db.table('a').reconfigure(shards=1, replicas={"default":-3}, primary_replica_tag='default') */ suite.T().Log("About to run line #186: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{'default': -3, }, PrimaryReplicaTag: 'default', })") runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{"default": -3}, PrimaryReplicaTag: "default"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #186") } { // meta/table.yaml line #191 /* err('ReqlQueryLogicError', '`replicas` must be an OBJECT if `primary_replica_tag` is specified.', []) */ var expected_ Err = err("ReqlQueryLogicError", "`replicas` must be an OBJECT if `primary_replica_tag` is specified.") /* db.table('a').reconfigure(shards=1, replicas=3, primary_replica_tag='foo') */ suite.T().Log("About to run line #191: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 3, PrimaryReplicaTag: 'foo', })") runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 3, PrimaryReplicaTag: "foo"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #191") } { // meta/table.yaml line #196 /* err('ReqlQueryLogicError', '`replicas` must be an OBJECT if `nonvoting_replica_tags` is specified.', []) */ var expected_ Err = err("ReqlQueryLogicError", "`replicas` must be an OBJECT if `nonvoting_replica_tags` is specified.") /* db.table('a').reconfigure(shards=1, replicas=3, nonvoting_replica_tags=['foo']) */ suite.T().Log("About to run line #196: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 3, NonVotingReplicaTags: []interface{}{'foo'}, })") runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 3, NonVotingReplicaTags: []interface{}{"foo"}}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #196") } { // meta/table.yaml line #201 /* err('ReqlQueryLogicError', 'Can\'t emergency repair an entire database at once; instead you should run `reconfigure()` on each table individually.') */ var expected_ Err = err("ReqlQueryLogicError", "Can't emergency repair an entire database at once; instead you should run `reconfigure()` on each table individually.") /* db.reconfigure(emergency_repair="unsafe_rollback") */ suite.T().Log("About to run line #201: db.Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: 'unsafe_rollback', })") runAndAssert(suite.Suite, expected_, db.Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: "unsafe_rollback"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #201") } { // meta/table.yaml line #206 /* err('ReqlQueryLogicError', '`emergency_repair` should be "unsafe_rollback" or "unsafe_rollback_or_erase"', []) */ var expected_ Err = err("ReqlQueryLogicError", "`emergency_repair` should be \"unsafe_rollback\" or \"unsafe_rollback_or_erase\"") /* db.table('a').reconfigure(emergency_repair="foo") */ suite.T().Log("About to run line #206: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: 'foo', })") runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: "foo"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #206") } { // meta/table.yaml line #211 /* err('ReqlQueryLogicError', 'In emergency repair mode, you can\'t specify shards, replicas, etc.') */ var expected_ Err = err("ReqlQueryLogicError", "In emergency repair mode, you can't specify shards, replicas, etc.") /* db.table('a').reconfigure(emergency_repair="unsafe_rollback", shards=1, replicas=1) */ suite.T().Log("About to run line #211: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: 'unsafe_rollback', Shards: 1, Replicas: 1, })") runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: "unsafe_rollback", Shards: 1, Replicas: 1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #211") } { // meta/table.yaml line #217 /* partial({'reconfigured':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"reconfigured": 1}) /* db.table('a').reconfigure(shards=2, replicas=1) */ suite.T().Log("About to run line #217: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 2, Replicas: 1, })") runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 2, Replicas: 1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #217") } { // meta/table.yaml line #222 /* {"ready":1} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"ready": 1} /* db.table('a').wait(wait_for="all_replicas_ready") */ suite.T().Log("About to run line #222: db.Table('a').Wait().OptArgs(r.WaitOpts{WaitFor: 'all_replicas_ready', })") runAndAssert(suite.Suite, expected_, db.Table("a").Wait().OptArgs(r.WaitOpts{WaitFor: "all_replicas_ready"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #222") } { // meta/table.yaml line #228 /* partial({"inserted":4}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"inserted": 4}) /* db.table('a').insert([{"id":1}, {"id":2}, {"id":3}, {"id":4}]) */ suite.T().Log("About to run line #228: db.Table('a').Insert([]interface{}{map[interface{}]interface{}{'id': 1, }, map[interface{}]interface{}{'id': 2, }, map[interface{}]interface{}{'id': 3, }, map[interface{}]interface{}{'id': 4, }})") runAndAssert(suite.Suite, expected_, db.Table("a").Insert([]interface{}{map[interface{}]interface{}{"id": 1}, map[interface{}]interface{}{"id": 2}, map[interface{}]interface{}{"id": 3}, map[interface{}]interface{}{"id": 4}}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #228") } { // meta/table.yaml line #233 /* partial({'reconfigured':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"reconfigured": 1}) /* db.table('a').reconfigure(shards=2, replicas=1) */ suite.T().Log("About to run line #233: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 2, Replicas: 1, })") runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 2, Replicas: 1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #233") } { // meta/table.yaml line #238 /* err('ReqlOpFailedError', 'Can\'t put 2 replicas on servers with the tag `default` because there are only 1 servers with the tag `default`. It\'s impossible to have more replicas of the data than there are servers.', []) */ var expected_ Err = err("ReqlOpFailedError", "Can't put 2 replicas on servers with the tag `default` because there are only 1 servers with the tag `default`. It's impossible to have more replicas of the data than there are servers.") /* db.table('a').reconfigure(shards=1, replicas=2) */ suite.T().Log("About to run line #238: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 2, })") runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 2}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #238") } { // meta/table.yaml line #244 /* {"ready":1} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"ready": 1} /* db.table('a').wait(wait_for="all_replicas_ready") */ suite.T().Log("About to run line #244: db.Table('a').Wait().OptArgs(r.WaitOpts{WaitFor: 'all_replicas_ready', })") runAndAssert(suite.Suite, expected_, db.Table("a").Wait().OptArgs(r.WaitOpts{WaitFor: "all_replicas_ready"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #244") } { // meta/table.yaml line #248 /* partial({'rebalanced':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"rebalanced": 1}) /* db.table('a').rebalance() */ suite.T().Log("About to run line #248: db.Table('a').Rebalance()") runAndAssert(suite.Suite, expected_, db.Table("a").Rebalance(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #248") } { // meta/table.yaml line #251 /* {"ready":1} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"ready": 1} /* db.wait(wait_for="all_replicas_ready") */ suite.T().Log("About to run line #251: db.Wait().OptArgs(r.WaitOpts{WaitFor: 'all_replicas_ready', })") runAndAssert(suite.Suite, expected_, db.Wait().OptArgs(r.WaitOpts{WaitFor: "all_replicas_ready"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #251") } { // meta/table.yaml line #255 /* partial({'rebalanced':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"rebalanced": 1}) /* db.rebalance() */ suite.T().Log("About to run line #255: db.Rebalance()") runAndAssert(suite.Suite, expected_, db.Rebalance(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #255") } { // meta/table.yaml line #271 /* partial({'tables_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) /* db.table_drop('a') */ suite.T().Log("About to run line #271: db.TableDrop('a')") runAndAssert(suite.Suite, expected_, db.TableDrop("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #271") } { // meta/table.yaml line #275 /* AnythingIsFine */ var expected_ string = compare.AnythingIsFine /* db.table_create('a') */ suite.T().Log("About to run line #275: db.TableCreate('a')") runAndAssert(suite.Suite, expected_, db.TableCreate("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #275") } { // meta/table.yaml line #276 /* AnythingIsFine */ var expected_ string = compare.AnythingIsFine /* db.table_create('b') */ suite.T().Log("About to run line #276: db.TableCreate('b')") runAndAssert(suite.Suite, expected_, db.TableCreate("b"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #276") } { // meta/table.yaml line #277 /* AnythingIsFine */ var expected_ string = compare.AnythingIsFine /* db.table_create('c') */ suite.T().Log("About to run line #277: db.TableCreate('c')") runAndAssert(suite.Suite, expected_, db.TableCreate("c"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #277") } { // meta/table.yaml line #279 /* err('ReqlQueryLogicError', 'Every table must have at least one shard.', []) */ var expected_ Err = err("ReqlQueryLogicError", "Every table must have at least one shard.") /* db.reconfigure(shards=0, replicas=1) */ suite.T().Log("About to run line #279: db.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 0, Replicas: 1, })") runAndAssert(suite.Suite, expected_, db.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 0, Replicas: 1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #279") } { // meta/table.yaml line #284 /* err('ReqlQueryLogicError', '`primary_replica_tag` must be specified when `replicas` is an OBJECT.', []) */ var expected_ Err = err("ReqlQueryLogicError", "`primary_replica_tag` must be specified when `replicas` is an OBJECT.") /* db.reconfigure(shards=1, replicas={"default":0}) */ suite.T().Log("About to run line #284: db.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{'default': 0, }, })") runAndAssert(suite.Suite, expected_, db.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{"default": 0}}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #284") } { // meta/table.yaml line #289 /* err('ReqlQueryLogicError', 'Can\'t have a negative number of replicas', []) */ var expected_ Err = err("ReqlQueryLogicError", "Can't have a negative number of replicas") /* db.reconfigure(shards=1, replicas={"default":-3}, primary_replica_tag='default') */ suite.T().Log("About to run line #289: db.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{'default': -3, }, PrimaryReplicaTag: 'default', })") runAndAssert(suite.Suite, expected_, db.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{"default": -3}, PrimaryReplicaTag: "default"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #289") } { // meta/table.yaml line #294 /* err('ReqlQueryLogicError', '`replicas` must be an OBJECT if `primary_replica_tag` is specified.', []) */ var expected_ Err = err("ReqlQueryLogicError", "`replicas` must be an OBJECT if `primary_replica_tag` is specified.") /* db.reconfigure(shards=1, replicas=3, primary_replica_tag='foo') */ suite.T().Log("About to run line #294: db.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 3, PrimaryReplicaTag: 'foo', })") runAndAssert(suite.Suite, expected_, db.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 3, PrimaryReplicaTag: "foo"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #294") } { // meta/table.yaml line #299 /* partial({'reconfigured':3}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"reconfigured": 3}) /* db.reconfigure(shards=2, replicas=1) */ suite.T().Log("About to run line #299: db.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 2, Replicas: 1, })") runAndAssert(suite.Suite, expected_, db.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 2, Replicas: 1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #299") } { // meta/table.yaml line #304 /* partial({'tables_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) /* db.table_drop('a') */ suite.T().Log("About to run line #304: db.TableDrop('a')") runAndAssert(suite.Suite, expected_, db.TableDrop("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #304") } { // meta/table.yaml line #306 /* partial({'tables_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) /* db.table_drop('b') */ suite.T().Log("About to run line #306: db.TableDrop('b')") runAndAssert(suite.Suite, expected_, db.TableDrop("b"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #306") } { // meta/table.yaml line #308 /* partial({'tables_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) /* db.table_drop('c') */ suite.T().Log("About to run line #308: db.TableDrop('c')") runAndAssert(suite.Suite, expected_, db.TableDrop("c"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #308") } { // meta/table.yaml line #312 /* partial({'dbs_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"dbs_created": 1}) /* r.db_create("test2") */ suite.T().Log("About to run line #312: r.DBCreate('test2')") runAndAssert(suite.Suite, expected_, r.DBCreate("test2"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #312") } // meta/table.yaml line #315 // db2 = r.db("test2") suite.T().Log("Possibly executing: var db2 r.Term = r.DB('test2')") db2 := r.DB("test2") _ = db2 // Prevent any noused variable errors { // meta/table.yaml line #317 /* partial({'tables_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) /* db.table_create("testA") */ suite.T().Log("About to run line #317: db.TableCreate('testA')") runAndAssert(suite.Suite, expected_, db.TableCreate("testA"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #317") } { // meta/table.yaml line #319 /* partial({'tables_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) /* db.table_create("testB") */ suite.T().Log("About to run line #319: db.TableCreate('testB')") runAndAssert(suite.Suite, expected_, db.TableCreate("testB"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #319") } { // meta/table.yaml line #321 /* partial({'tables_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) /* db2.table_create("test2B") */ suite.T().Log("About to run line #321: db2.TableCreate('test2B')") runAndAssert(suite.Suite, expected_, db2.TableCreate("test2B"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #321") } { // meta/table.yaml line #324 /* {'db':'test','name':'testA'} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"db": "test", "name": "testA"} /* r.table('testA').config().pluck('db','name') */ suite.T().Log("About to run line #324: r.Table('testA').Config().Pluck('db', 'name')") runAndAssert(suite.Suite, expected_, r.Table("testA").Config().Pluck("db", "name"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #324") } { // meta/table.yaml line #327 /* err('ReqlOpFailedError', 'Table `test.doesntexist` does not exist.', []) */ var expected_ Err = err("ReqlOpFailedError", "Table `test.doesntexist` does not exist.") /* r.table('doesntexist').config() */ suite.T().Log("About to run line #327: r.Table('doesntexist').Config()") runAndAssert(suite.Suite, expected_, r.Table("doesntexist").Config(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #327") } { // meta/table.yaml line #330 /* err('ReqlOpFailedError', 'Table `test.test2B` does not exist.', []) */ var expected_ Err = err("ReqlOpFailedError", "Table `test.test2B` does not exist.") /* r.table('test2B').config() */ suite.T().Log("About to run line #330: r.Table('test2B').Config()") runAndAssert(suite.Suite, expected_, r.Table("test2B").Config(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #330") } { // meta/table.yaml line #333 /* True */ var expected_ bool = true /* r.db('rethinkdb').table('table_config').filter({'name':'testA'}).nth(0).eq(r.table('testA').config()) */ suite.T().Log("About to run line #333: r.DB('rethinkdb').Table('table_config').Filter(map[interface{}]interface{}{'name': 'testA', }).Nth(0).Eq(r.Table('testA').Config())") runAndAssert(suite.Suite, expected_, r.DB("rethinkdb").Table("table_config").Filter(map[interface{}]interface{}{"name": "testA"}).Nth(0).Eq(r.Table("testA").Config()), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #333") } { // meta/table.yaml line #336 /* True */ var expected_ bool = true /* r.db('rethinkdb').table('table_status').filter({'name':'testA'}).nth(0).eq(r.table('testA').status()) */ suite.T().Log("About to run line #336: r.DB('rethinkdb').Table('table_status').Filter(map[interface{}]interface{}{'name': 'testA', }).Nth(0).Eq(r.Table('testA').Status())") runAndAssert(suite.Suite, expected_, r.DB("rethinkdb").Table("table_status").Filter(map[interface{}]interface{}{"name": "testA"}).Nth(0).Eq(r.Table("testA").Status()), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #336") } { // meta/table.yaml line #339 /* uuid() */ var expected_ compare.Regex = compare.IsUUID() /* r.db('rethinkdb').table('table_config', identifier_format='uuid').nth(0)["db"] */ suite.T().Log("About to run line #339: r.DB('rethinkdb').Table('table_config').OptArgs(r.TableOpts{IdentifierFormat: 'uuid', }).Nth(0).AtIndex('db')") runAndAssert(suite.Suite, expected_, r.DB("rethinkdb").Table("table_config").OptArgs(r.TableOpts{IdentifierFormat: "uuid"}).Nth(0).AtIndex("db"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #339") } { // meta/table.yaml line #344 /* 0 */ var expected_ int = 0 /* r.table('testA', identifier_format='uuid').count() */ suite.T().Log("About to run line #344: r.Table('testA').OptArgs(r.TableOpts{IdentifierFormat: 'uuid', }).Count()") runAndAssert(suite.Suite, expected_, r.Table("testA").OptArgs(r.TableOpts{IdentifierFormat: "uuid"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #344") } { // meta/table.yaml line #358 /* partial({'tables_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) /* db.table_drop('testA') */ suite.T().Log("About to run line #358: db.TableDrop('testA')") runAndAssert(suite.Suite, expected_, db.TableDrop("testA"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #358") } { // meta/table.yaml line #361 /* partial({'tables_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) /* db.table_drop('testB') */ suite.T().Log("About to run line #361: db.TableDrop('testB')") runAndAssert(suite.Suite, expected_, db.TableDrop("testB"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #361") } { // meta/table.yaml line #364 /* partial({'dbs_dropped':1,'tables_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"dbs_dropped": 1, "tables_dropped": 1}) /* r.db_drop('test2') */ suite.T().Log("About to run line #364: r.DBDrop('test2')") runAndAssert(suite.Suite, expected_, r.DBDrop("test2"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #364") } }
func (suite *ChangefeedsPointSuite) TestCases() { suite.T().Log("Running ChangefeedsPointSuite: Test point changebasics") tbl := r.DB("test").Table("tbl") _ = tbl // Prevent any noused variable errors // changefeeds/point.yaml line #10 // basic = tbl.get(1).changes(include_initial=True) suite.T().Log("Possibly executing: var basic r.Term = tbl.Get(1).Changes().OptArgs(r.ChangesOpts{IncludeInitial: true, })") basic := maybeRun(tbl.Get(1).Changes().OptArgs(r.ChangesOpts{IncludeInitial: true}), suite.session, r.RunOpts{}) _ = basic // Prevent any noused variable errors { // changefeeds/point.yaml line #14 /* [{'new_val':null}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"new_val": nil}} /* fetch(basic, 1) */ suite.T().Log("About to run line #14: fetch(basic, 1)") fetchAndAssert(suite.Suite, expected_, basic, 1) suite.T().Log("Finished running line #14") } { // changefeeds/point.yaml line #19 /* partial({'errors':0, 'inserted':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "inserted": 1}) /* tbl.insert({'id':1}) */ suite.T().Log("About to run line #19: tbl.Insert(map[interface{}]interface{}{'id': 1, })") runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"id": 1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #19") } { // changefeeds/point.yaml line #22 /* [{'old_val':null, 'new_val':{'id':1}}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"old_val": nil, "new_val": map[interface{}]interface{}{"id": 1}}} /* fetch(basic, 1) */ suite.T().Log("About to run line #22: fetch(basic, 1)") fetchAndAssert(suite.Suite, expected_, basic, 1) suite.T().Log("Finished running line #22") } { // changefeeds/point.yaml line #27 /* partial({'errors':0, 'replaced':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "replaced": 1}) /* tbl.get(1).update({'update':1}) */ suite.T().Log("About to run line #27: tbl.Get(1).Update(map[interface{}]interface{}{'update': 1, })") runAndAssert(suite.Suite, expected_, tbl.Get(1).Update(map[interface{}]interface{}{"update": 1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #27") } { // changefeeds/point.yaml line #30 /* [{'old_val':{'id':1}, 'new_val':{'id':1,'update':1}}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"old_val": map[interface{}]interface{}{"id": 1}, "new_val": map[interface{}]interface{}{"id": 1, "update": 1}}} /* fetch(basic, 1) */ suite.T().Log("About to run line #30: fetch(basic, 1)") fetchAndAssert(suite.Suite, expected_, basic, 1) suite.T().Log("Finished running line #30") } { // changefeeds/point.yaml line #35 /* partial({'errors':0, 'deleted':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "deleted": 1}) /* tbl.get(1).delete() */ suite.T().Log("About to run line #35: tbl.Get(1).Delete()") runAndAssert(suite.Suite, expected_, tbl.Get(1).Delete(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #35") } { // changefeeds/point.yaml line #38 /* [{'old_val':{'id':1,'update':1}, 'new_val':null}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"old_val": map[interface{}]interface{}{"id": 1, "update": 1}, "new_val": nil}} /* fetch(basic, 1) */ suite.T().Log("About to run line #38: fetch(basic, 1)") fetchAndAssert(suite.Suite, expected_, basic, 1) suite.T().Log("Finished running line #38") } // changefeeds/point.yaml line #49 // filter = tbl.get(1).changes(squash=false,include_initial=True).filter(r.row['new_val']['update'].gt(2))['new_val']['update'] suite.T().Log("Possibly executing: var filter r.Term = tbl.Get(1).Changes().OptArgs(r.ChangesOpts{Squash: false, IncludeInitial: true, }).Filter(r.Row.AtIndex('new_val').AtIndex('update').Gt(2)).AtIndex('new_val').AtIndex('update')") filter := maybeRun(tbl.Get(1).Changes().OptArgs(r.ChangesOpts{Squash: false, IncludeInitial: true}).Filter(r.Row.AtIndex("new_val").AtIndex("update").Gt(2)).AtIndex("new_val").AtIndex("update"), suite.session, r.RunOpts{}) _ = filter // Prevent any noused variable errors { // changefeeds/point.yaml line #53 /* AnythingIsFine */ var expected_ string = compare.AnythingIsFine /* tbl.insert({'id':1, 'update':1}) */ suite.T().Log("About to run line #53: tbl.Insert(map[interface{}]interface{}{'id': 1, 'update': 1, })") runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"id": 1, "update": 1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #53") } { // changefeeds/point.yaml line #54 /* AnythingIsFine */ var expected_ string = compare.AnythingIsFine /* tbl.get(1).update({'update':4}) */ suite.T().Log("About to run line #54: tbl.Get(1).Update(map[interface{}]interface{}{'update': 4, })") runAndAssert(suite.Suite, expected_, tbl.Get(1).Update(map[interface{}]interface{}{"update": 4}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #54") } { // changefeeds/point.yaml line #55 /* AnythingIsFine */ var expected_ string = compare.AnythingIsFine /* tbl.get(1).update({'update':1}) */ suite.T().Log("About to run line #55: tbl.Get(1).Update(map[interface{}]interface{}{'update': 1, })") runAndAssert(suite.Suite, expected_, tbl.Get(1).Update(map[interface{}]interface{}{"update": 1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #55") } { // changefeeds/point.yaml line #56 /* AnythingIsFine */ var expected_ string = compare.AnythingIsFine /* tbl.get(1).update({'update':7}) */ suite.T().Log("About to run line #56: tbl.Get(1).Update(map[interface{}]interface{}{'update': 7, })") runAndAssert(suite.Suite, expected_, tbl.Get(1).Update(map[interface{}]interface{}{"update": 7}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #56") } { // changefeeds/point.yaml line #58 /* [4,7] */ var expected_ []interface{} = []interface{}{4, 7} /* fetch(filter, 2) */ suite.T().Log("About to run line #58: fetch(filter, 2)") fetchAndAssert(suite.Suite, expected_, filter, 2) suite.T().Log("Finished running line #58") } // changefeeds/point.yaml line #63 // pluck = tbl.get(3).changes(squash=false,include_initial=True).pluck({'new_val':['red', 'blue']})['new_val'] suite.T().Log("Possibly executing: var pluck r.Term = tbl.Get(3).Changes().OptArgs(r.ChangesOpts{Squash: false, IncludeInitial: true, }).Pluck(map[interface{}]interface{}{'new_val': []interface{}{'red', 'blue'}, }).AtIndex('new_val')") pluck := maybeRun(tbl.Get(3).Changes().OptArgs(r.ChangesOpts{Squash: false, IncludeInitial: true}).Pluck(map[interface{}]interface{}{"new_val": []interface{}{"red", "blue"}}).AtIndex("new_val"), suite.session, r.RunOpts{}) _ = pluck // Prevent any noused variable errors { // changefeeds/point.yaml line #67 /* partial({'errors':0, 'inserted':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "inserted": 1}) /* tbl.insert({'id':3, 'red':1, 'green':1}) */ suite.T().Log("About to run line #67: tbl.Insert(map[interface{}]interface{}{'id': 3, 'red': 1, 'green': 1, })") runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"id": 3, "red": 1, "green": 1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #67") } { // changefeeds/point.yaml line #69 /* partial({'errors':0, 'replaced':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "replaced": 1}) /* tbl.get(3).update({'blue':2, 'green':3}) */ suite.T().Log("About to run line #69: tbl.Get(3).Update(map[interface{}]interface{}{'blue': 2, 'green': 3, })") runAndAssert(suite.Suite, expected_, tbl.Get(3).Update(map[interface{}]interface{}{"blue": 2, "green": 3}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #69") } { // changefeeds/point.yaml line #71 /* partial({'errors':0, 'replaced':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "replaced": 1}) /* tbl.get(3).update({'green':4}) */ suite.T().Log("About to run line #71: tbl.Get(3).Update(map[interface{}]interface{}{'green': 4, })") runAndAssert(suite.Suite, expected_, tbl.Get(3).Update(map[interface{}]interface{}{"green": 4}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #71") } { // changefeeds/point.yaml line #73 /* partial({'errors':0, 'replaced':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "replaced": 1}) /* tbl.get(3).update({'blue':4}) */ suite.T().Log("About to run line #73: tbl.Get(3).Update(map[interface{}]interface{}{'blue': 4, })") runAndAssert(suite.Suite, expected_, tbl.Get(3).Update(map[interface{}]interface{}{"blue": 4}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #73") } { // changefeeds/point.yaml line #76 /* [{'red': 1}, {'blue': 2, 'red': 1}, {'blue': 2, 'red': 1}, {'blue': 4, 'red': 1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"red": 1}, map[interface{}]interface{}{"blue": 2, "red": 1}, map[interface{}]interface{}{"blue": 2, "red": 1}, map[interface{}]interface{}{"blue": 4, "red": 1}} /* fetch(pluck, 4) */ suite.T().Log("About to run line #76: fetch(pluck, 4)") fetchAndAssert(suite.Suite, expected_, pluck, 4) suite.T().Log("Finished running line #76") } // changefeeds/point.yaml line #83 // dtbl = r.db('rethinkdb').table('_debug_scratch') suite.T().Log("Possibly executing: var dtbl r.Term = r.DB('rethinkdb').Table('_debug_scratch')") dtbl := r.DB("rethinkdb").Table("_debug_scratch") _ = dtbl // Prevent any noused variable errors // changefeeds/point.yaml line #86 // debug = dtbl.get(1).changes(include_initial=True) suite.T().Log("Possibly executing: var debug r.Term = dtbl.Get(1).Changes().OptArgs(r.ChangesOpts{IncludeInitial: true, })") debug := maybeRun(dtbl.Get(1).Changes().OptArgs(r.ChangesOpts{IncludeInitial: true}), suite.session, r.RunOpts{}) _ = debug // Prevent any noused variable errors { // changefeeds/point.yaml line #88 /* [{'new_val':null}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"new_val": nil}} /* fetch(debug, 1) */ suite.T().Log("About to run line #88: fetch(debug, 1)") fetchAndAssert(suite.Suite, expected_, debug, 1) suite.T().Log("Finished running line #88") } { // changefeeds/point.yaml line #91 /* partial({'errors':0, 'inserted':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "inserted": 1}) /* dtbl.insert({'id':1}) */ suite.T().Log("About to run line #91: dtbl.Insert(map[interface{}]interface{}{'id': 1, })") runAndAssert(suite.Suite, expected_, dtbl.Insert(map[interface{}]interface{}{"id": 1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #91") } { // changefeeds/point.yaml line #93 /* [{'old_val':null, 'new_val':{'id':1}}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"old_val": nil, "new_val": map[interface{}]interface{}{"id": 1}}} /* fetch(debug, 1) */ suite.T().Log("About to run line #93: fetch(debug, 1)") fetchAndAssert(suite.Suite, expected_, debug, 1) suite.T().Log("Finished running line #93") } { // changefeeds/point.yaml line #96 /* partial({'errors':0, 'replaced':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "replaced": 1}) /* dtbl.get(1).update({'update':1}) */ suite.T().Log("About to run line #96: dtbl.Get(1).Update(map[interface{}]interface{}{'update': 1, })") runAndAssert(suite.Suite, expected_, dtbl.Get(1).Update(map[interface{}]interface{}{"update": 1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #96") } { // changefeeds/point.yaml line #98 /* [{'old_val':{'id':1}, 'new_val':{'id':1,'update':1}}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"old_val": map[interface{}]interface{}{"id": 1}, "new_val": map[interface{}]interface{}{"id": 1, "update": 1}}} /* fetch(debug, 1) */ suite.T().Log("About to run line #98: fetch(debug, 1)") fetchAndAssert(suite.Suite, expected_, debug, 1) suite.T().Log("Finished running line #98") } { // changefeeds/point.yaml line #101 /* partial({'errors':0, 'deleted':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "deleted": 1}) /* dtbl.get(1).delete() */ suite.T().Log("About to run line #101: dtbl.Get(1).Delete()") runAndAssert(suite.Suite, expected_, dtbl.Get(1).Delete(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #101") } { // changefeeds/point.yaml line #103 /* [{'old_val':{'id':1,'update':1}, 'new_val':null}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"old_val": map[interface{}]interface{}{"id": 1, "update": 1}, "new_val": nil}} /* fetch(debug, 1) */ suite.T().Log("About to run line #103: fetch(debug, 1)") fetchAndAssert(suite.Suite, expected_, debug, 1) suite.T().Log("Finished running line #103") } { // changefeeds/point.yaml line #106 /* {'skipped':0, 'deleted':0, 'unchanged':0, 'errors':0, 'replaced':0, 'inserted':1} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"skipped": 0, "deleted": 0, "unchanged": 0, "errors": 0, "replaced": 0, "inserted": 1} /* dtbl.insert({'id':5, 'red':1, 'green':1}) */ suite.T().Log("About to run line #106: dtbl.Insert(map[interface{}]interface{}{'id': 5, 'red': 1, 'green': 1, })") runAndAssert(suite.Suite, expected_, dtbl.Insert(map[interface{}]interface{}{"id": 5, "red": 1, "green": 1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #106") } // changefeeds/point.yaml line #108 // dtblPluck = dtbl.get(5).changes(include_initial=True).pluck({'new_val':['red', 'blue']})['new_val'] suite.T().Log("Possibly executing: var dtblPluck r.Term = dtbl.Get(5).Changes().OptArgs(r.ChangesOpts{IncludeInitial: true, }).Pluck(map[interface{}]interface{}{'new_val': []interface{}{'red', 'blue'}, }).AtIndex('new_val')") dtblPluck := maybeRun(dtbl.Get(5).Changes().OptArgs(r.ChangesOpts{IncludeInitial: true}).Pluck(map[interface{}]interface{}{"new_val": []interface{}{"red", "blue"}}).AtIndex("new_val"), suite.session, r.RunOpts{}) _ = dtblPluck // Prevent any noused variable errors { // changefeeds/point.yaml line #113 /* [{'red':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"red": 1}} /* fetch(dtblPluck, 1) */ suite.T().Log("About to run line #113: fetch(dtblPluck, 1)") fetchAndAssert(suite.Suite, expected_, dtblPluck, 1) suite.T().Log("Finished running line #113") } { // changefeeds/point.yaml line #116 /* partial({'errors':0, 'replaced':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "replaced": 1}) /* dtbl.get(5).update({'blue':2, 'green':3}) */ suite.T().Log("About to run line #116: dtbl.Get(5).Update(map[interface{}]interface{}{'blue': 2, 'green': 3, })") runAndAssert(suite.Suite, expected_, dtbl.Get(5).Update(map[interface{}]interface{}{"blue": 2, "green": 3}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #116") } { // changefeeds/point.yaml line #119 /* [{'blue':2, 'red':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"blue": 2, "red": 1}} /* fetch(dtblPluck, 1) */ suite.T().Log("About to run line #119: fetch(dtblPluck, 1)") fetchAndAssert(suite.Suite, expected_, dtblPluck, 1) suite.T().Log("Finished running line #119") } // changefeeds/point.yaml line #132 // tableId = tbl.info()['id'] suite.T().Log("Possibly executing: var tableId r.Term = tbl.Info().AtIndex('id')") tableId := maybeRun(tbl.Info().AtIndex("id"), suite.session, r.RunOpts{}) _ = tableId // Prevent any noused variable errors // changefeeds/point.yaml line #136 // rtblPluck = r.db('rethinkdb').table('table_status').get(tableId).changes(include_initial=True) suite.T().Log("Possibly executing: var rtblPluck r.Term = r.DB('rethinkdb').Table('table_status').Get(tableId).Changes().OptArgs(r.ChangesOpts{IncludeInitial: true, })") rtblPluck := maybeRun(r.DB("rethinkdb").Table("table_status").Get(tableId).Changes().OptArgs(r.ChangesOpts{IncludeInitial: true}), suite.session, r.RunOpts{}) _ = rtblPluck // Prevent any noused variable errors { // changefeeds/point.yaml line #137 /* partial([{'new_val':partial({'db':'test'})}]) */ var expected_ compare.Expected = compare.PartialMatch([]interface{}{map[interface{}]interface{}{"new_val": compare.PartialMatch(map[interface{}]interface{}{"db": "test"})}}) /* fetch(rtblPluck, 1) */ suite.T().Log("About to run line #137: fetch(rtblPluck, 1)") fetchAndAssert(suite.Suite, expected_, rtblPluck, 1) suite.T().Log("Finished running line #137") } { // changefeeds/point.yaml line #140 /* AnythingIsFine */ var expected_ string = compare.AnythingIsFine /* tbl.reconfigure(shards=3, replicas=1) */ suite.T().Log("About to run line #140: tbl.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 3, Replicas: 1, })") runAndAssert(suite.Suite, expected_, tbl.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 3, Replicas: 1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #140") } { // changefeeds/point.yaml line #143 /* partial([{'old_val':partial({'db':'test'}), 'new_val':partial({'db':'test'})}]) */ var expected_ compare.Expected = compare.PartialMatch([]interface{}{map[interface{}]interface{}{"old_val": compare.PartialMatch(map[interface{}]interface{}{"db": "test"}), "new_val": compare.PartialMatch(map[interface{}]interface{}{"db": "test"})}}) /* fetch(rtblPluck, 1, 2) */ suite.T().Log("About to run line #143: fetch(rtblPluck, 1)") fetchAndAssert(suite.Suite, expected_, rtblPluck, 1) suite.T().Log("Finished running line #143") } }
func (suite *MutationSyncSuite) TestCases() { suite.T().Log("Running MutationSyncSuite: Tests syncing tables") { // mutation/sync.yaml line #5 /* partial({'tables_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) /* r.db('test').table_create('test1') */ suite.T().Log("About to run line #5: r.DB('test').TableCreate('test1')") runAndAssert(suite.Suite, expected_, r.DB("test").TableCreate("test1"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #5") } { // mutation/sync.yaml line #7 /* partial({'tables_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) /* r.db('test').table_create('test1soft') */ suite.T().Log("About to run line #7: r.DB('test').TableCreate('test1soft')") runAndAssert(suite.Suite, expected_, r.DB("test").TableCreate("test1soft"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #7") } { // mutation/sync.yaml line #9 /* {'skipped':0, 'deleted':0, 'unchanged':0, 'errors':0, 'replaced':1, 'inserted':0} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"skipped": 0, "deleted": 0, "unchanged": 0, "errors": 0, "replaced": 1, "inserted": 0} /* r.db('test').table('test1soft').config().update({'durability':'soft'}) */ suite.T().Log("About to run line #9: r.DB('test').Table('test1soft').Config().Update(map[interface{}]interface{}{'durability': 'soft', })") runAndAssert(suite.Suite, expected_, r.DB("test").Table("test1soft").Config().Update(map[interface{}]interface{}{"durability": "soft"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #9") } // mutation/sync.yaml line #11 // tbl = r.db('test').table('test1') suite.T().Log("Possibly executing: var tbl r.Term = r.DB('test').Table('test1')") tbl := r.DB("test").Table("test1") _ = tbl // Prevent any noused variable errors // mutation/sync.yaml line #12 // tbl_soft = r.db('test').table('test1soft') suite.T().Log("Possibly executing: var tbl_soft r.Term = r.DB('test').Table('test1soft')") tbl_soft := r.DB("test").Table("test1soft") _ = tbl_soft // Prevent any noused variable errors { // mutation/sync.yaml line #13 /* partial({'created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"created": 1}) /* tbl.index_create('x') */ suite.T().Log("About to run line #13: tbl.IndexCreate('x')") runAndAssert(suite.Suite, expected_, tbl.IndexCreate("x"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #13") } { // mutation/sync.yaml line #15 /* [{'ready':True, 'index':'x'}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"ready": true, "index": "x"}} /* tbl.index_wait('x').pluck('index', 'ready') */ suite.T().Log("About to run line #15: tbl.IndexWait('x').Pluck('index', 'ready')") runAndAssert(suite.Suite, expected_, tbl.IndexWait("x").Pluck("index", "ready"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #15") } { // mutation/sync.yaml line #19 /* {'synced':1} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"synced": 1} /* tbl.sync() */ suite.T().Log("About to run line #19: tbl.Sync()") runAndAssert(suite.Suite, expected_, tbl.Sync(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #19") } { // mutation/sync.yaml line #21 /* {'synced':1} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"synced": 1} /* tbl_soft.sync() */ suite.T().Log("About to run line #21: tbl_soft.Sync()") runAndAssert(suite.Suite, expected_, tbl_soft.Sync(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #21") } { // mutation/sync.yaml line #23 /* {'synced':1} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"synced": 1} /* tbl.sync() */ suite.T().Log("About to run line #23: tbl.Sync()") runAndAssert(suite.Suite, expected_, tbl.Sync(), suite.session, r.RunOpts{ Durability: "soft", GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #23") } { // mutation/sync.yaml line #27 /* {'synced':1} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"synced": 1} /* tbl.sync() */ suite.T().Log("About to run line #27: tbl.Sync()") runAndAssert(suite.Suite, expected_, tbl.Sync(), suite.session, r.RunOpts{ Durability: "hard", GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #27") } { // mutation/sync.yaml line #48 /* partial({'tables_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) /* r.db('test').table_drop('test1') */ suite.T().Log("About to run line #48: r.DB('test').TableDrop('test1')") runAndAssert(suite.Suite, expected_, r.DB("test").TableDrop("test1"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #48") } { // mutation/sync.yaml line #50 /* partial({'tables_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) /* r.db('test').table_drop('test1soft') */ suite.T().Log("About to run line #50: r.DB('test').TableDrop('test1soft')") runAndAssert(suite.Suite, expected_, r.DB("test").TableDrop("test1soft"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #50") } }
func (suite *DefaultSuite) TestCases() { suite.T().Log("Running DefaultSuite: Tests r.default") { // default.yaml line #3 /* 1 */ var expected_ int = 1 /* r.expr(1).default(2) */ suite.T().Log("About to run line #3: r.Expr(1).Default(2)") runAndAssert(suite.Suite, expected_, r.Expr(1).Default(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #3") } { // default.yaml line #5 /* 2 */ var expected_ int = 2 /* r.expr(null).default(2) */ suite.T().Log("About to run line #5: r.Expr(nil).Default(2)") runAndAssert(suite.Suite, expected_, r.Expr(nil).Default(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #5") } { // default.yaml line #7 /* 2 */ var expected_ int = 2 /* r.expr({})['b'].default(2) */ suite.T().Log("About to run line #7: r.Expr(map[interface{}]interface{}{}).AtIndex('b').Default(2)") runAndAssert(suite.Suite, expected_, r.Expr(map[interface{}]interface{}{}).AtIndex("b").Default(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #7") } { // default.yaml line #10 /* err("ReqlQueryLogicError", "Cannot perform bracket on a non-object non-sequence `\"a\"`.", []) */ var expected_ Err = err("ReqlQueryLogicError", "Cannot perform bracket on a non-object non-sequence `\"a\"`.") /* r.expr(r.expr('a')['b']).default(2) */ suite.T().Log("About to run line #10: r.Expr(r.Expr('a').AtIndex('b')).Default(2)") runAndAssert(suite.Suite, expected_, r.Expr(r.Expr("a").AtIndex("b")).Default(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #10") } { // default.yaml line #14 /* 2 */ var expected_ int = 2 /* r.expr([]).reduce(lambda a,b:a+b).default(2) */ suite.T().Log("About to run line #14: r.Expr([]interface{}{}).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b)}).Default(2)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{}).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b) }).Default(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #14") } { // default.yaml line #18 /* 2 */ var expected_ int = 2 /* r.expr([]).union([]).reduce(lambda a,b:a+b).default(2) */ suite.T().Log("About to run line #18: r.Expr([]interface{}{}).Union([]interface{}{}).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b)}).Default(2)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{}).Union([]interface{}{}).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b) }).Default(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #18") } { // default.yaml line #22 /* err("ReqlQueryLogicError", "Cannot convert STRING to SEQUENCE", []) */ var expected_ Err = err("ReqlQueryLogicError", "Cannot convert STRING to SEQUENCE") /* r.expr('a').reduce(lambda a,b:a+b).default(2) */ suite.T().Log("About to run line #22: r.Expr('a').Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b)}).Default(2)") runAndAssert(suite.Suite, expected_, r.Expr("a").Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b) }).Default(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #22") } { // default.yaml line #25 /* 2 */ var expected_ int = 2 /* (r.expr(null) + 5).default(2) */ suite.T().Log("About to run line #25: r.Expr(nil).Add(5).Default(2)") runAndAssert(suite.Suite, expected_, r.Expr(nil).Add(5).Default(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #25") } { // default.yaml line #28 /* 2 */ var expected_ int = 2 /* (5 + r.expr(null)).default(2) */ suite.T().Log("About to run line #28: r.Add(5, r.Expr(nil)).Default(2)") runAndAssert(suite.Suite, expected_, r.Add(5, r.Expr(nil)).Default(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #28") } { // default.yaml line #31 /* 2 */ var expected_ int = 2 /* (5 - r.expr(null)).default(2) */ suite.T().Log("About to run line #31: r.Sub(5, r.Expr(nil)).Default(2)") runAndAssert(suite.Suite, expected_, r.Sub(5, r.Expr(nil)).Default(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #31") } { // default.yaml line #34 /* 2 */ var expected_ int = 2 /* (r.expr(null) - 5).default(2) */ suite.T().Log("About to run line #34: r.Expr(nil).Sub(5).Default(2)") runAndAssert(suite.Suite, expected_, r.Expr(nil).Sub(5).Default(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #34") } { // default.yaml line #37 /* err("ReqlQueryLogicError", "Expected type STRING but found NUMBER.", []) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type STRING but found NUMBER.") /* (r.expr('a') + 5).default(2) */ suite.T().Log("About to run line #37: r.Expr('a').Add(5).Default(2)") runAndAssert(suite.Suite, expected_, r.Expr("a").Add(5).Default(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #37") } { // default.yaml line #40 /* err("ReqlQueryLogicError", "Expected type NUMBER but found STRING.", []) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type NUMBER but found STRING.") /* (5 + r.expr('a')).default(2) */ suite.T().Log("About to run line #40: r.Add(5, r.Expr('a')).Default(2)") runAndAssert(suite.Suite, expected_, r.Add(5, r.Expr("a")).Default(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #40") } { // default.yaml line #43 /* err("ReqlQueryLogicError", "Expected type NUMBER but found STRING.", []) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type NUMBER but found STRING.") /* (r.expr('a') - 5).default(2) */ suite.T().Log("About to run line #43: r.Expr('a').Sub(5).Default(2)") runAndAssert(suite.Suite, expected_, r.Expr("a").Sub(5).Default(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #43") } { // default.yaml line #46 /* err("ReqlQueryLogicError", "Expected type NUMBER but found STRING.", []) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type NUMBER but found STRING.") /* (5 - r.expr('a')).default(2) */ suite.T().Log("About to run line #46: r.Sub(5, r.Expr('a')).Default(2)") runAndAssert(suite.Suite, expected_, r.Sub(5, r.Expr("a")).Default(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #46") } { // default.yaml line #50 /* 1 */ var expected_ int = 1 /* r.expr(1).default(r.error()) */ suite.T().Log("About to run line #50: r.Expr(1).Default(r.Error())") runAndAssert(suite.Suite, expected_, r.Expr(1).Default(r.Error()), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #50") } { // default.yaml line #52 /* (null) */ var expected_ interface{} = nil /* r.expr(null).default(r.error()) */ suite.T().Log("About to run line #52: r.Expr(nil).Default(r.Error())") runAndAssert(suite.Suite, expected_, r.Expr(nil).Default(r.Error()), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #52") } { // default.yaml line #54 /* err("ReqlNonExistenceError", "No attribute `b` in object:", []) */ var expected_ Err = err("ReqlNonExistenceError", "No attribute `b` in object:") /* r.expr({})['b'].default(r.error()) */ suite.T().Log("About to run line #54: r.Expr(map[interface{}]interface{}{}).AtIndex('b').Default(r.Error())") runAndAssert(suite.Suite, expected_, r.Expr(map[interface{}]interface{}{}).AtIndex("b").Default(r.Error()), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #54") } { // default.yaml line #58 /* err("ReqlNonExistenceError", "Cannot reduce over an empty stream.", []) */ var expected_ Err = err("ReqlNonExistenceError", "Cannot reduce over an empty stream.") /* r.expr([]).reduce(lambda a,b:a+b).default(r.error) */ suite.T().Log("About to run line #58: r.Expr([]interface{}{}).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b)}).Default(r.Error())") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{}).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b) }).Default(r.Error()), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #58") } { // default.yaml line #62 /* err("ReqlNonExistenceError", "Cannot reduce over an empty stream.", []) */ var expected_ Err = err("ReqlNonExistenceError", "Cannot reduce over an empty stream.") /* r.expr([]).union([]).reduce(lambda a,b:a+b).default(r.error) */ suite.T().Log("About to run line #62: r.Expr([]interface{}{}).Union([]interface{}{}).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b)}).Default(r.Error())") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{}).Union([]interface{}{}).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b) }).Default(r.Error()), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #62") } { // default.yaml line #65 /* err("ReqlNonExistenceError", "Expected type NUMBER but found NULL.", []) */ var expected_ Err = err("ReqlNonExistenceError", "Expected type NUMBER but found NULL.") /* (r.expr(null) + 5).default(r.error) */ suite.T().Log("About to run line #65: r.Expr(nil).Add(5).Default(r.Error())") runAndAssert(suite.Suite, expected_, r.Expr(nil).Add(5).Default(r.Error()), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #65") } { // default.yaml line #68 /* err("ReqlNonExistenceError", "Expected type NUMBER but found NULL.", []) */ var expected_ Err = err("ReqlNonExistenceError", "Expected type NUMBER but found NULL.") /* (5 + r.expr(null)).default(r.error) */ suite.T().Log("About to run line #68: r.Add(5, r.Expr(nil)).Default(r.Error())") runAndAssert(suite.Suite, expected_, r.Add(5, r.Expr(nil)).Default(r.Error()), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #68") } { // default.yaml line #71 /* err("ReqlNonExistenceError", "Expected type NUMBER but found NULL.", []) */ var expected_ Err = err("ReqlNonExistenceError", "Expected type NUMBER but found NULL.") /* (5 - r.expr(null)).default(r.error) */ suite.T().Log("About to run line #71: r.Sub(5, r.Expr(nil)).Default(r.Error())") runAndAssert(suite.Suite, expected_, r.Sub(5, r.Expr(nil)).Default(r.Error()), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #71") } { // default.yaml line #74 /* err("ReqlNonExistenceError", "Expected type NUMBER but found NULL.", []) */ var expected_ Err = err("ReqlNonExistenceError", "Expected type NUMBER but found NULL.") /* (r.expr(null) - 5).default(r.error) */ suite.T().Log("About to run line #74: r.Expr(nil).Sub(5).Default(r.Error())") runAndAssert(suite.Suite, expected_, r.Expr(nil).Sub(5).Default(r.Error()), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #74") } { // default.yaml line #79 /* 1 */ var expected_ int = 1 /* r.expr(1).default(lambda e:e) */ suite.T().Log("About to run line #79: r.Expr(1).Default(func(e r.Term) interface{} { return e})") runAndAssert(suite.Suite, expected_, r.Expr(1).Default(func(e r.Term) interface{} { return e }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #79") } { // default.yaml line #83 /* (null) */ var expected_ interface{} = nil /* r.expr(null).default(lambda e:e) */ suite.T().Log("About to run line #83: r.Expr(nil).Default(func(e r.Term) interface{} { return e})") runAndAssert(suite.Suite, expected_, r.Expr(nil).Default(func(e r.Term) interface{} { return e }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #83") } { // default.yaml line #87 /* "No attribute `b` in object:\n{}" */ var expected_ string = "No attribute `b` in object:\n{}" /* r.expr({})['b'].default(lambda e:e) */ suite.T().Log("About to run line #87: r.Expr(map[interface{}]interface{}{}).AtIndex('b').Default(func(e r.Term) interface{} { return e})") runAndAssert(suite.Suite, expected_, r.Expr(map[interface{}]interface{}{}).AtIndex("b").Default(func(e r.Term) interface{} { return e }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #87") } { // default.yaml line #91 /* ("Cannot reduce over an empty stream.") */ var expected_ string = "Cannot reduce over an empty stream." /* r.expr([]).reduce(lambda a,b:a+b).default(lambda e:e) */ suite.T().Log("About to run line #91: r.Expr([]interface{}{}).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b)}).Default(func(e r.Term) interface{} { return e})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{}).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b) }).Default(func(e r.Term) interface{} { return e }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #91") } { // default.yaml line #95 /* ("Cannot reduce over an empty stream.") */ var expected_ string = "Cannot reduce over an empty stream." /* r.expr([]).union([]).reduce(lambda a,b:a+b).default(lambda e:e) */ suite.T().Log("About to run line #95: r.Expr([]interface{}{}).Union([]interface{}{}).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b)}).Default(func(e r.Term) interface{} { return e})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{}).Union([]interface{}{}).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b) }).Default(func(e r.Term) interface{} { return e }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #95") } { // default.yaml line #99 /* ("Expected type NUMBER but found NULL.") */ var expected_ string = "Expected type NUMBER but found NULL." /* (r.expr(null) + 5).default(lambda e:e) */ suite.T().Log("About to run line #99: r.Expr(nil).Add(5).Default(func(e r.Term) interface{} { return e})") runAndAssert(suite.Suite, expected_, r.Expr(nil).Add(5).Default(func(e r.Term) interface{} { return e }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #99") } { // default.yaml line #103 /* ("Expected type NUMBER but found NULL.") */ var expected_ string = "Expected type NUMBER but found NULL." /* (5 + r.expr(null)).default(lambda e:e) */ suite.T().Log("About to run line #103: r.Add(5, r.Expr(nil)).Default(func(e r.Term) interface{} { return e})") runAndAssert(suite.Suite, expected_, r.Add(5, r.Expr(nil)).Default(func(e r.Term) interface{} { return e }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #103") } { // default.yaml line #107 /* ("Expected type NUMBER but found NULL.") */ var expected_ string = "Expected type NUMBER but found NULL." /* (5 - r.expr(null)).default(lambda e:e) */ suite.T().Log("About to run line #107: r.Sub(5, r.Expr(nil)).Default(func(e r.Term) interface{} { return e})") runAndAssert(suite.Suite, expected_, r.Sub(5, r.Expr(nil)).Default(func(e r.Term) interface{} { return e }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #107") } { // default.yaml line #111 /* ("Expected type NUMBER but found NULL.") */ var expected_ string = "Expected type NUMBER but found NULL." /* (r.expr(null) - 5).default(lambda e:e) */ suite.T().Log("About to run line #111: r.Expr(nil).Sub(5).Default(func(e r.Term) interface{} { return e})") runAndAssert(suite.Suite, expected_, r.Expr(nil).Sub(5).Default(func(e r.Term) interface{} { return e }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #111") } // default.yaml line #115 // arr = r.expr([{'a':1},{'a':null},{}]).order_by('a') suite.T().Log("Possibly executing: var arr r.Term = r.Expr([]interface{}{map[interface{}]interface{}{'a': 1, }, map[interface{}]interface{}{'a': nil, }, map[interface{}]interface{}{}}).OrderBy('a')") arr := r.Expr([]interface{}{map[interface{}]interface{}{"a": 1}, map[interface{}]interface{}{"a": nil}, map[interface{}]interface{}{}}).OrderBy("a") _ = arr // Prevent any noused variable errors { // default.yaml line #118 /* [{'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}} /* arr.filter(lambda x:x['a'].eq(1)) */ suite.T().Log("About to run line #118: arr.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Eq(1)})") runAndAssert(suite.Suite, expected_, arr.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Eq(1) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #118") } { // default.yaml line #122 /* [{'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}} /* arr.filter(lambda x:x['a'].eq(1), default=False) */ suite.T().Log("About to run line #122: arr.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Eq(1)}).OptArgs(r.FilterOpts{Default: false, })") runAndAssert(suite.Suite, expected_, arr.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Eq(1) }).OptArgs(r.FilterOpts{Default: false}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #122") } { // default.yaml line #126 /* [{}, {'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{}, map[interface{}]interface{}{"a": 1}} /* arr.filter(lambda x:x['a'].eq(1), default=True) */ suite.T().Log("About to run line #126: arr.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Eq(1)}).OptArgs(r.FilterOpts{Default: true, })") runAndAssert(suite.Suite, expected_, arr.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Eq(1) }).OptArgs(r.FilterOpts{Default: true}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #126") } { // default.yaml line #131 /* [{}, {'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{}, map[interface{}]interface{}{"a": 1}} /* arr.filter(lambda x:x['a'].eq(1), default=r.js('true')) */ suite.T().Log("About to run line #131: arr.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Eq(1)}).OptArgs(r.FilterOpts{Default: r.JS('true'), })") runAndAssert(suite.Suite, expected_, arr.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Eq(1) }).OptArgs(r.FilterOpts{Default: r.JS("true")}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #131") } { // default.yaml line #135 /* [{'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}} /* arr.filter(lambda x:x['a'].eq(1), default=r.js('false')) */ suite.T().Log("About to run line #135: arr.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Eq(1)}).OptArgs(r.FilterOpts{Default: r.JS('false'), })") runAndAssert(suite.Suite, expected_, arr.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Eq(1) }).OptArgs(r.FilterOpts{Default: r.JS("false")}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #135") } { // default.yaml line #139 /* err("ReqlNonExistenceError", "No attribute `a` in object:", []) */ var expected_ Err = err("ReqlNonExistenceError", "No attribute `a` in object:") /* arr.filter(lambda x:x['a'].eq(1), default=r.error()) */ suite.T().Log("About to run line #139: arr.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Eq(1)}).OptArgs(r.FilterOpts{Default: r.Error(), })") runAndAssert(suite.Suite, expected_, arr.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Eq(1) }).OptArgs(r.FilterOpts{Default: r.Error()}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #139") } { // default.yaml line #144 /* [{'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}} /* r.expr(False).do(lambda d:arr.filter(lambda x:x['a'].eq(1), default=d)) */ suite.T().Log("About to run line #144: r.Expr(false).Do(func(d r.Term) interface{} { return arr.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Eq(1)}).OptArgs(r.FilterOpts{Default: d, })})") runAndAssert(suite.Suite, expected_, r.Expr(false).Do(func(d r.Term) interface{} { return arr.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Eq(1) }).OptArgs(r.FilterOpts{Default: d}) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #144") } { // default.yaml line #148 /* [{}, {'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{}, map[interface{}]interface{}{"a": 1}} /* r.expr(True).do(lambda d:arr.filter(lambda x:x['a'].eq(1), default=d)).order_by('a') */ suite.T().Log("About to run line #148: r.Expr(true).Do(func(d r.Term) interface{} { return arr.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Eq(1)}).OptArgs(r.FilterOpts{Default: d, })}).OrderBy('a')") runAndAssert(suite.Suite, expected_, r.Expr(true).Do(func(d r.Term) interface{} { return arr.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Eq(1) }).OptArgs(r.FilterOpts{Default: d}) }).OrderBy("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #148") } { // default.yaml line #154 /* [{'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}} /* arr.filter(lambda x:x['a'].default(0).eq(1)) */ suite.T().Log("About to run line #154: arr.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Default(0).Eq(1)})") runAndAssert(suite.Suite, expected_, arr.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Default(0).Eq(1) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #154") } { // default.yaml line #158 /* ([{}, {'a':null}, {'a':1}]) */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{}, map[interface{}]interface{}{"a": nil}, map[interface{}]interface{}{"a": 1}} /* arr.filter(lambda x:x['a'].default(1).eq(1)).order_by('a') */ suite.T().Log("About to run line #158: arr.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Default(1).Eq(1)}).OrderBy('a')") runAndAssert(suite.Suite, expected_, arr.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Default(1).Eq(1) }).OrderBy("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #158") } { // default.yaml line #162 /* [{'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}} /* arr.filter(lambda x:x['a'].default(r.error()).eq(1)) */ suite.T().Log("About to run line #162: arr.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Default(r.Error()).Eq(1)})") runAndAssert(suite.Suite, expected_, arr.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Default(r.Error()).Eq(1) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #162") } { // default.yaml line #168 /* [{'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}} /* r.expr(0).do(lambda i:arr.filter(lambda x:x['a'].default(i).eq(1))) */ suite.T().Log("About to run line #168: r.Expr(0).Do(func(i r.Term) interface{} { return arr.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Default(i).Eq(1)})})") runAndAssert(suite.Suite, expected_, r.Expr(0).Do(func(i r.Term) interface{} { return arr.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Default(i).Eq(1) }) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #168") } { // default.yaml line #172 /* ([{},{'a':null},{'a':1}]) */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{}, map[interface{}]interface{}{"a": nil}, map[interface{}]interface{}{"a": 1}} /* r.expr(1).do(lambda i:arr.filter(lambda x:x['a'].default(i).eq(1))).order_by('a') */ suite.T().Log("About to run line #172: r.Expr(1).Do(func(i r.Term) interface{} { return arr.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Default(i).Eq(1)})}).OrderBy('a')") runAndAssert(suite.Suite, expected_, r.Expr(1).Do(func(i r.Term) interface{} { return arr.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Default(i).Eq(1) }) }).OrderBy("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #172") } { // default.yaml line #177 /* [{'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}} /* arr.filter(lambda x:r.or_(x['a'].eq(1), x['a']['b'].eq(2))) */ suite.T().Log("About to run line #177: arr.Filter(func(x r.Term) interface{} { return r.Or(x.AtIndex('a').Eq(1), x.AtIndex('a').AtIndex('b').Eq(2))})") runAndAssert(suite.Suite, expected_, arr.Filter(func(x r.Term) interface{} { return r.Or(x.AtIndex("a").Eq(1), x.AtIndex("a").AtIndex("b").Eq(2)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #177") } { // default.yaml line #181 /* [{'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}} /* arr.filter(lambda x:r.or_(x['a'].eq(1), x['a']['b'].eq(2)), default=False) */ suite.T().Log("About to run line #181: arr.Filter(func(x r.Term) interface{} { return r.Or(x.AtIndex('a').Eq(1), x.AtIndex('a').AtIndex('b').Eq(2))}).OptArgs(r.FilterOpts{Default: false, })") runAndAssert(suite.Suite, expected_, arr.Filter(func(x r.Term) interface{} { return r.Or(x.AtIndex("a").Eq(1), x.AtIndex("a").AtIndex("b").Eq(2)) }).OptArgs(r.FilterOpts{Default: false}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #181") } { // default.yaml line #185 /* ([{}, {'a':null}, {'a':1}]) */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{}, map[interface{}]interface{}{"a": nil}, map[interface{}]interface{}{"a": 1}} /* arr.filter(lambda x:r.or_(x['a'].eq(1), x['a']['b'].eq(2)), default=True).order_by('a') */ suite.T().Log("About to run line #185: arr.Filter(func(x r.Term) interface{} { return r.Or(x.AtIndex('a').Eq(1), x.AtIndex('a').AtIndex('b').Eq(2))}).OptArgs(r.FilterOpts{Default: true, }).OrderBy('a')") runAndAssert(suite.Suite, expected_, arr.Filter(func(x r.Term) interface{} { return r.Or(x.AtIndex("a").Eq(1), x.AtIndex("a").AtIndex("b").Eq(2)) }).OptArgs(r.FilterOpts{Default: true}).OrderBy("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #185") } { // default.yaml line #189 /* err("ReqlNonExistenceError", "No attribute `a` in object:", []) */ var expected_ Err = err("ReqlNonExistenceError", "No attribute `a` in object:") /* arr.filter(lambda x:r.or_(x['a'].eq(1), x['a']['b'].eq(2)), default=r.error()) */ suite.T().Log("About to run line #189: arr.Filter(func(x r.Term) interface{} { return r.Or(x.AtIndex('a').Eq(1), x.AtIndex('a').AtIndex('b').Eq(2))}).OptArgs(r.FilterOpts{Default: r.Error(), })") runAndAssert(suite.Suite, expected_, arr.Filter(func(x r.Term) interface{} { return r.Or(x.AtIndex("a").Eq(1), x.AtIndex("a").AtIndex("b").Eq(2)) }).OptArgs(r.FilterOpts{Default: r.Error()}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #189") } { // default.yaml line #193 /* partial({'tables_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) /* r.table_create('default_test') */ suite.T().Log("About to run line #193: r.TableCreate('default_test')") runAndAssert(suite.Suite, expected_, r.TableCreate("default_test"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #193") } { // default.yaml line #196 /* ({'deleted':0,'replaced':0,'generated_keys':arrlen(3,uuid()),'unchanged':0,'errors':0,'skipped':0,'inserted':3}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0, "replaced": 0, "generated_keys": arrlen(3, compare.IsUUID()), "unchanged": 0, "errors": 0, "skipped": 0, "inserted": 3} /* r.table('default_test').insert(arr) */ suite.T().Log("About to run line #196: r.Table('default_test').Insert(arr)") runAndAssert(suite.Suite, expected_, r.Table("default_test").Insert(arr), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #196") } // default.yaml line #199 // tbl = r.table('default_test').order_by('a').pluck('a') suite.T().Log("Possibly executing: var tbl r.Term = r.Table('default_test').OrderBy('a').Pluck('a')") tbl := r.Table("default_test").OrderBy("a").Pluck("a") _ = tbl // Prevent any noused variable errors { // default.yaml line #202 /* [{'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}} /* tbl.filter(lambda x:x['a'].eq(1)) */ suite.T().Log("About to run line #202: tbl.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Eq(1)})") runAndAssert(suite.Suite, expected_, tbl.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Eq(1) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #202") } { // default.yaml line #206 /* [{'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}} /* tbl.filter(lambda x:x['a'].eq(1), default=False) */ suite.T().Log("About to run line #206: tbl.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Eq(1)}).OptArgs(r.FilterOpts{Default: false, })") runAndAssert(suite.Suite, expected_, tbl.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Eq(1) }).OptArgs(r.FilterOpts{Default: false}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #206") } { // default.yaml line #210 /* [{}, {'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{}, map[interface{}]interface{}{"a": 1}} /* tbl.filter(lambda x:x['a'].eq(1), default=True) */ suite.T().Log("About to run line #210: tbl.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Eq(1)}).OptArgs(r.FilterOpts{Default: true, })") runAndAssert(suite.Suite, expected_, tbl.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Eq(1) }).OptArgs(r.FilterOpts{Default: true}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #210") } { // default.yaml line #215 /* err("ReqlNonExistenceError", "No attribute `a` in object:", []) */ var expected_ Err = err("ReqlNonExistenceError", "No attribute `a` in object:") /* tbl.filter(lambda x:x['a'].eq(1), default=r.error()) */ suite.T().Log("About to run line #215: tbl.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Eq(1)}).OptArgs(r.FilterOpts{Default: r.Error(), })") runAndAssert(suite.Suite, expected_, tbl.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Eq(1) }).OptArgs(r.FilterOpts{Default: r.Error()}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #215") } { // default.yaml line #220 /* [{'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}} /* r.expr(False).do(lambda d:tbl.filter(lambda x:x['a'].eq(1), default=d)) */ suite.T().Log("About to run line #220: r.Expr(false).Do(func(d r.Term) interface{} { return tbl.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Eq(1)}).OptArgs(r.FilterOpts{Default: d, })})") runAndAssert(suite.Suite, expected_, r.Expr(false).Do(func(d r.Term) interface{} { return tbl.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Eq(1) }).OptArgs(r.FilterOpts{Default: d}) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #220") } { // default.yaml line #224 /* [{}, {'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{}, map[interface{}]interface{}{"a": 1}} /* r.expr(True).do(lambda d:tbl.filter(lambda x:x['a'].eq(1), default=d)).order_by('a') */ suite.T().Log("About to run line #224: r.Expr(true).Do(func(d r.Term) interface{} { return tbl.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Eq(1)}).OptArgs(r.FilterOpts{Default: d, })}).OrderBy('a')") runAndAssert(suite.Suite, expected_, r.Expr(true).Do(func(d r.Term) interface{} { return tbl.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Eq(1) }).OptArgs(r.FilterOpts{Default: d}) }).OrderBy("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #224") } { // default.yaml line #230 /* [{'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}} /* tbl.filter(lambda x:x['a'].default(0).eq(1)) */ suite.T().Log("About to run line #230: tbl.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Default(0).Eq(1)})") runAndAssert(suite.Suite, expected_, tbl.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Default(0).Eq(1) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #230") } { // default.yaml line #234 /* ([{}, {'a':null}, {'a':1}]) */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{}, map[interface{}]interface{}{"a": nil}, map[interface{}]interface{}{"a": 1}} /* tbl.filter(lambda x:x['a'].default(1).eq(1)).order_by('a') */ suite.T().Log("About to run line #234: tbl.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Default(1).Eq(1)}).OrderBy('a')") runAndAssert(suite.Suite, expected_, tbl.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Default(1).Eq(1) }).OrderBy("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #234") } { // default.yaml line #238 /* [{'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}} /* tbl.filter(lambda x:x['a'].default(r.error()).eq(1)) */ suite.T().Log("About to run line #238: tbl.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Default(r.Error()).Eq(1)})") runAndAssert(suite.Suite, expected_, tbl.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Default(r.Error()).Eq(1) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #238") } { // default.yaml line #244 /* [{'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}} /* r.expr(0).do(lambda i:tbl.filter(lambda x:x['a'].default(i).eq(1))) */ suite.T().Log("About to run line #244: r.Expr(0).Do(func(i r.Term) interface{} { return tbl.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Default(i).Eq(1)})})") runAndAssert(suite.Suite, expected_, r.Expr(0).Do(func(i r.Term) interface{} { return tbl.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Default(i).Eq(1) }) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #244") } { // default.yaml line #248 /* ([{},{'a':null},{'a':1}]) */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{}, map[interface{}]interface{}{"a": nil}, map[interface{}]interface{}{"a": 1}} /* r.expr(1).do(lambda i:tbl.filter(lambda x:x['a'].default(i).eq(1))).order_by('a') */ suite.T().Log("About to run line #248: r.Expr(1).Do(func(i r.Term) interface{} { return tbl.Filter(func(x r.Term) interface{} { return x.AtIndex('a').Default(i).Eq(1)})}).OrderBy('a')") runAndAssert(suite.Suite, expected_, r.Expr(1).Do(func(i r.Term) interface{} { return tbl.Filter(func(x r.Term) interface{} { return x.AtIndex("a").Default(i).Eq(1) }) }).OrderBy("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #248") } { // default.yaml line #253 /* [{'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}} /* tbl.filter(lambda x:r.or_(x['a'].eq(1), x['a']['b'].eq(2))) */ suite.T().Log("About to run line #253: tbl.Filter(func(x r.Term) interface{} { return r.Or(x.AtIndex('a').Eq(1), x.AtIndex('a').AtIndex('b').Eq(2))})") runAndAssert(suite.Suite, expected_, tbl.Filter(func(x r.Term) interface{} { return r.Or(x.AtIndex("a").Eq(1), x.AtIndex("a").AtIndex("b").Eq(2)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #253") } { // default.yaml line #257 /* [{'a':1}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}} /* tbl.filter(lambda x:r.or_(x['a'].eq(1), x['a']['b'].eq(2)), default=False) */ suite.T().Log("About to run line #257: tbl.Filter(func(x r.Term) interface{} { return r.Or(x.AtIndex('a').Eq(1), x.AtIndex('a').AtIndex('b').Eq(2))}).OptArgs(r.FilterOpts{Default: false, })") runAndAssert(suite.Suite, expected_, tbl.Filter(func(x r.Term) interface{} { return r.Or(x.AtIndex("a").Eq(1), x.AtIndex("a").AtIndex("b").Eq(2)) }).OptArgs(r.FilterOpts{Default: false}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #257") } { // default.yaml line #261 /* ([{}, {'a':null}, {'a':1}]) */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{}, map[interface{}]interface{}{"a": nil}, map[interface{}]interface{}{"a": 1}} /* tbl.filter(lambda x:r.or_(x['a'].eq(1), x['a']['b'].eq(2)), default=True).order_by('a') */ suite.T().Log("About to run line #261: tbl.Filter(func(x r.Term) interface{} { return r.Or(x.AtIndex('a').Eq(1), x.AtIndex('a').AtIndex('b').Eq(2))}).OptArgs(r.FilterOpts{Default: true, }).OrderBy('a')") runAndAssert(suite.Suite, expected_, tbl.Filter(func(x r.Term) interface{} { return r.Or(x.AtIndex("a").Eq(1), x.AtIndex("a").AtIndex("b").Eq(2)) }).OptArgs(r.FilterOpts{Default: true}).OrderBy("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #261") } { // default.yaml line #265 /* err("ReqlNonExistenceError", "No attribute `a` in object:", []) */ var expected_ Err = err("ReqlNonExistenceError", "No attribute `a` in object:") /* tbl.filter(lambda x:r.or_(x['a'].eq(1), x['a']['b'].eq(2)), default=r.error()) */ suite.T().Log("About to run line #265: tbl.Filter(func(x r.Term) interface{} { return r.Or(x.AtIndex('a').Eq(1), x.AtIndex('a').AtIndex('b').Eq(2))}).OptArgs(r.FilterOpts{Default: r.Error(), })") runAndAssert(suite.Suite, expected_, tbl.Filter(func(x r.Term) interface{} { return r.Or(x.AtIndex("a").Eq(1), x.AtIndex("a").AtIndex("b").Eq(2)) }).OptArgs(r.FilterOpts{Default: r.Error()}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #265") } { // default.yaml line #269 /* partial({'tables_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) /* r.table_drop('default_test') */ suite.T().Log("About to run line #269: r.TableDrop('default_test')") runAndAssert(suite.Suite, expected_, r.TableDrop("default_test"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #269") } }
func (suite *ChangefeedsIdxcopySuite) TestCases() { suite.T().Log("Running ChangefeedsIdxcopySuite: Test duplicate indexes with squashing") tbl := r.DB("test").Table("tbl") _ = tbl // Prevent any noused variable errors { // changefeeds/idxcopy.yaml line #4 /* partial({'created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"created": 1}) /* tbl.index_create('a') */ suite.T().Log("About to run line #4: tbl.IndexCreate('a')") runAndAssert(suite.Suite, expected_, tbl.IndexCreate("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #4") } { // changefeeds/idxcopy.yaml line #6 /* AnythingIsFine */ var expected_ string = compare.AnythingIsFine /* tbl.index_wait('a') */ suite.T().Log("About to run line #6: tbl.IndexWait('a')") runAndAssert(suite.Suite, expected_, tbl.IndexWait("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #6") } // changefeeds/idxcopy.yaml line #8 // feed = tbl.order_by(index='a').limit(10).changes(squash=2).limit(9) suite.T().Log("Possibly executing: var feed r.Term = tbl.OrderBy().OptArgs(r.OrderByOpts{Index: 'a', }).Limit(10).Changes().OptArgs(r.ChangesOpts{Squash: 2, }).Limit(9)") feed := maybeRun(tbl.OrderBy().OptArgs(r.OrderByOpts{Index: "a"}).Limit(10).Changes().OptArgs(r.ChangesOpts{Squash: 2}).Limit(9), suite.session, r.RunOpts{ MaxBatchRows: 1, }) _ = feed // Prevent any noused variable errors { // changefeeds/idxcopy.yaml line #15 /* partial({'inserted':12, 'errors':0}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"inserted": 12, "errors": 0}) /* tbl.insert(r.range(0, 12).map({'id':r.row, 'a':5})) */ suite.T().Log("About to run line #15: tbl.Insert(r.Range(0, 12).Map(map[interface{}]interface{}{'id': r.Row, 'a': 5, }))") runAndAssert(suite.Suite, expected_, tbl.Insert(r.Range(0, 12).Map(map[interface{}]interface{}{"id": r.Row, "a": 5})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #15") } { // changefeeds/idxcopy.yaml line #20 /* partial({'deleted':3, 'errors':0}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"deleted": 3, "errors": 0}) /* tbl.get_all(1, 8, 9, index='id').delete() */ suite.T().Log("About to run line #20: tbl.GetAll(1, 8, 9).OptArgs(r.GetAllOpts{Index: 'id', }).Delete()") runAndAssert(suite.Suite, expected_, tbl.GetAll(1, 8, 9).OptArgs(r.GetAllOpts{Index: "id"}).Delete(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #20") } { // changefeeds/idxcopy.yaml line #26 /* AnythingIsFine */ var expected_ string = compare.AnythingIsFine /* wait(2) */ suite.T().Log("About to run line #26: wait(2)") actual := wait(2) compare.Assert(suite.T(), expected_, actual) suite.T().Log("Finished running line #26") } { // changefeeds/idxcopy.yaml line #28 /* bag([ {"new_val":{"a":5, "id":0}, "old_val":nil}, {"new_val":{"a":5, "id":2}, "old_val":nil}, {"new_val":{"a":5, "id":3}, "old_val":nil}, {"new_val":{"a":5, "id":4}, "old_val":nil}, {"new_val":{"a":5, "id":5}, "old_val":nil}, {"new_val":{"a":5, "id":6}, "old_val":nil}, {"new_val":{"a":5, "id":7}, "old_val":nil}, {"new_val":{"a":5, "id":10}, "old_val":nil}, {"new_val":{"a":5, "id":11}, "old_val":nil}]) */ var expected_ compare.Expected = compare.UnorderedMatch([]interface{}{map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"a": 5, "id": 0}, "old_val": nil}, map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"a": 5, "id": 2}, "old_val": nil}, map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"a": 5, "id": 3}, "old_val": nil}, map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"a": 5, "id": 4}, "old_val": nil}, map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"a": 5, "id": 5}, "old_val": nil}, map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"a": 5, "id": 6}, "old_val": nil}, map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"a": 5, "id": 7}, "old_val": nil}, map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"a": 5, "id": 10}, "old_val": nil}, map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"a": 5, "id": 11}, "old_val": nil}}) /* fetch(feed) */ suite.T().Log("About to run line #28: fetch(feed, 0)") fetchAndAssert(suite.Suite, expected_, feed, 0) suite.T().Log("Finished running line #28") } }
func (suite *MutationInsertSuite) TestCases() { suite.T().Log("Running MutationInsertSuite: Tests insertion into tables") tbl := r.DB("test").Table("tbl") _ = tbl // Prevent any noused variable errors { // mutation/insert.yaml line #6 /* partial({'tables_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) /* r.db('test').table_create('test2') */ suite.T().Log("About to run line #6: r.DB('test').TableCreate('test2')") runAndAssert(suite.Suite, expected_, r.DB("test").TableCreate("test2"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #6") } // mutation/insert.yaml line #9 // tbl2 = r.db('test').table('test2') suite.T().Log("Possibly executing: var tbl2 r.Term = r.DB('test').Table('test2')") tbl2 := r.DB("test").Table("test2") _ = tbl2 // Prevent any noused variable errors { // mutation/insert.yaml line #12 /* {'deleted':0,'replaced':0,'unchanged':0,'errors':0,'skipped':0,'inserted':1} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0, "replaced": 0, "unchanged": 0, "errors": 0, "skipped": 0, "inserted": 1} /* tbl.insert({'id':0,'a':0}) */ suite.T().Log("About to run line #12: tbl.Insert(map[interface{}]interface{}{'id': 0, 'a': 0, })") runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"id": 0, "a": 0}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #12") } { // mutation/insert.yaml line #14 /* 1 */ var expected_ int = 1 /* tbl.count() */ suite.T().Log("About to run line #14: tbl.Count()") runAndAssert(suite.Suite, expected_, tbl.Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #14") } { // mutation/insert.yaml line #18 /* {'deleted':0,'replaced':0,'unchanged':0,'errors':0,'skipped':0,'inserted':1} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0, "replaced": 0, "unchanged": 0, "errors": 0, "skipped": 0, "inserted": 1} /* tbl.insert({'id':1, 'a':1}, durability='hard') */ suite.T().Log("About to run line #18: tbl.Insert(map[interface{}]interface{}{'id': 1, 'a': 1, }).OptArgs(r.InsertOpts{Durability: 'hard', })") runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"id": 1, "a": 1}).OptArgs(r.InsertOpts{Durability: "hard"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #18") } { // mutation/insert.yaml line #22 /* 2 */ var expected_ int = 2 /* tbl.count() */ suite.T().Log("About to run line #22: tbl.Count()") runAndAssert(suite.Suite, expected_, tbl.Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #22") } { // mutation/insert.yaml line #26 /* {'deleted':0,'replaced':0,'unchanged':0,'errors':0,'skipped':0,'inserted':1} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0, "replaced": 0, "unchanged": 0, "errors": 0, "skipped": 0, "inserted": 1} /* tbl.insert({'id':2, 'a':2}, durability='soft') */ suite.T().Log("About to run line #26: tbl.Insert(map[interface{}]interface{}{'id': 2, 'a': 2, }).OptArgs(r.InsertOpts{Durability: 'soft', })") runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"id": 2, "a": 2}).OptArgs(r.InsertOpts{Durability: "soft"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #26") } { // mutation/insert.yaml line #30 /* 3 */ var expected_ int = 3 /* tbl.count() */ suite.T().Log("About to run line #30: tbl.Count()") runAndAssert(suite.Suite, expected_, tbl.Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #30") } { // mutation/insert.yaml line #34 /* err('ReqlQueryLogicError', 'Durability option `wrong` unrecognized (options are "hard" and "soft").', [0]) */ var expected_ Err = err("ReqlQueryLogicError", "Durability option `wrong` unrecognized (options are \"hard\" and \"soft\").") /* tbl.insert({'id':3, 'a':3}, durability='wrong') */ suite.T().Log("About to run line #34: tbl.Insert(map[interface{}]interface{}{'id': 3, 'a': 3, }).OptArgs(r.InsertOpts{Durability: 'wrong', })") runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"id": 3, "a": 3}).OptArgs(r.InsertOpts{Durability: "wrong"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #34") } { // mutation/insert.yaml line #38 /* 3 */ var expected_ int = 3 /* tbl.count() */ suite.T().Log("About to run line #38: tbl.Count()") runAndAssert(suite.Suite, expected_, tbl.Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #38") } { // mutation/insert.yaml line #42 /* {'deleted':1,'replaced':0,'unchanged':0,'errors':0,'skipped':0,'inserted':0} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 1, "replaced": 0, "unchanged": 0, "errors": 0, "skipped": 0, "inserted": 0} /* tbl.get(2).delete() */ suite.T().Log("About to run line #42: tbl.Get(2).Delete()") runAndAssert(suite.Suite, expected_, tbl.Get(2).Delete(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #42") } { // mutation/insert.yaml line #46 /* {'deleted':0,'replaced':0,'unchanged':0,'errors':0,'skipped':0,'inserted':2} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0, "replaced": 0, "unchanged": 0, "errors": 0, "skipped": 0, "inserted": 2} /* tbl.insert([{'id':2,'a':2}, {'id':3,'a':3}]) */ suite.T().Log("About to run line #46: tbl.Insert([]interface{}{map[interface{}]interface{}{'id': 2, 'a': 2, }, map[interface{}]interface{}{'id': 3, 'a': 3, }})") runAndAssert(suite.Suite, expected_, tbl.Insert([]interface{}{map[interface{}]interface{}{"id": 2, "a": 2}, map[interface{}]interface{}{"id": 3, "a": 3}}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #46") } { // mutation/insert.yaml line #50 /* {'deleted':0,'replaced':0,'unchanged':0,'errors':0,'skipped':0,'inserted':4} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0, "replaced": 0, "unchanged": 0, "errors": 0, "skipped": 0, "inserted": 4} /* tbl2.insert(tbl) */ suite.T().Log("About to run line #50: tbl2.Insert(tbl)") runAndAssert(suite.Suite, expected_, tbl2.Insert(tbl), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #50") } { // mutation/insert.yaml line #54 /* {'first_error':"Duplicate primary key `id`:\n{\n\t\"a\":\t2,\n\t\"id\":\t2\n}\n{\n\t\"b\":\t20,\n\t\"id\":\t2\n}",'deleted':0,'replaced':0,'unchanged':0,'errors':1,'skipped':0,'inserted':0} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"first_error": "Duplicate primary key `id`:\n{\n\t\"a\":\t2,\n\t\"id\":\t2\n}\n{\n\t\"b\":\t20,\n\t\"id\":\t2\n}", "deleted": 0, "replaced": 0, "unchanged": 0, "errors": 1, "skipped": 0, "inserted": 0} /* tbl.insert({'id':2,'b':20}) */ suite.T().Log("About to run line #54: tbl.Insert(map[interface{}]interface{}{'id': 2, 'b': 20, })") runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"id": 2, "b": 20}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #54") } { // mutation/insert.yaml line #58 /* {'first_error':"Duplicate primary key `id`:\n{\n\t\"a\":\t2,\n\t\"id\":\t2\n}\n{\n\t\"b\":\t20,\n\t\"id\":\t2\n}",'deleted':0,'replaced':0,'unchanged':0,'errors':1,'skipped':0,'inserted':0} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"first_error": "Duplicate primary key `id`:\n{\n\t\"a\":\t2,\n\t\"id\":\t2\n}\n{\n\t\"b\":\t20,\n\t\"id\":\t2\n}", "deleted": 0, "replaced": 0, "unchanged": 0, "errors": 1, "skipped": 0, "inserted": 0} /* tbl.insert({'id':2,'b':20}, conflict='error') */ suite.T().Log("About to run line #58: tbl.Insert(map[interface{}]interface{}{'id': 2, 'b': 20, }).OptArgs(r.InsertOpts{Conflict: 'error', })") runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"id": 2, "b": 20}).OptArgs(r.InsertOpts{Conflict: "error"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #58") } { // mutation/insert.yaml line #64 /* {'deleted':0,'replaced':0,'unchanged':0,'errors':0,'skipped':0,'inserted':1} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0, "replaced": 0, "unchanged": 0, "errors": 0, "skipped": 0, "inserted": 1} /* tbl.insert({'id':15,'b':20}, conflict='error') */ suite.T().Log("About to run line #64: tbl.Insert(map[interface{}]interface{}{'id': 15, 'b': 20, }).OptArgs(r.InsertOpts{Conflict: 'error', })") runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"id": 15, "b": 20}).OptArgs(r.InsertOpts{Conflict: "error"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #64") } { // mutation/insert.yaml line #69 /* {'id':15,'b':20} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 15, "b": 20} /* tbl.get(15) */ suite.T().Log("About to run line #69: tbl.Get(15)") runAndAssert(suite.Suite, expected_, tbl.Get(15), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #69") } { // mutation/insert.yaml line #73 /* {'deleted':0,'replaced':1,'unchanged':0,'errors':0,'skipped':0,'inserted':0} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0, "replaced": 1, "unchanged": 0, "errors": 0, "skipped": 0, "inserted": 0} /* tbl.insert({'id':2,'b':20}, conflict='replace') */ suite.T().Log("About to run line #73: tbl.Insert(map[interface{}]interface{}{'id': 2, 'b': 20, }).OptArgs(r.InsertOpts{Conflict: 'replace', })") runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"id": 2, "b": 20}).OptArgs(r.InsertOpts{Conflict: "replace"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #73") } { // mutation/insert.yaml line #78 /* {'id':2,'b':20} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 2, "b": 20} /* tbl.get(2) */ suite.T().Log("About to run line #78: tbl.Get(2)") runAndAssert(suite.Suite, expected_, tbl.Get(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #78") } { // mutation/insert.yaml line #82 /* {'deleted':0,'replaced':0,'unchanged':0,'errors':0,'skipped':0,'inserted':1} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0, "replaced": 0, "unchanged": 0, "errors": 0, "skipped": 0, "inserted": 1} /* tbl.insert({'id':20,'b':20}, conflict='replace') */ suite.T().Log("About to run line #82: tbl.Insert(map[interface{}]interface{}{'id': 20, 'b': 20, }).OptArgs(r.InsertOpts{Conflict: 'replace', })") runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"id": 20, "b": 20}).OptArgs(r.InsertOpts{Conflict: "replace"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #82") } { // mutation/insert.yaml line #87 /* {'id':20,'b':20} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 20, "b": 20} /* tbl.get(20) */ suite.T().Log("About to run line #87: tbl.Get(20)") runAndAssert(suite.Suite, expected_, tbl.Get(20), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #87") } { // mutation/insert.yaml line #91 /* {'deleted':0,'replaced':1,'unchanged':0,'errors':0,'skipped':0,'inserted':0} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0, "replaced": 1, "unchanged": 0, "errors": 0, "skipped": 0, "inserted": 0} /* tbl.insert({'id':2,'c':30}, conflict='update') */ suite.T().Log("About to run line #91: tbl.Insert(map[interface{}]interface{}{'id': 2, 'c': 30, }).OptArgs(r.InsertOpts{Conflict: 'update', })") runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"id": 2, "c": 30}).OptArgs(r.InsertOpts{Conflict: "update"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #91") } { // mutation/insert.yaml line #96 /* {'id':2, 'b':20, 'c':30} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 2, "b": 20, "c": 30} /* tbl.get(2) */ suite.T().Log("About to run line #96: tbl.Get(2)") runAndAssert(suite.Suite, expected_, tbl.Get(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #96") } { // mutation/insert.yaml line #100 /* {'deleted':0,'replaced':0,'unchanged':0,'errors':0,'skipped':0,'inserted':1} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0, "replaced": 0, "unchanged": 0, "errors": 0, "skipped": 0, "inserted": 1} /* tbl.insert({'id':30,'b':20}, conflict='update') */ suite.T().Log("About to run line #100: tbl.Insert(map[interface{}]interface{}{'id': 30, 'b': 20, }).OptArgs(r.InsertOpts{Conflict: 'update', })") runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"id": 30, "b": 20}).OptArgs(r.InsertOpts{Conflict: "update"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #100") } { // mutation/insert.yaml line #105 /* {'id':30,'b':20} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 30, "b": 20} /* tbl.get(30) */ suite.T().Log("About to run line #105: tbl.Get(30)") runAndAssert(suite.Suite, expected_, tbl.Get(30), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #105") } { // mutation/insert.yaml line #109 /* err('ReqlQueryLogicError', 'Conflict option `wrong` unrecognized (options are "error", "replace" and "update").', [0]) */ var expected_ Err = err("ReqlQueryLogicError", "Conflict option `wrong` unrecognized (options are \"error\", \"replace\" and \"update\").") /* tbl.insert({'id':3, 'a':3}, conflict='wrong') */ suite.T().Log("About to run line #109: tbl.Insert(map[interface{}]interface{}{'id': 3, 'a': 3, }).OptArgs(r.InsertOpts{Conflict: 'wrong', })") runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"id": 3, "a": 3}).OptArgs(r.InsertOpts{Conflict: "wrong"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #109") } // mutation/insert.yaml line #120 // tblpkey = r.db('test').table('testpkey') suite.T().Log("Possibly executing: var tblpkey r.Term = r.DB('test').Table('testpkey')") tblpkey := r.DB("test").Table("testpkey") _ = tblpkey // Prevent any noused variable errors { // mutation/insert.yaml line #115 /* partial({'tables_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) /* r.db('test').table_create('testpkey', primary_key='foo') */ suite.T().Log("About to run line #115: r.DB('test').TableCreate('testpkey').OptArgs(r.TableCreateOpts{PrimaryKey: 'foo', })") runAndAssert(suite.Suite, expected_, r.DB("test").TableCreate("testpkey").OptArgs(r.TableCreateOpts{PrimaryKey: "foo"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #115") } { // mutation/insert.yaml line #122 /* {'deleted':0,'replaced':0,'generated_keys':arrlen(1,uuid()),'unchanged':0,'errors':0,'skipped':0,'inserted':1} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0, "replaced": 0, "generated_keys": arrlen(1, compare.IsUUID()), "unchanged": 0, "errors": 0, "skipped": 0, "inserted": 1} /* tblpkey.insert({}) */ suite.T().Log("About to run line #122: tblpkey.Insert(map[interface{}]interface{}{})") runAndAssert(suite.Suite, expected_, tblpkey.Insert(map[interface{}]interface{}{}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #122") } { // mutation/insert.yaml line #125 /* [{'foo':uuid()}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"foo": compare.IsUUID()}} /* tblpkey */ suite.T().Log("About to run line #125: tblpkey") runAndAssert(suite.Suite, expected_, tblpkey, suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #125") } { // mutation/insert.yaml line #129 /* {'deleted':0,'replaced':0,'generated_keys':arrlen(1,uuid()),'unchanged':0,'errors':0,'skipped':0,'inserted':1} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0, "replaced": 0, "generated_keys": arrlen(1, compare.IsUUID()), "unchanged": 0, "errors": 0, "skipped": 0, "inserted": 1} /* tblpkey.insert({'b':20}, conflict='replace') */ suite.T().Log("About to run line #129: tblpkey.Insert(map[interface{}]interface{}{'b': 20, }).OptArgs(r.InsertOpts{Conflict: 'replace', })") runAndAssert(suite.Suite, expected_, tblpkey.Insert(map[interface{}]interface{}{"b": 20}).OptArgs(r.InsertOpts{Conflict: "replace"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #129") } { // mutation/insert.yaml line #135 /* {'deleted':0,'replaced':0,'generated_keys':arrlen(1,uuid()),'unchanged':0,'errors':0,'skipped':0,'inserted':1} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0, "replaced": 0, "generated_keys": arrlen(1, compare.IsUUID()), "unchanged": 0, "errors": 0, "skipped": 0, "inserted": 1} /* tblpkey.insert({'b':20}, conflict='update') */ suite.T().Log("About to run line #135: tblpkey.Insert(map[interface{}]interface{}{'b': 20, }).OptArgs(r.InsertOpts{Conflict: 'update', })") runAndAssert(suite.Suite, expected_, tblpkey.Insert(map[interface{}]interface{}{"b": 20}).OptArgs(r.InsertOpts{Conflict: "update"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #135") } { // mutation/insert.yaml line #140 /* partial({'tables_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) /* r.db('test').table_drop('testpkey') */ suite.T().Log("About to run line #140: r.DB('test').TableDrop('testpkey')") runAndAssert(suite.Suite, expected_, r.DB("test").TableDrop("testpkey"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #140") } { // mutation/insert.yaml line #144 /* {'deleted':0,'replaced':0,'unchanged':0,'errors':0,'skipped':0,'inserted':7} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0, "replaced": 0, "unchanged": 0, "errors": 0, "skipped": 0, "inserted": 7} /* tbl.for_each(lambda row: tbl2.insert(row.merge({'id':row['id'] + 100 })) ) */ suite.T().Log("About to run line #144: tbl.ForEach(func(row r.Term) interface{} { return tbl2.Insert(row.Merge(map[interface{}]interface{}{'id': row.AtIndex('id').Add(100), }))})") runAndAssert(suite.Suite, expected_, tbl.ForEach(func(row r.Term) interface{} { return tbl2.Insert(row.Merge(map[interface{}]interface{}{"id": row.AtIndex("id").Add(100)})) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #144") } { // mutation/insert.yaml line #150 /* partial({'errors':1,'first_error':'`r.minval` and `r.maxval` cannot be written to disk.'}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 1, "first_error": "`r.minval` and `r.maxval` cannot be written to disk."}) /* tbl.insert({'value':r.minval}) */ suite.T().Log("About to run line #150: tbl.Insert(map[interface{}]interface{}{'value': r.MinVal, })") runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"value": r.MinVal}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #150") } { // mutation/insert.yaml line #154 /* partial({'errors':1,'first_error':'`r.minval` and `r.maxval` cannot be written to disk.'}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 1, "first_error": "`r.minval` and `r.maxval` cannot be written to disk."}) /* tbl.insert({'value':r.maxval}) */ suite.T().Log("About to run line #154: tbl.Insert(map[interface{}]interface{}{'value': r.MaxVal, })") runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"value": r.MaxVal}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #154") } { // mutation/insert.yaml line #159 /* {'changes': [{'new_val': {'id': 666}, 'old_val': None},{'error': 'Duplicate primary key `id`:\n{\n\t"id":\t666\n}\n{\n\t"id":\t666\n}','new_val': {'id': 666},'old_val': {'id': 666}}],'deleted': 0,'errors': 1,'first_error': 'Duplicate primary key `id`:\n{\n\t"id":\t666\n}\n{\n\t"id":\t666\n}','inserted': 1,'replaced': 0,'skipped': 0,'unchanged': 0} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"changes": []interface{}{map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"id": 666}, "old_val": nil}, map[interface{}]interface{}{"error": "Duplicate primary key `id`:\n{\n\t\"id\":\t666\n}\n{\n\t\"id\":\t666\n}", "new_val": map[interface{}]interface{}{"id": 666}, "old_val": map[interface{}]interface{}{"id": 666}}}, "deleted": 0, "errors": 1, "first_error": "Duplicate primary key `id`:\n{\n\t\"id\":\t666\n}\n{\n\t\"id\":\t666\n}", "inserted": 1, "replaced": 0, "skipped": 0, "unchanged": 0} /* tbl.insert([{'id':666}, {'id':666}], return_changes="always") */ suite.T().Log("About to run line #159: tbl.Insert([]interface{}{map[interface{}]interface{}{'id': 666, }, map[interface{}]interface{}{'id': 666, }}).OptArgs(r.InsertOpts{ReturnChanges: 'always', })") runAndAssert(suite.Suite, expected_, tbl.Insert([]interface{}{map[interface{}]interface{}{"id": 666}, map[interface{}]interface{}{"id": 666}}).OptArgs(r.InsertOpts{ReturnChanges: "always"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #159") } { // mutation/insert.yaml line #163 /* partial({'changes':[{'old_val': None, 'new_val': {'id': 100+i, 'ordered-num': i}} for i in range(1,100)] }) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"changes": (func() []interface{} { res := []interface{}{} for iterator_ := 1; iterator_ < 100; iterator_++ { i := iterator_ res = append(res, map[interface{}]interface{}{"old_val": nil, "new_val": map[interface{}]interface{}{"id": 100 + i, "ordered-num": i}}) } return res }())}) /* tbl.insert([{'id':100+i, 'ordered-num':i} for i in range(1,100)], return_changes="always") */ suite.T().Log("About to run line #163: tbl.Insert((func() []interface{} {\n res := []interface{}{}\n for iterator_ := 1; iterator_ < 100; iterator_++ {\n i := iterator_\n res = append(res, map[interface{}]interface{}{'id': r.Add(100, i), 'ordered-num': i, })\n }\n return res\n}())).OptArgs(r.InsertOpts{ReturnChanges: 'always', })") runAndAssert(suite.Suite, expected_, tbl.Insert((func() []interface{} { res := []interface{}{} for iterator_ := 1; iterator_ < 100; iterator_++ { i := iterator_ res = append(res, map[interface{}]interface{}{"id": r.Add(100, i), "ordered-num": i}) } return res }())).OptArgs(r.InsertOpts{ReturnChanges: "always"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #163") } { // mutation/insert.yaml line #167 /* partial({'changes':[{'old_val': None, 'new_val': {'id': [1,"blah", 200+i], 'ordered-num': i}} for i in range(1,100)] }) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"changes": (func() []interface{} { res := []interface{}{} for iterator_ := 1; iterator_ < 100; iterator_++ { i := iterator_ res = append(res, map[interface{}]interface{}{"old_val": nil, "new_val": map[interface{}]interface{}{"id": []interface{}{1, "blah", 200 + i}, "ordered-num": i}}) } return res }())}) /* tbl.insert([{'id':[1, "blah", 200+i], 'ordered-num':i} for i in range(1,100)], return_changes="always") */ suite.T().Log("About to run line #167: tbl.Insert((func() []interface{} {\n res := []interface{}{}\n for iterator_ := 1; iterator_ < 100; iterator_++ {\n i := iterator_\n res = append(res, map[interface{}]interface{}{'id': []interface{}{1, 'blah', r.Add(200, i)}, 'ordered-num': i, })\n }\n return res\n}())).OptArgs(r.InsertOpts{ReturnChanges: 'always', })") runAndAssert(suite.Suite, expected_, tbl.Insert((func() []interface{} { res := []interface{}{} for iterator_ := 1; iterator_ < 100; iterator_++ { i := iterator_ res = append(res, map[interface{}]interface{}{"id": []interface{}{1, "blah", r.Add(200, i)}, "ordered-num": i}) } return res }())).OptArgs(r.InsertOpts{ReturnChanges: "always"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #167") } { // mutation/insert.yaml line #171 /* partial({'changes':[{'old_val': None, 'new_val': {'id': [1,"blah", 300+i], 'ordered-num': i}} for i in range(1,100)] }) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"changes": (func() []interface{} { res := []interface{}{} for iterator_ := 1; iterator_ < 100; iterator_++ { i := iterator_ res = append(res, map[interface{}]interface{}{"old_val": nil, "new_val": map[interface{}]interface{}{"id": []interface{}{1, "blah", 300 + i}, "ordered-num": i}}) } return res }())}) /* tbl.insert([{'id':[1, "blah", 300+i], 'ordered-num':i} for i in range(1,100)], return_changes=true) */ suite.T().Log("About to run line #171: tbl.Insert((func() []interface{} {\n res := []interface{}{}\n for iterator_ := 1; iterator_ < 100; iterator_++ {\n i := iterator_\n res = append(res, map[interface{}]interface{}{'id': []interface{}{1, 'blah', r.Add(300, i)}, 'ordered-num': i, })\n }\n return res\n}())).OptArgs(r.InsertOpts{ReturnChanges: true, })") runAndAssert(suite.Suite, expected_, tbl.Insert((func() []interface{} { res := []interface{}{} for iterator_ := 1; iterator_ < 100; iterator_++ { i := iterator_ res = append(res, map[interface{}]interface{}{"id": []interface{}{1, "blah", r.Add(300, i)}, "ordered-num": i}) } return res }())).OptArgs(r.InsertOpts{ReturnChanges: true}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #171") } { // mutation/insert.yaml line #175 /* partial({'changes':[{'old_val': {'id':100+i, 'ordered-num':i}, 'new_val': {'id':100+i, 'ordered-num':i}, 'error':'Duplicate primary key `id`:\n{\n\t"id":\t'+str(100+i)+',\n\t"ordered-num":\t'+str(i)+'\n}\n{\n\t"id":\t'+str(100+i)+',\n\t"ordered-num":\t'+str(i)+'\n}'} for i in range(1,100)]}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"changes": (func() []interface{} { res := []interface{}{} for iterator_ := 1; iterator_ < 100; iterator_++ { i := iterator_ res = append(res, map[interface{}]interface{}{"old_val": map[interface{}]interface{}{"id": 100 + i, "ordered-num": i}, "new_val": map[interface{}]interface{}{"id": 100 + i, "ordered-num": i}, "error": "Duplicate primary key `id`:\n{\n\t\"id\":\t" + str(100+i) + ",\n\t\"ordered-num\":\t" + str(i) + "\n}\n{\n\t\"id\":\t" + str(100+i) + ",\n\t\"ordered-num\":\t" + str(i) + "\n}"}) } return res }())}) /* tbl.insert([{'id':100 + i, 'ordered-num':i} for i in range(1,100)], return_changes="always") */ suite.T().Log("About to run line #175: tbl.Insert((func() []interface{} {\n res := []interface{}{}\n for iterator_ := 1; iterator_ < 100; iterator_++ {\n i := iterator_\n res = append(res, map[interface{}]interface{}{'id': r.Add(100, i), 'ordered-num': i, })\n }\n return res\n}())).OptArgs(r.InsertOpts{ReturnChanges: 'always', })") runAndAssert(suite.Suite, expected_, tbl.Insert((func() []interface{} { res := []interface{}{} for iterator_ := 1; iterator_ < 100; iterator_++ { i := iterator_ res = append(res, map[interface{}]interface{}{"id": r.Add(100, i), "ordered-num": i}) } return res }())).OptArgs(r.InsertOpts{ReturnChanges: "always"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #175") } { // mutation/insert.yaml line #179 /* {'changes': [{'error': 'Duplicate primary key `id`:\n{\n\t"id":\t123,\n\t"ordered-num":\t23\n}\n{\n\t"id":\t123\n}', 'new_val': {'id': 123, 'ordered-num': 23}, 'old_val': {'id': 123, 'ordered-num': 23}}, {'error': 'Primary key too long (max 127 characters): "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"', 'new_val': None, 'old_val': None}, {'new_val': {'id': 321}, 'old_val': None}], 'deleted': 0, 'errors': 2, 'first_error': 'Primary key too long (max 127 characters): "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"', 'inserted': 1, 'replaced': 0, 'skipped': 0, 'unchanged': 0} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"changes": []interface{}{map[interface{}]interface{}{"error": "Duplicate primary key `id`:\n{\n\t\"id\":\t123,\n\t\"ordered-num\":\t23\n}\n{\n\t\"id\":\t123\n}", "new_val": map[interface{}]interface{}{"id": 123, "ordered-num": 23}, "old_val": map[interface{}]interface{}{"id": 123, "ordered-num": 23}}, map[interface{}]interface{}{"error": "Primary key too long (max 127 characters): \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"", "new_val": nil, "old_val": nil}, map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"id": 321}, "old_val": nil}}, "deleted": 0, "errors": 2, "first_error": "Primary key too long (max 127 characters): \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"", "inserted": 1, "replaced": 0, "skipped": 0, "unchanged": 0} /* tbl.insert([{'id':123}, {'id':'a'*500}, {'id':321}], return_changes="always") */ suite.T().Log("About to run line #179: tbl.Insert([]interface{}{map[interface{}]interface{}{'id': 123, }, map[interface{}]interface{}{'id': 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', }, map[interface{}]interface{}{'id': 321, }}).OptArgs(r.InsertOpts{ReturnChanges: 'always', })") runAndAssert(suite.Suite, expected_, tbl.Insert([]interface{}{map[interface{}]interface{}{"id": 123}, map[interface{}]interface{}{"id": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}, map[interface{}]interface{}{"id": 321}}).OptArgs(r.InsertOpts{ReturnChanges: "always"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #179") } { // mutation/insert.yaml line #183 /* partial({'changes':[]}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"changes": []interface{}{}}) /* tbl.insert([{'id':100 + i, 'ordered-num':i} for i in range(1,100)], return_changes=true) */ suite.T().Log("About to run line #183: tbl.Insert((func() []interface{} {\n res := []interface{}{}\n for iterator_ := 1; iterator_ < 100; iterator_++ {\n i := iterator_\n res = append(res, map[interface{}]interface{}{'id': r.Add(100, i), 'ordered-num': i, })\n }\n return res\n}())).OptArgs(r.InsertOpts{ReturnChanges: true, })") runAndAssert(suite.Suite, expected_, tbl.Insert((func() []interface{} { res := []interface{}{} for iterator_ := 1; iterator_ < 100; iterator_++ { i := iterator_ res = append(res, map[interface{}]interface{}{"id": r.Add(100, i), "ordered-num": i}) } return res }())).OptArgs(r.InsertOpts{ReturnChanges: true}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #183") } { // mutation/insert.yaml line #186 /* partial({'changes': [{'old_val': None, 'new_val': None, 'error': '`r.minval` and `r.maxval` cannot be written to disk.'}]}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"changes": []interface{}{map[interface{}]interface{}{"old_val": nil, "new_val": nil, "error": "`r.minval` and `r.maxval` cannot be written to disk."}}}) /* tbl.insert({'a':r.minval}, return_changes="always") */ suite.T().Log("About to run line #186: tbl.Insert(map[interface{}]interface{}{'a': r.MinVal, }).OptArgs(r.InsertOpts{ReturnChanges: 'always', })") runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"a": r.MinVal}).OptArgs(r.InsertOpts{ReturnChanges: "always"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #186") } { // mutation/insert.yaml line #192 /* partial({'inserted':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"inserted": 1}) /* tbl.insert({'id':42, 'foo':1, 'bar':1}) */ suite.T().Log("About to run line #192: tbl.Insert(map[interface{}]interface{}{'id': 42, 'foo': 1, 'bar': 1, })") runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"id": 42, "foo": 1, "bar": 1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #192") } { // mutation/insert.yaml line #194 /* partial({'replaced':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"replaced": 1}) /* tbl.insert({'id':42, 'foo':5, 'bar':5}, conflict=lambda id, old_row, new_row: old_row.merge(new_row.pluck("bar"))) */ suite.T().Log("About to run line #194: tbl.Insert(map[interface{}]interface{}{'id': 42, 'foo': 5, 'bar': 5, }).OptArgs(r.InsertOpts{Conflict: func(id r.Term, old_row r.Term, new_row r.Term) interface{} { return old_row.Merge(new_row.Pluck('bar'))}, })") runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"id": 42, "foo": 5, "bar": 5}).OptArgs(r.InsertOpts{Conflict: func(id r.Term, old_row r.Term, new_row r.Term) interface{} { return old_row.Merge(new_row.Pluck("bar")) }}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #194") } { // mutation/insert.yaml line #196 /* {'id':42, 'foo':1, 'bar':5} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 42, "foo": 1, "bar": 5} /* tbl.get(42) */ suite.T().Log("About to run line #196: tbl.Get(42)") runAndAssert(suite.Suite, expected_, tbl.Get(42), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #196") } { // mutation/insert.yaml line #214 /* partial({'first_error': 'Inserted value must be an OBJECT (got NUMBER):\n2'}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"first_error": "Inserted value must be an OBJECT (got NUMBER):\n2"}) /* tbl.insert({'id':42, 'foo':1, 'bar':1}, conflict=lambda a,b,c: 2) */ suite.T().Log("About to run line #214: tbl.Insert(map[interface{}]interface{}{'id': 42, 'foo': 1, 'bar': 1, }).OptArgs(r.InsertOpts{Conflict: func(a r.Term, b r.Term, c r.Term) interface{} { return 2}, })") runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"id": 42, "foo": 1, "bar": 1}).OptArgs(r.InsertOpts{Conflict: func(a r.Term, b r.Term, c r.Term) interface{} { return 2 }}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #214") } { // mutation/insert.yaml line #218 /* err("ReqlQueryLogicError", "The conflict function passed to `insert` should expect 3 arguments.") */ var expected_ Err = err("ReqlQueryLogicError", "The conflict function passed to `insert` should expect 3 arguments.") /* tbl.insert({'id':42}, conflict=lambda a,b: a) */ suite.T().Log("About to run line #218: tbl.Insert(map[interface{}]interface{}{'id': 42, }).OptArgs(r.InsertOpts{Conflict: func(a r.Term, b r.Term) interface{} { return a}, })") runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"id": 42}).OptArgs(r.InsertOpts{Conflict: func(a r.Term, b r.Term) interface{} { return a }}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #218") } { // mutation/insert.yaml line #222 /* err("ReqlQueryLogicError", "The conflict function passed to `insert` must be deterministic.") */ var expected_ Err = err("ReqlQueryLogicError", "The conflict function passed to `insert` must be deterministic.") /* tbl.insert({'id':42}, conflict=lambda a,b,c: tbl.get(42)) */ suite.T().Log("About to run line #222: tbl.Insert(map[interface{}]interface{}{'id': 42, }).OptArgs(r.InsertOpts{Conflict: func(a r.Term, b r.Term, c r.Term) interface{} { return tbl.Get(42)}, })") runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"id": 42}).OptArgs(r.InsertOpts{Conflict: func(a r.Term, b r.Term, c r.Term) interface{} { return tbl.Get(42) }}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #222") } { // mutation/insert.yaml line #225 /* partial({'replaced': 1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"replaced": 1}) /* tbl.insert({'id':42}, conflict=lambda a,b,c: {'id':42, 'num':'424'}) */ suite.T().Log("About to run line #225: tbl.Insert(map[interface{}]interface{}{'id': 42, }).OptArgs(r.InsertOpts{Conflict: func(a r.Term, b r.Term, c r.Term) interface{} { return map[interface{}]interface{}{'id': 42, 'num': '424', }}, })") runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"id": 42}).OptArgs(r.InsertOpts{Conflict: func(a r.Term, b r.Term, c r.Term) interface{} { return map[interface{}]interface{}{"id": 42, "num": "424"} }}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #225") } { // mutation/insert.yaml line #227 /* {'id':42, 'num':'424'} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 42, "num": "424"} /* tbl.get(42) */ suite.T().Log("About to run line #227: tbl.Get(42)") runAndAssert(suite.Suite, expected_, tbl.Get(42), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #227") } { // mutation/insert.yaml line #231 /* err('ReqlQueryLogicError','Cannot convert `r.minval` to JSON.') */ var expected_ Err = err("ReqlQueryLogicError", "Cannot convert `r.minval` to JSON.") /* r.minval */ suite.T().Log("About to run line #231: r.MinVal") runAndAssert(suite.Suite, expected_, r.MinVal, suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #231") } { // mutation/insert.yaml line #234 /* err('ReqlQueryLogicError','Cannot convert `r.maxval` to JSON.') */ var expected_ Err = err("ReqlQueryLogicError", "Cannot convert `r.maxval` to JSON.") /* r.maxval */ suite.T().Log("About to run line #234: r.MaxVal") runAndAssert(suite.Suite, expected_, r.MaxVal, suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #234") } { // mutation/insert.yaml line #238 /* partial({'tables_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1}) /* r.db('test').table_drop('test2') */ suite.T().Log("About to run line #238: r.DB('test').TableDrop('test2')") runAndAssert(suite.Suite, expected_, r.DB("test").TableDrop("test2"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #238") } }
func (suite *SelectionSuite) TestCases() { suite.T().Log("Running SelectionSuite: Tests that manipulation data in tables") tbl := r.DB("test").Table("tbl") _ = tbl // Prevent any noused variable errors tbl2 := r.DB("test").Table("tbl2") _ = tbl2 // Prevent any noused variable errors tbl3 := r.DB("test").Table("tbl3") _ = tbl3 // Prevent any noused variable errors { // selection.yaml line #6 /* ({'deleted':0.0,'replaced':0.0,'unchanged':0.0,'errors':0.0,'skipped':0.0,'inserted':100}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0.0, "replaced": 0.0, "unchanged": 0.0, "errors": 0.0, "skipped": 0.0, "inserted": 100} /* tbl.insert([{'id':i, 'a':i%4} for i in xrange(100)]) */ suite.T().Log("About to run line #6: tbl.Insert((func() []interface{} {\n res := []interface{}{}\n for iterator_ := 0; iterator_ < 100; iterator_++ {\n i := iterator_\n res = append(res, map[interface{}]interface{}{'id': i, 'a': r.Mod(i, 4), })\n }\n return res\n}()))") runAndAssert(suite.Suite, expected_, tbl.Insert((func() []interface{} { res := []interface{}{} for iterator_ := 0; iterator_ < 100; iterator_++ { i := iterator_ res = append(res, map[interface{}]interface{}{"id": i, "a": r.Mod(i, 4)}) } return res }())), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #6") } { // selection.yaml line #18 /* ({'deleted':0.0,'replaced':0.0,'unchanged':0.0,'errors':0.0,'skipped':0.0,'inserted':100}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0.0, "replaced": 0.0, "unchanged": 0.0, "errors": 0.0, "skipped": 0.0, "inserted": 100} /* tbl2.insert([{'id':i, 'b':i%4} for i in xrange(100)]) */ suite.T().Log("About to run line #18: tbl2.Insert((func() []interface{} {\n res := []interface{}{}\n for iterator_ := 0; iterator_ < 100; iterator_++ {\n i := iterator_\n res = append(res, map[interface{}]interface{}{'id': i, 'b': r.Mod(i, 4), })\n }\n return res\n}()))") runAndAssert(suite.Suite, expected_, tbl2.Insert((func() []interface{} { res := []interface{}{} for iterator_ := 0; iterator_ < 100; iterator_++ { i := iterator_ res = append(res, map[interface{}]interface{}{"id": i, "b": r.Mod(i, 4)}) } return res }())), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #18") } { // selection.yaml line #31 /* 'TABLE' */ var expected_ string = "TABLE" /* tbl.type_of() */ suite.T().Log("About to run line #31: tbl.TypeOf()") runAndAssert(suite.Suite, expected_, tbl.TypeOf(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #31") } { // selection.yaml line #35 /* err("ReqlOpFailedError", 'Database `missing` does not exist.', [0]) */ var expected_ Err = err("ReqlOpFailedError", "Database `missing` does not exist.") /* r.db('missing').table('bar') */ suite.T().Log("About to run line #35: r.DB('missing').Table('bar')") runAndAssert(suite.Suite, expected_, r.DB("missing").Table("bar"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #35") } { // selection.yaml line #39 /* err("ReqlOpFailedError", 'Table `test.missing` does not exist.', [0]) */ var expected_ Err = err("ReqlOpFailedError", "Table `test.missing` does not exist.") /* r.db('test').table('missing') */ suite.T().Log("About to run line #39: r.DB('test').Table('missing')") runAndAssert(suite.Suite, expected_, r.DB("test").Table("missing"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #39") } { // selection.yaml line #43 /* ({"errors":1,"inserted":0}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"errors": 1, "inserted": 0} /* tbl.insert({"id":"\x00"}).pluck("errors","inserted") */ suite.T().Log("About to run line #43: tbl.Insert(map[interface{}]interface{}{'id': '\\u0000', }).Pluck('errors', 'inserted')") runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"id": "\u0000"}).Pluck("errors", "inserted"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #43") } { // selection.yaml line #46 /* ({"errors":1,"inserted":0}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"errors": 1, "inserted": 0} /* tbl.insert({"id":["embedded",["null\x00"]]}).pluck("errors","inserted") */ suite.T().Log("About to run line #46: tbl.Insert(map[interface{}]interface{}{'id': []interface{}{'embedded', []interface{}{'null\\u0000'}}, }).Pluck('errors', 'inserted')") runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"id": []interface{}{"embedded", []interface{}{"null\u0000"}}}).Pluck("errors", "inserted"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #46") } { // selection.yaml line #51 /* ({'deleted':0.0,'replaced':0.0,'unchanged':0.0,'errors':0.0,'skipped':0.0,'inserted':1}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0.0, "replaced": 0.0, "unchanged": 0.0, "errors": 0.0, "skipped": 0.0, "inserted": 1} /* tbl3.insert({'id':u'Здравствуй','value':u'Земля!'}) */ suite.T().Log("About to run line #51: tbl3.Insert(map[interface{}]interface{}{'id': 'Здравствуй', 'value': 'Земля!', })") runAndAssert(suite.Suite, expected_, tbl3.Insert(map[interface{}]interface{}{"id": "Здравствуй", "value": "Земля!"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #51") } { // selection.yaml line #60 /* {u'id':u'Здравствуй',u'value':u'Земля!'} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": "Здравствуй", "value": "Земля!"} /* tbl3.get('Здравствуй') */ suite.T().Log("About to run line #60: tbl3.Get('Здравствуй')") runAndAssert(suite.Suite, expected_, tbl3.Get("Здравствуй"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #60") } { // selection.yaml line #73 /* [{u'id':u'Здравствуй',u'value':u'Земля!'}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"id": "Здравствуй", "value": "Земля!"}} /* tbl3.filter({'value':'Земля!'}) */ suite.T().Log("About to run line #73: tbl3.Filter(map[interface{}]interface{}{'value': 'Земля!', })") runAndAssert(suite.Suite, expected_, tbl3.Filter(map[interface{}]interface{}{"value": "Земля!"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #73") } { // selection.yaml line #86 /* err("ReqlQueryLogicError", 'Database name `%` invalid (Use A-Za-z0-9_ only).', [0]) */ var expected_ Err = err("ReqlQueryLogicError", "Database name `%` invalid (Use A-Za-z0-9_ only).") /* r.db('%') */ suite.T().Log("About to run line #86: r.DB('%')") runAndAssert(suite.Suite, expected_, r.DB("%"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #86") } { // selection.yaml line #89 /* err("ReqlQueryLogicError", 'Table name `%` invalid (Use A-Za-z0-9_ only).', [0]) */ var expected_ Err = err("ReqlQueryLogicError", "Table name `%` invalid (Use A-Za-z0-9_ only).") /* r.db('test').table('%') */ suite.T().Log("About to run line #89: r.DB('test').Table('%')") runAndAssert(suite.Suite, expected_, r.DB("test").Table("%"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #89") } { // selection.yaml line #93 /* 100 */ var expected_ int = 100 /* tbl.count() */ suite.T().Log("About to run line #93: tbl.Count()") runAndAssert(suite.Suite, expected_, tbl.Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #93") } // selection.yaml line #97 // tbl2Name = tbl2.info().get_field('name') suite.T().Log("Possibly executing: var tbl2Name r.Term = tbl2.Info().Field('name')") tbl2Name := tbl2.Info().Field("name") _ = tbl2Name // Prevent any noused variable errors // selection.yaml line #98 // tbl2DbName = tbl2.info().get_field('db').get_field('name') suite.T().Log("Possibly executing: var tbl2DbName r.Term = tbl2.Info().Field('db').Field('name')") tbl2DbName := tbl2.Info().Field("db").Field("name") _ = tbl2DbName // Prevent any noused variable errors { // selection.yaml line #101 /* 100 */ var expected_ int = 100 /* r.db(tbl2DbName).table(tbl2Name, read_mode='outdated').count() */ suite.T().Log("About to run line #101: r.DB(tbl2DbName).Table(tbl2Name).OptArgs(r.TableOpts{ReadMode: 'outdated', }).Count()") runAndAssert(suite.Suite, expected_, r.DB(tbl2DbName).Table(tbl2Name).OptArgs(r.TableOpts{ReadMode: "outdated"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #101") } { // selection.yaml line #102 /* 100 */ var expected_ int = 100 /* r.db(tbl2DbName).table(tbl2Name, read_mode='single').count() */ suite.T().Log("About to run line #102: r.DB(tbl2DbName).Table(tbl2Name).OptArgs(r.TableOpts{ReadMode: 'single', }).Count()") runAndAssert(suite.Suite, expected_, r.DB(tbl2DbName).Table(tbl2Name).OptArgs(r.TableOpts{ReadMode: "single"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #102") } { // selection.yaml line #103 /* 100 */ var expected_ int = 100 /* r.db(tbl2DbName).table(tbl2Name, read_mode='majority').count() */ suite.T().Log("About to run line #103: r.DB(tbl2DbName).Table(tbl2Name).OptArgs(r.TableOpts{ReadMode: 'majority', }).Count()") runAndAssert(suite.Suite, expected_, r.DB(tbl2DbName).Table(tbl2Name).OptArgs(r.TableOpts{ReadMode: "majority"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #103") } { // selection.yaml line #120 /* err("ReqlQueryLogicError", 'Expected type STRING but found BOOL.') */ var expected_ Err = err("ReqlQueryLogicError", "Expected type STRING but found BOOL.") /* r.db(tbl2DbName).table(tbl2Name, read_mode=true).count() */ suite.T().Log("About to run line #120: r.DB(tbl2DbName).Table(tbl2Name).OptArgs(r.TableOpts{ReadMode: true, }).Count()") runAndAssert(suite.Suite, expected_, r.DB(tbl2DbName).Table(tbl2Name).OptArgs(r.TableOpts{ReadMode: true}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #120") } { // selection.yaml line #125 /* err("ReqlQueryLogicError", 'Read mode `fake` unrecognized (options are "majority", "single", and "outdated").') */ var expected_ Err = err("ReqlQueryLogicError", "Read mode `fake` unrecognized (options are \"majority\", \"single\", and \"outdated\").") /* r.db(tbl2DbName).table(tbl2Name, read_mode='fake').count() */ suite.T().Log("About to run line #125: r.DB(tbl2DbName).Table(tbl2Name).OptArgs(r.TableOpts{ReadMode: 'fake', }).Count()") runAndAssert(suite.Suite, expected_, r.DB(tbl2DbName).Table(tbl2Name).OptArgs(r.TableOpts{ReadMode: "fake"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #125") } { // selection.yaml line #130 /* 2 */ var expected_ int = 2 /* tbl.get(20).count() */ suite.T().Log("About to run line #130: tbl.Get(20).Count()") runAndAssert(suite.Suite, expected_, tbl.Get(20).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #130") } { // selection.yaml line #134 /* {'id':20,'a':0} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 20, "a": 0} /* tbl.get(20) */ suite.T().Log("About to run line #134: tbl.Get(20)") runAndAssert(suite.Suite, expected_, tbl.Get(20), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #134") } { // selection.yaml line #138 /* null */ var expected_ interface{} = nil /* tbl.get(2000) */ suite.T().Log("About to run line #138: tbl.Get(2000)") runAndAssert(suite.Suite, expected_, tbl.Get(2000), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #138") } // selection.yaml line #153 // tblpkey = r.db('test').table('testpkey') suite.T().Log("Possibly executing: var tblpkey r.Term = r.DB('test').Table('testpkey')") tblpkey := r.DB("test").Table("testpkey") _ = tblpkey // Prevent any noused variable errors { // selection.yaml line #149 /* partial({'tables_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) /* r.db('test').table_create('testpkey', primary_key='foo') */ suite.T().Log("About to run line #149: r.DB('test').TableCreate('testpkey').OptArgs(r.TableCreateOpts{PrimaryKey: 'foo', })") runAndAssert(suite.Suite, expected_, r.DB("test").TableCreate("testpkey").OptArgs(r.TableCreateOpts{PrimaryKey: "foo"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #149") } { // selection.yaml line #155 /* {'deleted':0.0,'replaced':0.0,'unchanged':0.0,'errors':0.0,'skipped':0.0,'inserted':1} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0.0, "replaced": 0.0, "unchanged": 0.0, "errors": 0.0, "skipped": 0.0, "inserted": 1} /* tblpkey.insert({'foo':10,'a':10}) */ suite.T().Log("About to run line #155: tblpkey.Insert(map[interface{}]interface{}{'foo': 10, 'a': 10, })") runAndAssert(suite.Suite, expected_, tblpkey.Insert(map[interface{}]interface{}{"foo": 10, "a": 10}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #155") } { // selection.yaml line #159 /* {'foo':10,'a':10} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"foo": 10, "a": 10} /* tblpkey.get(10) */ suite.T().Log("About to run line #159: tblpkey.Get(10)") runAndAssert(suite.Suite, expected_, tblpkey.Get(10), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #159") } { // selection.yaml line #163 /* [] */ var expected_ []interface{} = []interface{}{} /* tbl.get_all() */ suite.T().Log("About to run line #163: tbl.GetAll()") runAndAssert(suite.Suite, expected_, tbl.GetAll(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #163") } { // selection.yaml line #165 /* [{"id":20,"a":0}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"id": 20, "a": 0}} /* tbl.get_all(20) */ suite.T().Log("About to run line #165: tbl.GetAll(20)") runAndAssert(suite.Suite, expected_, tbl.GetAll(20), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #165") } { // selection.yaml line #167 /* "SELECTION<STREAM>" */ var expected_ string = "SELECTION<STREAM>" /* tbl.get_all().type_of() */ suite.T().Log("About to run line #167: tbl.GetAll().TypeOf()") runAndAssert(suite.Suite, expected_, tbl.GetAll().TypeOf(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #167") } { // selection.yaml line #169 /* "SELECTION<STREAM>" */ var expected_ string = "SELECTION<STREAM>" /* tbl.get_all(20).type_of() */ suite.T().Log("About to run line #169: tbl.GetAll(20).TypeOf()") runAndAssert(suite.Suite, expected_, tbl.GetAll(20).TypeOf(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #169") } { // selection.yaml line #173 /* 'TABLE_SLICE' */ var expected_ string = "TABLE_SLICE" /* tbl.between(2, 1).type_of() */ suite.T().Log("About to run line #173: tbl.Between(2, 1).TypeOf()") runAndAssert(suite.Suite, expected_, tbl.Between(2, 1).TypeOf(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #173") } { // selection.yaml line #175 /* 'TABLE_SLICE' */ var expected_ string = "TABLE_SLICE" /* tbl.between(1, 2).type_of() */ suite.T().Log("About to run line #175: tbl.Between(1, 2).TypeOf()") runAndAssert(suite.Suite, expected_, tbl.Between(1, 2).TypeOf(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #175") } { // selection.yaml line #177 /* 'TABLE_SLICE' */ var expected_ string = "TABLE_SLICE" /* tbl.between(1, 2, index='id').type_of() */ suite.T().Log("About to run line #177: tbl.Between(1, 2).OptArgs(r.BetweenOpts{Index: 'id', }).TypeOf()") runAndAssert(suite.Suite, expected_, tbl.Between(1, 2).OptArgs(r.BetweenOpts{Index: "id"}).TypeOf(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #177") } { // selection.yaml line #181 /* 'TABLE_SLICE' */ var expected_ string = "TABLE_SLICE" /* tbl.between(1, 1, right_bound='closed').type_of() */ suite.T().Log("About to run line #181: tbl.Between(1, 1).OptArgs(r.BetweenOpts{RightBound: 'closed', }).TypeOf()") runAndAssert(suite.Suite, expected_, tbl.Between(1, 1).OptArgs(r.BetweenOpts{RightBound: "closed"}).TypeOf(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #181") } { // selection.yaml line #185 /* 'TABLE_SLICE' */ var expected_ string = "TABLE_SLICE" /* tbl.between(2, 1).type_of() */ suite.T().Log("About to run line #185: tbl.Between(2, 1).TypeOf()") runAndAssert(suite.Suite, expected_, tbl.Between(2, 1).TypeOf(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #185") } { // selection.yaml line #187 /* 'TABLE_SLICE' */ var expected_ string = "TABLE_SLICE" /* tbl.between(2, 1, index='id').type_of() */ suite.T().Log("About to run line #187: tbl.Between(2, 1).OptArgs(r.BetweenOpts{Index: 'id', }).TypeOf()") runAndAssert(suite.Suite, expected_, tbl.Between(2, 1).OptArgs(r.BetweenOpts{Index: "id"}).TypeOf(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #187") } { // selection.yaml line #192 /* 0 */ var expected_ int = 0 /* tbl.between(21, 20).count() */ suite.T().Log("About to run line #192: tbl.Between(21, 20).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(21, 20).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #192") } { // selection.yaml line #194 /* 9 */ var expected_ int = 9 /* tbl.between(20, 29).count() */ suite.T().Log("About to run line #194: tbl.Between(20, 29).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(20, 29).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #194") } { // selection.yaml line #196 /* 9 */ var expected_ int = 9 /* tbl.between(-10, 9).count() */ suite.T().Log("About to run line #196: tbl.Between(-10, 9).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(-10, 9).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #196") } { // selection.yaml line #198 /* 20 */ var expected_ int = 20 /* tbl.between(80, 2000).count() */ suite.T().Log("About to run line #198: tbl.Between(80, 2000).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(80, 2000).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #198") } { // selection.yaml line #200 /* 100 */ var expected_ int = 100 /* tbl.between(-2000, 2000).count() */ suite.T().Log("About to run line #200: tbl.Between(-2000, 2000).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(-2000, 2000).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #200") } { // selection.yaml line #205 /* 10 */ var expected_ int = 10 /* tbl.between(20, 29, right_bound='closed').count() */ suite.T().Log("About to run line #205: tbl.Between(20, 29).OptArgs(r.BetweenOpts{RightBound: 'closed', }).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(20, 29).OptArgs(r.BetweenOpts{RightBound: "closed"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #205") } { // selection.yaml line #209 /* 10 */ var expected_ int = 10 /* tbl.between(-10, 9, right_bound='closed').count() */ suite.T().Log("About to run line #209: tbl.Between(-10, 9).OptArgs(r.BetweenOpts{RightBound: 'closed', }).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(-10, 9).OptArgs(r.BetweenOpts{RightBound: "closed"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #209") } { // selection.yaml line #213 /* 20 */ var expected_ int = 20 /* tbl.between(80, 2000, right_bound='closed').count() */ suite.T().Log("About to run line #213: tbl.Between(80, 2000).OptArgs(r.BetweenOpts{RightBound: 'closed', }).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(80, 2000).OptArgs(r.BetweenOpts{RightBound: "closed"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #213") } { // selection.yaml line #217 /* 100 */ var expected_ int = 100 /* tbl.between(-2000, 2000, right_bound='closed').count() */ suite.T().Log("About to run line #217: tbl.Between(-2000, 2000).OptArgs(r.BetweenOpts{RightBound: 'closed', }).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(-2000, 2000).OptArgs(r.BetweenOpts{RightBound: "closed"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #217") } { // selection.yaml line #223 /* 8 */ var expected_ int = 8 /* tbl.between(20, 29, left_bound='open').count() */ suite.T().Log("About to run line #223: tbl.Between(20, 29).OptArgs(r.BetweenOpts{LeftBound: 'open', }).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(20, 29).OptArgs(r.BetweenOpts{LeftBound: "open"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #223") } { // selection.yaml line #227 /* 9 */ var expected_ int = 9 /* tbl.between(-10, 9, left_bound='open').count() */ suite.T().Log("About to run line #227: tbl.Between(-10, 9).OptArgs(r.BetweenOpts{LeftBound: 'open', }).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(-10, 9).OptArgs(r.BetweenOpts{LeftBound: "open"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #227") } { // selection.yaml line #231 /* 19 */ var expected_ int = 19 /* tbl.between(80, 2000, left_bound='open').count() */ suite.T().Log("About to run line #231: tbl.Between(80, 2000).OptArgs(r.BetweenOpts{LeftBound: 'open', }).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(80, 2000).OptArgs(r.BetweenOpts{LeftBound: "open"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #231") } { // selection.yaml line #235 /* 100 */ var expected_ int = 100 /* tbl.between(-2000, 2000, left_bound='open').count() */ suite.T().Log("About to run line #235: tbl.Between(-2000, 2000).OptArgs(r.BetweenOpts{LeftBound: 'open', }).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(-2000, 2000).OptArgs(r.BetweenOpts{LeftBound: "open"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #235") } { // selection.yaml line #240 /* err('ReqlQueryLogicError', 'Expected type TABLE_SLICE but found DATUM:', [0]) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type TABLE_SLICE but found DATUM:") /* r.expr([1, 2, 3]).between(-1, 2) */ suite.T().Log("About to run line #240: r.Expr([]interface{}{1, 2, 3}).Between(-1, 2)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).Between(-1, 2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #240") } { // selection.yaml line #244 /* 2 */ var expected_ int = 2 /* tbl.between(r.minval, 2).count() */ suite.T().Log("About to run line #244: tbl.Between(r.MinVal, 2).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(r.MinVal, 2).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #244") } { // selection.yaml line #247 /* 3 */ var expected_ int = 3 /* tbl.between(r.minval, 2, right_bound='closed').count() */ suite.T().Log("About to run line #247: tbl.Between(r.MinVal, 2).OptArgs(r.BetweenOpts{RightBound: 'closed', }).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(r.MinVal, 2).OptArgs(r.BetweenOpts{RightBound: "closed"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #247") } { // selection.yaml line #251 /* 2 */ var expected_ int = 2 /* tbl.between(r.minval, 2, left_bound='open').count() */ suite.T().Log("About to run line #251: tbl.Between(r.MinVal, 2).OptArgs(r.BetweenOpts{LeftBound: 'open', }).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(r.MinVal, 2).OptArgs(r.BetweenOpts{LeftBound: "open"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #251") } { // selection.yaml line #255 /* 98 */ var expected_ int = 98 /* tbl.between(2, r.maxval).count() */ suite.T().Log("About to run line #255: tbl.Between(2, r.MaxVal).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(2, r.MaxVal).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #255") } { // selection.yaml line #265 /* err('ReqlQueryLogicError', 'Cannot use `nu' + 'll` in BETWEEN, use `r.minval` or `r.maxval` to denote unboundedness.') */ var expected_ Err = err("ReqlQueryLogicError", "Cannot use `nu"+"ll` in BETWEEN, use `r.minval` or `r.maxval` to denote unboundedness.") /* tbl.between(null, 2).count() */ suite.T().Log("About to run line #265: tbl.Between(nil, 2).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(nil, 2).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #265") } { // selection.yaml line #266 /* err('ReqlQueryLogicError', 'Cannot use `nu' + 'll` in BETWEEN, use `r.minval` or `r.maxval` to denote unboundedness.') */ var expected_ Err = err("ReqlQueryLogicError", "Cannot use `nu"+"ll` in BETWEEN, use `r.minval` or `r.maxval` to denote unboundedness.") /* tbl.between(2, null).count() */ suite.T().Log("About to run line #266: tbl.Between(2, nil).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(2, nil).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #266") } { // selection.yaml line #267 /* err('ReqlQueryLogicError', 'Cannot use `nu' + 'll` in BETWEEN, use `r.minval` or `r.maxval` to denote unboundedness.') */ var expected_ Err = err("ReqlQueryLogicError", "Cannot use `nu"+"ll` in BETWEEN, use `r.minval` or `r.maxval` to denote unboundedness.") /* tbl.between(null, null).count() */ suite.T().Log("About to run line #267: tbl.Between(nil, nil).Count()") runAndAssert(suite.Suite, expected_, tbl.Between(nil, nil).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #267") } { // selection.yaml line #271 /* 1 */ var expected_ int = 1 /* tblpkey.between(9, 11).count() */ suite.T().Log("About to run line #271: tblpkey.Between(9, 11).Count()") runAndAssert(suite.Suite, expected_, tblpkey.Between(9, 11).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #271") } { // selection.yaml line #274 /* 0 */ var expected_ int = 0 /* tblpkey.between(11, 12).count() */ suite.T().Log("About to run line #274: tblpkey.Between(11, 12).Count()") runAndAssert(suite.Suite, expected_, tblpkey.Between(11, 12).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #274") } { // selection.yaml line #278 /* 25 */ var expected_ int = 25 /* tbl.filter(lambda row:row['a'] > 2).count() */ suite.T().Log("About to run line #278: tbl.Filter(func(row r.Term) interface{} { return row.AtIndex('a').Gt(2)}).Count()") runAndAssert(suite.Suite, expected_, tbl.Filter(func(row r.Term) interface{} { return row.AtIndex("a").Gt(2) }).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #278") } { // selection.yaml line #284 /* 100 */ var expected_ int = 100 /* tbl.filter(lambda row: 1).count() */ suite.T().Log("About to run line #284: tbl.Filter(func(row r.Term) interface{} { return 1}).Count()") runAndAssert(suite.Suite, expected_, tbl.Filter(func(row r.Term) interface{} { return 1 }).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #284") } { // selection.yaml line #290 /* [4, 5] */ var expected_ []interface{} = []interface{}{4, 5} /* r.expr([1, 2, 3, 4, 5]).filter(r.row > 2).filter(r.row > 3) */ suite.T().Log("About to run line #290: r.Expr([]interface{}{1, 2, 3, 4, 5}).Filter(r.Row.Gt(2)).Filter(r.Row.Gt(3))") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3, 4, 5}).Filter(r.Row.Gt(2)).Filter(r.Row.Gt(3)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #290") } // selection.yaml line #296 // nested = r.expr([[1, 2], [3, 4], [5, 6]]) suite.T().Log("Possibly executing: var nested r.Term = r.Expr([]interface{}{[]interface{}{1, 2}, []interface{}{3, 4}, []interface{}{5, 6}})") nested := r.Expr([]interface{}{[]interface{}{1, 2}, []interface{}{3, 4}, []interface{}{5, 6}}) _ = nested // Prevent any noused variable errors { // selection.yaml line #298 /* [[3, 4], [5, 6]] */ var expected_ []interface{} = []interface{}{[]interface{}{3, 4}, []interface{}{5, 6}} /* nested.filter(lambda x: x.filter(lambda y: y >= 4).count() > 0) */ suite.T().Log("About to run line #298: nested.Filter(func(x r.Term) interface{} { return x.Filter(func(y r.Term) interface{} { return r.Ge(y, 4)}).Count().Gt(0)})") runAndAssert(suite.Suite, expected_, nested.Filter(func(x r.Term) interface{} { return x.Filter(func(y r.Term) interface{} { return r.Ge(y, 4) }).Count().Gt(0) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #298") } { // selection.yaml line #303 /* ([[3, 4], [5, 6]]) */ var expected_ []interface{} = []interface{}{[]interface{}{3, 4}, []interface{}{5, 6}} /* nested.filter(r.row.filter(lambda y: y >= 4).count() > 0) */ suite.T().Log("About to run line #303: nested.Filter(r.Row.Filter(func(y r.Term) interface{} { return r.Ge(y, 4)}).Count().Gt(0))") runAndAssert(suite.Suite, expected_, nested.Filter(r.Row.Filter(func(y r.Term) interface{} { return r.Ge(y, 4) }).Count().Gt(0)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #303") } { // selection.yaml line #307 /* err("ReqlCompileError", 'Cannot use r.row in nested queries. Use functions instead.', [0]) */ var expected_ Err = err("ReqlCompileError", "Cannot use r.row in nested queries. Use functions instead.") /* nested.filter(lambda x: x.filter(r.row >= 4).count() > 0) */ suite.T().Log("About to run line #307: nested.Filter(func(x r.Term) interface{} { return x.Filter(r.Row.Ge(4)).Count().Gt(0)})") runAndAssert(suite.Suite, expected_, nested.Filter(func(x r.Term) interface{} { return x.Filter(r.Row.Ge(4)).Count().Gt(0) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #307") } { // selection.yaml line #311 /* err("ReqlCompileError", 'Cannot use r.row in nested queries. Use functions instead.', [0]) */ var expected_ Err = err("ReqlCompileError", "Cannot use r.row in nested queries. Use functions instead.") /* r.expr([[1, 2], [3, 4], [5, 6]]).filter(r.row.filter(r.row >= 4).count() > 0) */ suite.T().Log("About to run line #311: r.Expr([]interface{}{[]interface{}{1, 2}, []interface{}{3, 4}, []interface{}{5, 6}}).Filter(r.Row.Filter(r.Row.Ge(4)).Count().Gt(0))") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{[]interface{}{1, 2}, []interface{}{3, 4}, []interface{}{5, 6}}).Filter(r.Row.Filter(r.Row.Ge(4)).Count().Gt(0)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #311") } { // selection.yaml line #316 /* [{'a':1,'b':2,'c':3}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1, "b": 2, "c": 3}} /* r.expr([{'a':1,'b':1,'c':3},{'a':1,'b':2,'c':3}]).filter({'a':1,'b':2}) */ suite.T().Log("About to run line #316: r.Expr([]interface{}{map[interface{}]interface{}{'a': 1, 'b': 1, 'c': 3, }, map[interface{}]interface{}{'a': 1, 'b': 2, 'c': 3, }}).Filter(map[interface{}]interface{}{'a': 1, 'b': 2, })") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{map[interface{}]interface{}{"a": 1, "b": 1, "c": 3}, map[interface{}]interface{}{"a": 1, "b": 2, "c": 3}}).Filter(map[interface{}]interface{}{"a": 1, "b": 2}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #316") } { // selection.yaml line #319 /* [{'a':1,'b':1,'c':3},{'a':1,'b':2,'c':3}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1, "b": 1, "c": 3}, map[interface{}]interface{}{"a": 1, "b": 2, "c": 3}} /* r.expr([{'a':1,'b':1,'c':3},{'a':1,'b':2,'c':3}]).filter({'a':1}) */ suite.T().Log("About to run line #319: r.Expr([]interface{}{map[interface{}]interface{}{'a': 1, 'b': 1, 'c': 3, }, map[interface{}]interface{}{'a': 1, 'b': 2, 'c': 3, }}).Filter(map[interface{}]interface{}{'a': 1, })") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{map[interface{}]interface{}{"a": 1, "b": 1, "c": 3}, map[interface{}]interface{}{"a": 1, "b": 2, "c": 3}}).Filter(map[interface{}]interface{}{"a": 1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #319") } { // selection.yaml line #323 /* [{'a':1,'b':1,'c':3}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1, "b": 1, "c": 3}} /* r.expr([{'a':1,'b':1,'c':3},{'a':1,'b':2,'c':3}]).filter({'a':r.row['b']}) */ suite.T().Log("About to run line #323: r.Expr([]interface{}{map[interface{}]interface{}{'a': 1, 'b': 1, 'c': 3, }, map[interface{}]interface{}{'a': 1, 'b': 2, 'c': 3, }}).Filter(map[interface{}]interface{}{'a': r.Row.AtIndex('b'), })") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{map[interface{}]interface{}{"a": 1, "b": 1, "c": 3}, map[interface{}]interface{}{"a": 1, "b": 2, "c": 3}}).Filter(map[interface{}]interface{}{"a": r.Row.AtIndex("b")}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #323") } { // selection.yaml line #329 /* [] */ var expected_ []interface{} = []interface{}{} /* r.expr([{'a':1}]).filter({'b':1}) */ suite.T().Log("About to run line #329: r.Expr([]interface{}{map[interface{}]interface{}{'a': 1, }}).Filter(map[interface{}]interface{}{'b': 1, })") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{map[interface{}]interface{}{"a": 1}}).Filter(map[interface{}]interface{}{"b": 1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #329") } { // selection.yaml line #335 /* 25 */ var expected_ int = 25 /* tbl.count(lambda row: {'a':1}) */ suite.T().Log("About to run line #335: tbl.Count(func(row r.Term) interface{} { return map[interface{}]interface{}{'a': 1, }})") runAndAssert(suite.Suite, expected_, tbl.Count(func(row r.Term) interface{} { return map[interface{}]interface{}{"a": 1} }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #335") } { // selection.yaml line #341 /* 2 */ var expected_ int = 2 /* r.expr([1,2,3,1]).count(1) */ suite.T().Log("About to run line #341: r.Expr([]interface{}{1, 2, 3, 1}).Count(1)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3, 1}).Count(1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #341") } { // selection.yaml line #344 /* 2 */ var expected_ int = 2 /* r.expr([null, 4, null, 'foo']).count(null) */ suite.T().Log("About to run line #344: r.Expr([]interface{}{nil, 4, nil, 'foo'}).Count(nil)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{nil, 4, nil, "foo"}).Count(nil), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #344") } { // selection.yaml line #348 /* err('ReqlQueryLogicError', 'Expected type DATUM but found TABLE:', [0]) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type DATUM but found TABLE:") /* r.expr(5) + tbl */ suite.T().Log("About to run line #348: r.Expr(5).Add(tbl)") runAndAssert(suite.Suite, expected_, r.Expr(5).Add(tbl), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #348") } { // selection.yaml line #353 /* "SELECTION<STREAM>" */ var expected_ string = "SELECTION<STREAM>" /* tbl.has_fields('field').type_of() */ suite.T().Log("About to run line #353: tbl.HasFields('field').TypeOf()") runAndAssert(suite.Suite, expected_, tbl.HasFields("field").TypeOf(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #353") } }
func (suite *MetaDbsSuite) TestCases() { suite.T().Log("Running MetaDbsSuite: Tests meta queries for databases") { // meta/dbs.yaml line #6 /* bag(['rethinkdb', 'test']) */ var expected_ compare.Expected = compare.UnorderedMatch([]interface{}{"rethinkdb", "test"}) /* r.db_list() */ suite.T().Log("About to run line #6: r.DBList()") runAndAssert(suite.Suite, expected_, r.DBList(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #6") } { // meta/dbs.yaml line #11 /* partial({'dbs_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"dbs_created": 1}) /* r.db_create('a') */ suite.T().Log("About to run line #11: r.DBCreate('a')") runAndAssert(suite.Suite, expected_, r.DBCreate("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #11") } { // meta/dbs.yaml line #13 /* partial({'dbs_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"dbs_created": 1}) /* r.db_create('b') */ suite.T().Log("About to run line #13: r.DBCreate('b')") runAndAssert(suite.Suite, expected_, r.DBCreate("b"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #13") } { // meta/dbs.yaml line #18 /* bag(['rethinkdb', 'a', 'b', 'test']) */ var expected_ compare.Expected = compare.UnorderedMatch([]interface{}{"rethinkdb", "a", "b", "test"}) /* r.db_list() */ suite.T().Log("About to run line #18: r.DBList()") runAndAssert(suite.Suite, expected_, r.DBList(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #18") } { // meta/dbs.yaml line #23 /* {'name':'a','id':uuid()} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"name": "a", "id": compare.IsUUID()} /* r.db('a').config() */ suite.T().Log("About to run line #23: r.DB('a').Config()") runAndAssert(suite.Suite, expected_, r.DB("a").Config(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #23") } { // meta/dbs.yaml line #28 /* partial({'dbs_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"dbs_dropped": 1}) /* r.db_drop('b') */ suite.T().Log("About to run line #28: r.DBDrop('b')") runAndAssert(suite.Suite, expected_, r.DBDrop("b"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #28") } { // meta/dbs.yaml line #31 /* bag(['rethinkdb', 'a', 'test']) */ var expected_ compare.Expected = compare.UnorderedMatch([]interface{}{"rethinkdb", "a", "test"}) /* r.db_list() */ suite.T().Log("About to run line #31: r.DBList()") runAndAssert(suite.Suite, expected_, r.DBList(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #31") } { // meta/dbs.yaml line #34 /* partial({'dbs_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"dbs_dropped": 1}) /* r.db_drop('a') */ suite.T().Log("About to run line #34: r.DBDrop('a')") runAndAssert(suite.Suite, expected_, r.DBDrop("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #34") } { // meta/dbs.yaml line #37 /* bag(['rethinkdb', 'test']) */ var expected_ compare.Expected = compare.UnorderedMatch([]interface{}{"rethinkdb", "test"}) /* r.db_list() */ suite.T().Log("About to run line #37: r.DBList()") runAndAssert(suite.Suite, expected_, r.DBList(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #37") } { // meta/dbs.yaml line #41 /* partial({'dbs_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"dbs_created": 1}) /* r.db_create('bar') */ suite.T().Log("About to run line #41: r.DBCreate('bar')") runAndAssert(suite.Suite, expected_, r.DBCreate("bar"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #41") } { // meta/dbs.yaml line #44 /* err('ReqlOpFailedError', 'Database `bar` already exists.', [0]) */ var expected_ Err = err("ReqlOpFailedError", "Database `bar` already exists.") /* r.db_create('bar') */ suite.T().Log("About to run line #44: r.DBCreate('bar')") runAndAssert(suite.Suite, expected_, r.DBCreate("bar"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #44") } { // meta/dbs.yaml line #47 /* partial({'dbs_dropped':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"dbs_dropped": 1}) /* r.db_drop('bar') */ suite.T().Log("About to run line #47: r.DBDrop('bar')") runAndAssert(suite.Suite, expected_, r.DBDrop("bar"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #47") } { // meta/dbs.yaml line #50 /* err('ReqlOpFailedError', 'Database `bar` does not exist.', [0]) */ var expected_ Err = err("ReqlOpFailedError", "Database `bar` does not exist.") /* r.db_drop('bar') */ suite.T().Log("About to run line #50: r.DBDrop('bar')") runAndAssert(suite.Suite, expected_, r.DBDrop("bar"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #50") } }
func (suite *SindexStatusSuite) TestCases() { suite.T().Log("Running SindexStatusSuite: sindex status") tbl2 := r.DB("test").Table("tbl2") _ = tbl2 // Prevent any noused variable errors { // sindex/status.yaml line #7 /* ({'created':1}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"created": 1} /* tbl2.index_create("a") */ suite.T().Log("About to run line #7: tbl2.IndexCreate('a')") runAndAssert(suite.Suite, expected_, tbl2.IndexCreate("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #7") } { // sindex/status.yaml line #9 /* ({'created':1}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"created": 1} /* tbl2.index_create("b") */ suite.T().Log("About to run line #9: tbl2.IndexCreate('b')") runAndAssert(suite.Suite, expected_, tbl2.IndexCreate("b"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #9") } { // sindex/status.yaml line #12 /* 2 */ var expected_ int = 2 /* tbl2.index_status().count() */ suite.T().Log("About to run line #12: tbl2.IndexStatus().Count()") runAndAssert(suite.Suite, expected_, tbl2.IndexStatus().Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #12") } { // sindex/status.yaml line #14 /* 1 */ var expected_ int = 1 /* tbl2.index_status("a").count() */ suite.T().Log("About to run line #14: tbl2.IndexStatus('a').Count()") runAndAssert(suite.Suite, expected_, tbl2.IndexStatus("a").Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #14") } { // sindex/status.yaml line #16 /* 1 */ var expected_ int = 1 /* tbl2.index_status("b").count() */ suite.T().Log("About to run line #16: tbl2.IndexStatus('b').Count()") runAndAssert(suite.Suite, expected_, tbl2.IndexStatus("b").Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #16") } { // sindex/status.yaml line #18 /* 2 */ var expected_ int = 2 /* tbl2.index_status("a", "b").count() */ suite.T().Log("About to run line #18: tbl2.IndexStatus('a', 'b').Count()") runAndAssert(suite.Suite, expected_, tbl2.IndexStatus("a", "b").Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #18") } { // sindex/status.yaml line #21 /* ({'dropped':1}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"dropped": 1} /* tbl2.index_drop("a") */ suite.T().Log("About to run line #21: tbl2.IndexDrop('a')") runAndAssert(suite.Suite, expected_, tbl2.IndexDrop("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #21") } { // sindex/status.yaml line #23 /* ({'dropped':1}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"dropped": 1} /* tbl2.index_drop("b") */ suite.T().Log("About to run line #23: tbl2.IndexDrop('b')") runAndAssert(suite.Suite, expected_, tbl2.IndexDrop("b"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #23") } { // sindex/status.yaml line #28 /* partial({'inserted':5000}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"inserted": 5000}) /* tbl2.insert(r.range(0, 5000).map({'a':r.row})) */ suite.T().Log("About to run line #28: tbl2.Insert(r.Range(0, 5000).Map(map[interface{}]interface{}{'a': r.Row, }))") runAndAssert(suite.Suite, expected_, tbl2.Insert(r.Range(0, 5000).Map(map[interface{}]interface{}{"a": r.Row})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #28") } { // sindex/status.yaml line #33 /* ({'created':1}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"created": 1} /* tbl2.index_create("foo") */ suite.T().Log("About to run line #33: tbl2.IndexCreate('foo')") runAndAssert(suite.Suite, expected_, tbl2.IndexCreate("foo"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #33") } { // sindex/status.yaml line #36 /* ({'created':1}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"created": 1} /* tbl2.index_create("bar", multi=True) */ suite.T().Log("About to run line #36: tbl2.IndexCreate('bar').OptArgs(r.IndexCreateOpts{Multi: true, })") runAndAssert(suite.Suite, expected_, tbl2.IndexCreate("bar").OptArgs(r.IndexCreateOpts{Multi: true}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #36") } { // sindex/status.yaml line #44 /* [true, true] */ var expected_ []interface{} = []interface{}{true, true} /* tbl2.index_status().map(lambda x:x["progress"] < 1) */ suite.T().Log("About to run line #44: tbl2.IndexStatus().Map(func(x r.Term) interface{} { return x.AtIndex('progress').Lt(1)})") runAndAssert(suite.Suite, expected_, tbl2.IndexStatus().Map(func(x r.Term) interface{} { return x.AtIndex("progress").Lt(1) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #44") } { // sindex/status.yaml line #49 /* ([true, true]) */ var expected_ []interface{} = []interface{}{true, true} /* tbl2.index_wait()['ready'] */ suite.T().Log("About to run line #49: tbl2.IndexWait().AtIndex('ready')") runAndAssert(suite.Suite, expected_, tbl2.IndexWait().AtIndex("ready"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #49") } { // sindex/status.yaml line #54 /* bag([false, false]) */ var expected_ compare.Expected = compare.UnorderedMatch([]interface{}{false, false}) /* tbl2.index_wait()['geo'] */ suite.T().Log("About to run line #54: tbl2.IndexWait().AtIndex('geo')") runAndAssert(suite.Suite, expected_, tbl2.IndexWait().AtIndex("geo"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #54") } { // sindex/status.yaml line #57 /* bag([false, true]) */ var expected_ compare.Expected = compare.UnorderedMatch([]interface{}{false, true}) /* tbl2.index_wait()['multi'] */ suite.T().Log("About to run line #57: tbl2.IndexWait().AtIndex('multi')") runAndAssert(suite.Suite, expected_, tbl2.IndexWait().AtIndex("multi"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #57") } { // sindex/status.yaml line #60 /* ([false, false]) */ var expected_ []interface{} = []interface{}{false, false} /* tbl2.index_wait()['outdated'] */ suite.T().Log("About to run line #60: tbl2.IndexWait().AtIndex('outdated')") runAndAssert(suite.Suite, expected_, tbl2.IndexWait().AtIndex("outdated"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #60") } { // sindex/status.yaml line #63 /* ({'created':1}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"created": 1} /* tbl2.index_create("quux") */ suite.T().Log("About to run line #63: tbl2.IndexCreate('quux')") runAndAssert(suite.Suite, expected_, tbl2.IndexCreate("quux"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #63") } { // sindex/status.yaml line #66 /* true */ var expected_ bool = true /* tbl2.index_status("quux").do(lambda x:(x[0]["index"] == "quux") & (x[0]["progress"] < 1)) */ suite.T().Log("About to run line #66: tbl2.IndexStatus('quux').Do(func(x r.Term) interface{} { return x.AtIndex(0).AtIndex('index').Eq('quux').And(x.AtIndex(0).AtIndex('progress').Lt(1))})") runAndAssert(suite.Suite, expected_, tbl2.IndexStatus("quux").Do(func(x r.Term) interface{} { return x.AtIndex(0).AtIndex("index").Eq("quux").And(x.AtIndex(0).AtIndex("progress").Lt(1)) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #66") } { // sindex/status.yaml line #71 /* ([{'index':'quux', 'ready':true}]) */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"index": "quux", "ready": true}} /* tbl2.index_wait("quux").pluck('index', 'ready') */ suite.T().Log("About to run line #71: tbl2.IndexWait('quux').Pluck('index', 'ready')") runAndAssert(suite.Suite, expected_, tbl2.IndexWait("quux").Pluck("index", "ready"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #71") } { // sindex/status.yaml line #74 /* ("PTYPE<BINARY>") */ var expected_ string = "PTYPE<BINARY>" /* tbl2.index_wait("quux").nth(0).get_field('function').type_of() */ suite.T().Log("About to run line #74: tbl2.IndexWait('quux').Nth(0).Field('function').TypeOf()") runAndAssert(suite.Suite, expected_, tbl2.IndexWait("quux").Nth(0).Field("function").TypeOf(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #74") } }
func (suite *ControlSuite) TestCases() { suite.T().Log("Running ControlSuite: Tests RQL control flow structures") tbl := r.DB("test").Table("tbl") _ = tbl // Prevent any noused variable errors tbl2 := r.DB("test").Table("tbl2") _ = tbl2 // Prevent any noused variable errors { // control.yaml line #7 /* 2 */ var expected_ int = 2 /* r.expr(1).do(lambda v: v * 2) */ suite.T().Log("About to run line #7: r.Expr(1).Do(func(v r.Term) interface{} { return r.Mul(v, 2)})") runAndAssert(suite.Suite, expected_, r.Expr(1).Do(func(v r.Term) interface{} { return r.Mul(v, 2) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #7") } { // control.yaml line #12 /* [0, 1, 2, 3] */ var expected_ []interface{} = []interface{}{0, 1, 2, 3} /* r.expr([0, 1, 2]).do(lambda v: v.append(3)) */ suite.T().Log("About to run line #12: r.Expr([]interface{}{0, 1, 2}).Do(func(v r.Term) interface{} { return v.Append(3)})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{0, 1, 2}).Do(func(v r.Term) interface{} { return v.Append(3) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #12") } { // control.yaml line #17 /* 3 */ var expected_ int = 3 /* r.do(1, 2, lambda x, y: x + y) */ suite.T().Log("About to run line #17: r.Do(1, 2, func(x r.Term, y r.Term) interface{} { return r.Add(x, y)})") runAndAssert(suite.Suite, expected_, r.Do(1, 2, func(x r.Term, y r.Term) interface{} { return r.Add(x, y) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #17") } { // control.yaml line #22 /* 1 */ var expected_ int = 1 /* r.do(lambda: 1) */ suite.T().Log("About to run line #22: r.Do(func() interface{} { return 1})") runAndAssert(suite.Suite, expected_, r.Do(func() interface{} { return 1 }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #22") } { // control.yaml line #38 /* 1 */ var expected_ int = 1 /* r.do(1) */ suite.T().Log("About to run line #38: r.Do(1)") runAndAssert(suite.Suite, expected_, r.Do(1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #38") } { // control.yaml line #53 /* err("ReqlQueryLogicError", "Expected type ARRAY but found STRING.", [1, 0]) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type ARRAY but found STRING.") /* r.expr('abc').do(lambda v: v.append(3)) */ suite.T().Log("About to run line #53: r.Expr('abc').Do(func(v r.Term) interface{} { return v.Append(3)})") runAndAssert(suite.Suite, expected_, r.Expr("abc").Do(func(v r.Term) interface{} { return v.Append(3) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #53") } { // control.yaml line #58 /* err("ReqlQueryLogicError", "Expected type STRING but found NUMBER.", [1, 1]) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type STRING but found NUMBER.") /* r.expr('abc').do(lambda v: v + 3) */ suite.T().Log("About to run line #58: r.Expr('abc').Do(func(v r.Term) interface{} { return r.Add(v, 3)})") runAndAssert(suite.Suite, expected_, r.Expr("abc").Do(func(v r.Term) interface{} { return r.Add(v, 3) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #58") } { // control.yaml line #63 /* err("ReqlQueryLogicError", "Expected type STRING but found NUMBER.", [1]) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type STRING but found NUMBER.") /* r.expr('abc').do(lambda v: v + 'def') + 3 */ suite.T().Log("About to run line #63: r.Expr('abc').Do(func(v r.Term) interface{} { return r.Add(v, 'def')}).Add(3)") runAndAssert(suite.Suite, expected_, r.Expr("abc").Do(func(v r.Term) interface{} { return r.Add(v, "def") }).Add(3), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #63") } { // control.yaml line #78 /* 5 */ var expected_ int = 5 /* r.expr(5).do(r.row) */ suite.T().Log("About to run line #78: r.Expr(5).Do(r.Row)") runAndAssert(suite.Suite, expected_, r.Expr(5).Do(r.Row), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #78") } { // control.yaml line #84 /* 1 */ var expected_ int = 1 /* r.branch(True, 1, 2) */ suite.T().Log("About to run line #84: r.Branch(true, 1, 2)") runAndAssert(suite.Suite, expected_, r.Branch(true, 1, 2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #84") } { // control.yaml line #86 /* 2 */ var expected_ int = 2 /* r.branch(False, 1, 2) */ suite.T().Log("About to run line #86: r.Branch(false, 1, 2)") runAndAssert(suite.Suite, expected_, r.Branch(false, 1, 2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #86") } { // control.yaml line #88 /* ("c") */ var expected_ string = "c" /* r.branch(1, 'c', False) */ suite.T().Log("About to run line #88: r.Branch(1, 'c', false)") runAndAssert(suite.Suite, expected_, r.Branch(1, "c", false), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #88") } { // control.yaml line #90 /* ([]) */ var expected_ []interface{} = []interface{}{} /* r.branch(null, {}, []) */ suite.T().Log("About to run line #90: r.Branch(nil, map[interface{}]interface{}{}, []interface{}{})") runAndAssert(suite.Suite, expected_, r.Branch(nil, map[interface{}]interface{}{}, []interface{}{}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #90") } { // control.yaml line #93 /* err("ReqlQueryLogicError", "Expected type DATUM but found DATABASE:", []) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type DATUM but found DATABASE:") /* r.branch(r.db('test'), 1, 2) */ suite.T().Log("About to run line #93: r.Branch(r.DB('test'), 1, 2)") runAndAssert(suite.Suite, expected_, r.Branch(r.DB("test"), 1, 2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #93") } { // control.yaml line #95 /* err("ReqlQueryLogicError", "Expected type DATUM but found TABLE:", []) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type DATUM but found TABLE:") /* r.branch(tbl, 1, 2) */ suite.T().Log("About to run line #95: r.Branch(tbl, 1, 2)") runAndAssert(suite.Suite, expected_, r.Branch(tbl, 1, 2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #95") } { // control.yaml line #97 /* err("ReqlUserError", "a", []) */ var expected_ Err = err("ReqlUserError", "a") /* r.branch(r.error("a"), 1, 2) */ suite.T().Log("About to run line #97: r.Branch(r.Error('a'), 1, 2)") runAndAssert(suite.Suite, expected_, r.Branch(r.Error("a"), 1, 2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #97") } { // control.yaml line #100 /* 1 */ var expected_ int = 1 /* r.branch([], 1, 2) */ suite.T().Log("About to run line #100: r.Branch([]interface{}{}, 1, 2)") runAndAssert(suite.Suite, expected_, r.Branch([]interface{}{}, 1, 2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #100") } { // control.yaml line #102 /* 1 */ var expected_ int = 1 /* r.branch({}, 1, 2) */ suite.T().Log("About to run line #102: r.Branch(map[interface{}]interface{}{}, 1, 2)") runAndAssert(suite.Suite, expected_, r.Branch(map[interface{}]interface{}{}, 1, 2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #102") } { // control.yaml line #104 /* 1 */ var expected_ int = 1 /* r.branch("a", 1, 2) */ suite.T().Log("About to run line #104: r.Branch('a', 1, 2)") runAndAssert(suite.Suite, expected_, r.Branch("a", 1, 2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #104") } { // control.yaml line #106 /* 1 */ var expected_ int = 1 /* r.branch(1.2, 1, 2) */ suite.T().Log("About to run line #106: r.Branch(1.2, 1, 2)") runAndAssert(suite.Suite, expected_, r.Branch(1.2, 1, 2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #106") } { // control.yaml line #109 /* 1 */ var expected_ int = 1 /* r.branch(True, 1, True, 2, 3) */ suite.T().Log("About to run line #109: r.Branch(true, 1, true, 2, 3)") runAndAssert(suite.Suite, expected_, r.Branch(true, 1, true, 2, 3), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #109") } { // control.yaml line #111 /* 1 */ var expected_ int = 1 /* r.branch(True, 1, False, 2, 3) */ suite.T().Log("About to run line #111: r.Branch(true, 1, false, 2, 3)") runAndAssert(suite.Suite, expected_, r.Branch(true, 1, false, 2, 3), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #111") } { // control.yaml line #113 /* 2 */ var expected_ int = 2 /* r.branch(False, 1, True, 2, 3) */ suite.T().Log("About to run line #113: r.Branch(false, 1, true, 2, 3)") runAndAssert(suite.Suite, expected_, r.Branch(false, 1, true, 2, 3), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #113") } { // control.yaml line #115 /* 3 */ var expected_ int = 3 /* r.branch(False, 1, False, 2, 3) */ suite.T().Log("About to run line #115: r.Branch(false, 1, false, 2, 3)") runAndAssert(suite.Suite, expected_, r.Branch(false, 1, false, 2, 3), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #115") } { // control.yaml line #118 /* err("ReqlQueryLogicError", "Cannot call `branch` term with an even number of arguments.") */ var expected_ Err = err("ReqlQueryLogicError", "Cannot call `branch` term with an even number of arguments.") /* r.branch(True, 1, True, 2) */ suite.T().Log("About to run line #118: r.Branch(true, 1, true, 2)") runAndAssert(suite.Suite, expected_, r.Branch(true, 1, true, 2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #118") } { // control.yaml line #122 /* err("ReqlUserError", "Hello World", [0]) */ var expected_ Err = err("ReqlUserError", "Hello World") /* r.error('Hello World') */ suite.T().Log("About to run line #122: r.Error('Hello World')") runAndAssert(suite.Suite, expected_, r.Error("Hello World"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #122") } { // control.yaml line #125 /* err("ReqlQueryLogicError", "Expected type STRING but found NUMBER.", [0]) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type STRING but found NUMBER.") /* r.error(5) */ suite.T().Log("About to run line #125: r.Error(5)") runAndAssert(suite.Suite, expected_, r.Error(5), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #125") } { // control.yaml line #140 /* 2 */ var expected_ int = 2 /* r.js('1 + 1') */ suite.T().Log("About to run line #140: r.JS('1 + 1')") runAndAssert(suite.Suite, expected_, r.JS("1 + 1"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #140") } { // control.yaml line #143 /* 4 */ var expected_ int = 4 /* r.js('1 + 1; 2 + 2') */ suite.T().Log("About to run line #143: r.JS('1 + 1; 2 + 2')") runAndAssert(suite.Suite, expected_, r.JS("1 + 1; 2 + 2"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #143") } { // control.yaml line #146 /* 3 */ var expected_ int = 3 /* r.do(1, 2, r.js('(function(a, b) { return a + b; })')) */ suite.T().Log("About to run line #146: r.Do(1, 2, r.JS('(function(a, b) { return a + b; })'))") runAndAssert(suite.Suite, expected_, r.Do(1, 2, r.JS("(function(a, b) { return a + b; })")), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #146") } { // control.yaml line #149 /* 2 */ var expected_ int = 2 /* r.expr(1).do(r.js('(function(x) { return x + 1; })')) */ suite.T().Log("About to run line #149: r.Expr(1).Do(r.JS('(function(x) { return x + 1; })'))") runAndAssert(suite.Suite, expected_, r.Expr(1).Do(r.JS("(function(x) { return x + 1; })")), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #149") } { // control.yaml line #152 /* 'foobar' */ var expected_ string = "foobar" /* r.expr('foo').do(r.js('(function(x) { return x + "bar"; })')) */ suite.T().Log("About to run line #152: r.Expr('foo').Do(r.JS('(function(x) { return x + \\'bar\\'; })'))") runAndAssert(suite.Suite, expected_, r.Expr("foo").Do(r.JS("(function(x) { return x + \"bar\"; })")), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #152") } { // control.yaml line #157 /* 3 */ var expected_ int = 3 /* r.js('1 + 2', timeout=1.2) */ suite.T().Log("About to run line #157: r.JS('1 + 2').OptArgs(r.JSOpts{Timeout: 1.2, })") runAndAssert(suite.Suite, expected_, r.JS("1 + 2").OptArgs(r.JSOpts{Timeout: 1.2}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #157") } { // control.yaml line #161 /* err("ReqlQueryLogicError", "Query result must be of type DATUM, GROUPED_DATA, or STREAM (got FUNCTION).", [0]) */ var expected_ Err = err("ReqlQueryLogicError", "Query result must be of type DATUM, GROUPED_DATA, or STREAM (got FUNCTION).") /* r.js('(function() { return 1; })') */ suite.T().Log("About to run line #161: r.JS('(function() { return 1; })')") runAndAssert(suite.Suite, expected_, r.JS("(function() { return 1; })"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #161") } { // control.yaml line #164 /* err("ReqlQueryLogicError", "SyntaxError: Unexpected token (", [0]) */ var expected_ Err = err("ReqlQueryLogicError", "SyntaxError: Unexpected token (") /* r.js('function() { return 1; }') */ suite.T().Log("About to run line #164: r.JS('function() { return 1; }')") runAndAssert(suite.Suite, expected_, r.JS("function() { return 1; }"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #164") } { // control.yaml line #168 /* 1 */ var expected_ int = 1 /* r.do(1, 2, r.js('(function(a) { return a; })')) */ suite.T().Log("About to run line #168: r.Do(1, 2, r.JS('(function(a) { return a; })'))") runAndAssert(suite.Suite, expected_, r.Do(1, 2, r.JS("(function(a) { return a; })")), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #168") } { // control.yaml line #171 /* 1 */ var expected_ int = 1 /* r.do(1, 2, r.js('(function(a, b, c) { return a; })')) */ suite.T().Log("About to run line #171: r.Do(1, 2, r.JS('(function(a, b, c) { return a; })'))") runAndAssert(suite.Suite, expected_, r.Do(1, 2, r.JS("(function(a, b, c) { return a; })")), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #171") } { // control.yaml line #174 /* err("ReqlQueryLogicError", "Cannot convert javascript `undefined` to ql::datum_t.", [0]) */ var expected_ Err = err("ReqlQueryLogicError", "Cannot convert javascript `undefined` to ql::datum_t.") /* r.do(1, 2, r.js('(function(a, b, c) { return c; })')) */ suite.T().Log("About to run line #174: r.Do(1, 2, r.JS('(function(a, b, c) { return c; })'))") runAndAssert(suite.Suite, expected_, r.Do(1, 2, r.JS("(function(a, b, c) { return c; })")), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #174") } { // control.yaml line #177 /* ([2, 3]) */ var expected_ []interface{} = []interface{}{2, 3} /* r.expr([1, 2, 3]).filter(r.js('(function(a) { return a >= 2; })')) */ suite.T().Log("About to run line #177: r.Expr([]interface{}{1, 2, 3}).Filter(r.JS('(function(a) { return a >= 2; })'))") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).Filter(r.JS("(function(a) { return a >= 2; })")), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #177") } { // control.yaml line #180 /* ([2, 3, 4]) */ var expected_ []interface{} = []interface{}{2, 3, 4} /* r.expr([1, 2, 3]).map(r.js('(function(a) { return a + 1; })')) */ suite.T().Log("About to run line #180: r.Expr([]interface{}{1, 2, 3}).Map(r.JS('(function(a) { return a + 1; })'))") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).Map(r.JS("(function(a) { return a + 1; })")), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #180") } { // control.yaml line #183 /* err("ReqlQueryLogicError", "Expected type FUNCTION but found DATUM:", [0]) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type FUNCTION but found DATUM:") /* r.expr([1, 2, 3]).map(r.js('1')) */ suite.T().Log("About to run line #183: r.Expr([]interface{}{1, 2, 3}).Map(r.JS('1'))") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).Map(r.JS("1")), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #183") } { // control.yaml line #186 /* err("ReqlQueryLogicError", "Cannot convert javascript `undefined` to ql::datum_t.", [0]) */ var expected_ Err = err("ReqlQueryLogicError", "Cannot convert javascript `undefined` to ql::datum_t.") /* r.expr([1, 2, 3]).filter(r.js('(function(a) {})')) */ suite.T().Log("About to run line #186: r.Expr([]interface{}{1, 2, 3}).Filter(r.JS('(function(a) {})'))") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).Filter(r.JS("(function(a) {})")), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #186") } { // control.yaml line #190 /* err("ReqlQueryLogicError", "Expected type FUNCTION but found DATUM:", [0]) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type FUNCTION but found DATUM:") /* r.expr([1, 2, 3]).map(1) */ suite.T().Log("About to run line #190: r.Expr([]interface{}{1, 2, 3}).Map(1)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).Map(1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #190") } { // control.yaml line #193 /* ([1, 2, 3]) */ var expected_ []interface{} = []interface{}{1, 2, 3} /* r.expr([1, 2, 3]).filter('foo') */ suite.T().Log("About to run line #193: r.Expr([]interface{}{1, 2, 3}).Filter('foo')") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).Filter("foo"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #193") } { // control.yaml line #195 /* ([1, 2, 4]) */ var expected_ []interface{} = []interface{}{1, 2, 4} /* r.expr([1, 2, 4]).filter([]) */ suite.T().Log("About to run line #195: r.Expr([]interface{}{1, 2, 4}).Filter([]interface{}{})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 4}).Filter([]interface{}{}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #195") } { // control.yaml line #197 /* ([]) */ var expected_ []interface{} = []interface{}{} /* r.expr([1, 2, 3]).filter(null) */ suite.T().Log("About to run line #197: r.Expr([]interface{}{1, 2, 3}).Filter(nil)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).Filter(nil), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #197") } { // control.yaml line #200 /* ([]) */ var expected_ []interface{} = []interface{}{} /* r.expr([1, 2, 4]).filter(False) */ suite.T().Log("About to run line #200: r.Expr([]interface{}{1, 2, 4}).Filter(false)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 4}).Filter(false), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #200") } { // control.yaml line #205 /* 0 */ var expected_ int = 0 /* tbl.count() */ suite.T().Log("About to run line #205: tbl.Count()") runAndAssert(suite.Suite, expected_, tbl.Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #205") } { // control.yaml line #210 /* ({'deleted':0.0,'replaced':0.0,'unchanged':0.0,'errors':0.0,'skipped':0.0,'inserted':3}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0.0, "replaced": 0.0, "unchanged": 0.0, "errors": 0.0, "skipped": 0.0, "inserted": 3} /* r.expr([1, 2, 3]).for_each(lambda row:tbl.insert({ 'id':row })) */ suite.T().Log("About to run line #210: r.Expr([]interface{}{1, 2, 3}).ForEach(func(row r.Term) interface{} { return tbl.Insert(map[interface{}]interface{}{'id': row, })})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).ForEach(func(row r.Term) interface{} { return tbl.Insert(map[interface{}]interface{}{"id": row}) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #210") } { // control.yaml line #214 /* 3 */ var expected_ int = 3 /* tbl.count() */ suite.T().Log("About to run line #214: tbl.Count()") runAndAssert(suite.Suite, expected_, tbl.Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #214") } { // control.yaml line #219 /* ({'deleted':0.0,'replaced':9,'unchanged':0.0,'errors':0.0,'skipped':0.0,'inserted':0.0}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0.0, "replaced": 9, "unchanged": 0.0, "errors": 0.0, "skipped": 0.0, "inserted": 0.0} /* r.expr([1,2,3]).for_each(lambda row:tbl.update({'foo':row})) */ suite.T().Log("About to run line #219: r.Expr([]interface{}{1, 2, 3}).ForEach(func(row r.Term) interface{} { return tbl.Update(map[interface{}]interface{}{'foo': row, })})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).ForEach(func(row r.Term) interface{} { return tbl.Update(map[interface{}]interface{}{"foo": row}) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #219") } { // control.yaml line #225 /* {'first_error':"Duplicate primary key `id`:\n{\n\t\"foo\":\t3,\n\t\"id\":\t1\n}\n{\n\t\"id\":\t1\n}",'deleted':0.0,'replaced':0.0,'unchanged':0.0,'errors':3,'skipped':0.0,'inserted':3} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"first_error": "Duplicate primary key `id`:\n{\n\t\"foo\":\t3,\n\t\"id\":\t1\n}\n{\n\t\"id\":\t1\n}", "deleted": 0.0, "replaced": 0.0, "unchanged": 0.0, "errors": 3, "skipped": 0.0, "inserted": 3} /* r.expr([1,2,3]).for_each(lambda row:[tbl.insert({ 'id':row }), tbl.insert({ 'id':row*10 })]) */ suite.T().Log("About to run line #225: r.Expr([]interface{}{1, 2, 3}).ForEach(func(row r.Term) interface{} { return []interface{}{tbl.Insert(map[interface{}]interface{}{'id': row, }), tbl.Insert(map[interface{}]interface{}{'id': r.Mul(row, 10), })}})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).ForEach(func(row r.Term) interface{} { return []interface{}{tbl.Insert(map[interface{}]interface{}{"id": row}), tbl.Insert(map[interface{}]interface{}{"id": r.Mul(row, 10)})} }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #225") } { // control.yaml line #229 /* 6 */ var expected_ int = 6 /* tbl.count() */ suite.T().Log("About to run line #229: tbl.Count()") runAndAssert(suite.Suite, expected_, tbl.Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #229") } { // control.yaml line #232 /* ({'deleted':0.0,'replaced':0.0,'generated_keys':arrlen(3,uuid()),'unchanged':0.0,'errors':0.0,'skipped':0.0,'inserted':3}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0.0, "replaced": 0.0, "generated_keys": arrlen(3, compare.IsUUID()), "unchanged": 0.0, "errors": 0.0, "skipped": 0.0, "inserted": 3} /* r.expr([1, 2, 3]).for_each( tbl2.insert({}) ) */ suite.T().Log("About to run line #232: r.Expr([]interface{}{1, 2, 3}).ForEach(tbl2.Insert(map[interface{}]interface{}{}))") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).ForEach(tbl2.Insert(map[interface{}]interface{}{})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #232") } { // control.yaml line #235 /* 1 */ var expected_ int = 1 /* tbl2.count() */ suite.T().Log("About to run line #235: tbl2.Count()") runAndAssert(suite.Suite, expected_, tbl2.Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #235") } { // control.yaml line #240 /* ({'deleted':0.0,'replaced':36,'unchanged':0.0,'errors':0.0,'skipped':0.0,'inserted':0.0}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0.0, "replaced": 36, "unchanged": 0.0, "errors": 0.0, "skipped": 0.0, "inserted": 0.0} /* r.expr([1,2,3]).for_each(lambda row:[tbl.update({'foo':row}), tbl.update({'bar':row})]) */ suite.T().Log("About to run line #240: r.Expr([]interface{}{1, 2, 3}).ForEach(func(row r.Term) interface{} { return []interface{}{tbl.Update(map[interface{}]interface{}{'foo': row, }), tbl.Update(map[interface{}]interface{}{'bar': row, })}})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).ForEach(func(row r.Term) interface{} { return []interface{}{tbl.Update(map[interface{}]interface{}{"foo": row}), tbl.Update(map[interface{}]interface{}{"bar": row})} }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #240") } { // control.yaml line #245 /* ({'deleted':0.0,'replaced':0.0,'unchanged':0.0,'errors':0.0,'skipped':0.0,'inserted':3}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0.0, "replaced": 0.0, "unchanged": 0.0, "errors": 0.0, "skipped": 0.0, "inserted": 3} /* r.expr([1, 2, 3]).for_each( tbl2.insert({ 'id':r.row }) ) */ suite.T().Log("About to run line #245: r.Expr([]interface{}{1, 2, 3}).ForEach(tbl2.Insert(map[interface{}]interface{}{'id': r.Row, }))") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).ForEach(tbl2.Insert(map[interface{}]interface{}{"id": r.Row})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #245") } { // control.yaml line #249 /* err("ReqlQueryLogicError", "FOR_EACH expects one or more basic write queries. Expected type ARRAY but found NUMBER.", [0]) */ var expected_ Err = err("ReqlQueryLogicError", "FOR_EACH expects one or more basic write queries. Expected type ARRAY but found NUMBER.") /* r.expr([1, 2, 3]).for_each(1) */ suite.T().Log("About to run line #249: r.Expr([]interface{}{1, 2, 3}).ForEach(1)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).ForEach(1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #249") } { // control.yaml line #252 /* err("ReqlQueryLogicError", "FOR_EACH expects one or more basic write queries. Expected type ARRAY but found NUMBER.", [1, 1]) */ var expected_ Err = err("ReqlQueryLogicError", "FOR_EACH expects one or more basic write queries. Expected type ARRAY but found NUMBER.") /* r.expr([1, 2, 3]).for_each(lambda x:x) */ suite.T().Log("About to run line #252: r.Expr([]interface{}{1, 2, 3}).ForEach(func(x r.Term) interface{} { return x})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).ForEach(func(x r.Term) interface{} { return x }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #252") } { // control.yaml line #257 /* err("ReqlQueryLogicError", "FOR_EACH expects one or more basic write queries. Expected type ARRAY but found NUMBER.", [1, 1]) */ var expected_ Err = err("ReqlQueryLogicError", "FOR_EACH expects one or more basic write queries. Expected type ARRAY but found NUMBER.") /* r.expr([1, 2, 3]).for_each(r.row) */ suite.T().Log("About to run line #257: r.Expr([]interface{}{1, 2, 3}).ForEach(r.Row)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).ForEach(r.Row), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #257") } { // control.yaml line #262 /* err("ReqlQueryLogicError", "FOR_EACH expects one or more basic write queries.", [1, 1]) */ var expected_ Err = err("ReqlQueryLogicError", "FOR_EACH expects one or more basic write queries.") /* r.expr([1, 2, 3]).for_each(lambda row:tbl) */ suite.T().Log("About to run line #262: r.Expr([]interface{}{1, 2, 3}).ForEach(func(row r.Term) interface{} { return tbl})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).ForEach(func(row r.Term) interface{} { return tbl }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #262") } { // control.yaml line #271 /* ({'deleted':0.0,'replaced':0.0,'generated_keys':arrlen(1,uuid()),'unchanged':0.0,'errors':0.0,'skipped':0.0,'inserted':1}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0.0, "replaced": 0.0, "generated_keys": arrlen(1, compare.IsUUID()), "unchanged": 0.0, "errors": 0.0, "skipped": 0.0, "inserted": 1} /* r.expr(1).do(tbl.insert({'foo':r.row})) */ suite.T().Log("About to run line #271: r.Expr(1).Do(tbl.Insert(map[interface{}]interface{}{'foo': r.Row, }))") runAndAssert(suite.Suite, expected_, r.Expr(1).Do(tbl.Insert(map[interface{}]interface{}{"foo": r.Row})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #271") } { // control.yaml line #275 /* ({'deleted':0.0,'replaced':0.0,'generated_keys':arrlen(1,uuid()),'unchanged':0.0,'errors':0.0,'skipped':0.0,'inserted':1}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0.0, "replaced": 0.0, "generated_keys": arrlen(1, compare.IsUUID()), "unchanged": 0.0, "errors": 0.0, "skipped": 0.0, "inserted": 1} /* r.expr([1, 2])[0].do(tbl.insert({'foo':r.row})) */ suite.T().Log("About to run line #275: r.Expr([]interface{}{1, 2}).AtIndex(0).Do(tbl.Insert(map[interface{}]interface{}{'foo': r.Row, }))") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2}).AtIndex(0).Do(tbl.Insert(map[interface{}]interface{}{"foo": r.Row})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #275") } { // control.yaml line #280 /* err('ReqlCompileError', 'Cannot nest writes or meta ops in stream operations. Use FOR_EACH instead.', [0]) */ var expected_ Err = err("ReqlCompileError", "Cannot nest writes or meta ops in stream operations. Use FOR_EACH instead.") /* r.expr([1, 2]).map(tbl.insert({'foo':r.row})) */ suite.T().Log("About to run line #280: r.Expr([]interface{}{1, 2}).Map(tbl.Insert(map[interface{}]interface{}{'foo': r.Row, }))") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2}).Map(tbl.Insert(map[interface{}]interface{}{"foo": r.Row})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #280") } { // control.yaml line #284 /* err('ReqlCompileError', 'Cannot nest writes or meta ops in stream operations. Use FOR_EACH instead.', [0]) */ var expected_ Err = err("ReqlCompileError", "Cannot nest writes or meta ops in stream operations. Use FOR_EACH instead.") /* r.expr([1, 2]).map(r.db('test').table_create('table_create_failure')) */ suite.T().Log("About to run line #284: r.Expr([]interface{}{1, 2}).Map(r.DB('test').TableCreate('table_create_failure'))") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2}).Map(r.DB("test").TableCreate("table_create_failure")), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #284") } { // control.yaml line #287 /* err('ReqlCompileError', 'Cannot nest writes or meta ops in stream operations. Use FOR_EACH instead.', [0]) */ var expected_ Err = err("ReqlCompileError", "Cannot nest writes or meta ops in stream operations. Use FOR_EACH instead.") /* r.expr([1, 2]).map(tbl.insert({'foo':r.row}).get_field('inserted')) */ suite.T().Log("About to run line #287: r.Expr([]interface{}{1, 2}).Map(tbl.Insert(map[interface{}]interface{}{'foo': r.Row, }).Field('inserted'))") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2}).Map(tbl.Insert(map[interface{}]interface{}{"foo": r.Row}).Field("inserted")), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #287") } { // control.yaml line #291 /* err('ReqlCompileError', 'Cannot nest writes or meta ops in stream operations. Use FOR_EACH instead.', [0]) */ var expected_ Err = err("ReqlCompileError", "Cannot nest writes or meta ops in stream operations. Use FOR_EACH instead.") /* r.expr([1, 2]).map(tbl.insert({'foo':r.row}).get_field('inserted').add(5)) */ suite.T().Log("About to run line #291: r.Expr([]interface{}{1, 2}).Map(tbl.Insert(map[interface{}]interface{}{'foo': r.Row, }).Field('inserted').Add(5))") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2}).Map(tbl.Insert(map[interface{}]interface{}{"foo": r.Row}).Field("inserted").Add(5)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #291") } { // control.yaml line #295 /* partial({'tables_created':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) /* r.expr(1).do(r.db('test').table_create('table_create_success')) */ suite.T().Log("About to run line #295: r.Expr(1).Do(r.DB('test').TableCreate('table_create_success'))") runAndAssert(suite.Suite, expected_, r.Expr(1).Do(r.DB("test").TableCreate("table_create_success")), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #295") } }
func (suite *ChangefeedsTableSuite) TestCases() { suite.T().Log("Running ChangefeedsTableSuite: Test changefeeds on a table") tbl := r.DB("test").Table("tbl") _ = tbl // Prevent any noused variable errors // changefeeds/table.yaml line #9 // all = tbl.changes() suite.T().Log("Possibly executing: var all r.Term = tbl.Changes()") all := maybeRun(tbl.Changes(), suite.session, r.RunOpts{}) _ = all // Prevent any noused variable errors { // changefeeds/table.yaml line #15 /* partial({'errors':0, 'inserted':2}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "inserted": 2}) /* tbl.insert([{'id':1}, {'id':2}]) */ suite.T().Log("About to run line #15: tbl.Insert([]interface{}{map[interface{}]interface{}{'id': 1, }, map[interface{}]interface{}{'id': 2, }})") runAndAssert(suite.Suite, expected_, tbl.Insert([]interface{}{map[interface{}]interface{}{"id": 1}, map[interface{}]interface{}{"id": 2}}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #15") } { // changefeeds/table.yaml line #17 /* bag([{'old_val':null, 'new_val':{'id':1}}, {'old_val':null, 'new_val':{'id':2}}]) */ var expected_ compare.Expected = compare.UnorderedMatch([]interface{}{map[interface{}]interface{}{"old_val": nil, "new_val": map[interface{}]interface{}{"id": 1}}, map[interface{}]interface{}{"old_val": nil, "new_val": map[interface{}]interface{}{"id": 2}}}) /* fetch(all, 2) */ suite.T().Log("About to run line #17: fetch(all, 2)") fetchAndAssert(suite.Suite, expected_, all, 2) suite.T().Log("Finished running line #17") } { // changefeeds/table.yaml line #22 /* partial({'errors':0, 'replaced':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "replaced": 1}) /* tbl.get(1).update({'version':1}) */ suite.T().Log("About to run line #22: tbl.Get(1).Update(map[interface{}]interface{}{'version': 1, })") runAndAssert(suite.Suite, expected_, tbl.Get(1).Update(map[interface{}]interface{}{"version": 1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #22") } { // changefeeds/table.yaml line #24 /* [{'old_val':{'id':1}, 'new_val':{'id':1, 'version':1}}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"old_val": map[interface{}]interface{}{"id": 1}, "new_val": map[interface{}]interface{}{"id": 1, "version": 1}}} /* fetch(all, 1) */ suite.T().Log("About to run line #24: fetch(all, 1)") fetchAndAssert(suite.Suite, expected_, all, 1) suite.T().Log("Finished running line #24") } { // changefeeds/table.yaml line #29 /* partial({'errors':0, 'deleted':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "deleted": 1}) /* tbl.get(1).delete() */ suite.T().Log("About to run line #29: tbl.Get(1).Delete()") runAndAssert(suite.Suite, expected_, tbl.Get(1).Delete(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #29") } { // changefeeds/table.yaml line #31 /* [{'old_val':{'id':1, 'version':1}, 'new_val':null}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"old_val": map[interface{}]interface{}{"id": 1, "version": 1}, "new_val": nil}} /* fetch(all, 1) */ suite.T().Log("About to run line #31: fetch(all, 1)") fetchAndAssert(suite.Suite, expected_, all, 1) suite.T().Log("Finished running line #31") } // changefeeds/table.yaml line #36 // pluck = tbl.changes().pluck({'new_val':['version']}) suite.T().Log("Possibly executing: var pluck r.Term = tbl.Changes().Pluck(map[interface{}]interface{}{'new_val': []interface{}{'version'}, })") pluck := maybeRun(tbl.Changes().Pluck(map[interface{}]interface{}{"new_val": []interface{}{"version"}}), suite.session, r.RunOpts{}) _ = pluck // Prevent any noused variable errors { // changefeeds/table.yaml line #37 /* partial({'errors':0, 'inserted':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "inserted": 1}) /* tbl.insert([{'id':5, 'version':5}]) */ suite.T().Log("About to run line #37: tbl.Insert([]interface{}{map[interface{}]interface{}{'id': 5, 'version': 5, }})") runAndAssert(suite.Suite, expected_, tbl.Insert([]interface{}{map[interface{}]interface{}{"id": 5, "version": 5}}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #37") } { // changefeeds/table.yaml line #39 /* [{'new_val':{'version':5}}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"version": 5}}} /* fetch(pluck, 1) */ suite.T().Log("About to run line #39: fetch(pluck, 1)") fetchAndAssert(suite.Suite, expected_, pluck, 1) suite.T().Log("Finished running line #39") } { // changefeeds/table.yaml line #44 /* err('ReqlQueryLogicError', "Cannot call a terminal (`reduce`, `count`, etc.) on an infinite stream (such as a changefeed).") */ var expected_ Err = err("ReqlQueryLogicError", "Cannot call a terminal (`reduce`, `count`, etc.) on an infinite stream (such as a changefeed).") /* tbl.changes().order_by('id') */ suite.T().Log("About to run line #44: tbl.Changes().OrderBy('id')") runAndAssert(suite.Suite, expected_, tbl.Changes().OrderBy("id"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #44") } // changefeeds/table.yaml line #59 // overflow = tbl.changes(changefeed_queue_size=100) suite.T().Log("Possibly executing: var overflow r.Term = tbl.Changes().OptArgs(r.ChangesOpts{ChangefeedQueueSize: 100, })") overflow := maybeRun(tbl.Changes().OptArgs(r.ChangesOpts{ChangefeedQueueSize: 100}), suite.session, r.RunOpts{}) _ = overflow // Prevent any noused variable errors { // changefeeds/table.yaml line #62 /* AnythingIsFine */ var expected_ string = compare.AnythingIsFine /* tbl.insert(r.range(200).map(lambda x: {})) */ suite.T().Log("About to run line #62: tbl.Insert(r.Range(200).Map(func(x r.Term) interface{} { return map[interface{}]interface{}{}}))") runAndAssert(suite.Suite, expected_, tbl.Insert(r.Range(200).Map(func(x r.Term) interface{} { return map[interface{}]interface{}{} })), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #62") } { // changefeeds/table.yaml line #64 /* partial([{'error': regex('Changefeed cache over array size limit, skipped \d+ elements.')}]) */ var expected_ compare.Expected = compare.PartialMatch([]interface{}{map[interface{}]interface{}{"error": compare.MatchesRegexp("Changefeed cache over array size limit, skipped \\d+ elements.")}}) /* fetch(overflow, 90) */ suite.T().Log("About to run line #64: fetch(overflow, 90)") fetchAndAssert(suite.Suite, expected_, overflow, 90) suite.T().Log("Finished running line #64") } // changefeeds/table.yaml line #69 // vtbl = r.db('rethinkdb').table('_debug_scratch') suite.T().Log("Possibly executing: var vtbl r.Term = r.DB('rethinkdb').Table('_debug_scratch')") vtbl := r.DB("rethinkdb").Table("_debug_scratch") _ = vtbl // Prevent any noused variable errors // changefeeds/table.yaml line #70 // allVirtual = vtbl.changes() suite.T().Log("Possibly executing: var allVirtual r.Term = vtbl.Changes()") allVirtual := maybeRun(vtbl.Changes(), suite.session, r.RunOpts{}) _ = allVirtual // Prevent any noused variable errors { // changefeeds/table.yaml line #74 /* partial({'errors':0, 'inserted':2}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "inserted": 2}) /* vtbl.insert([{'id':1}, {'id':2}]) */ suite.T().Log("About to run line #74: vtbl.Insert([]interface{}{map[interface{}]interface{}{'id': 1, }, map[interface{}]interface{}{'id': 2, }})") runAndAssert(suite.Suite, expected_, vtbl.Insert([]interface{}{map[interface{}]interface{}{"id": 1}, map[interface{}]interface{}{"id": 2}}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #74") } { // changefeeds/table.yaml line #76 /* bag([{'old_val':null, 'new_val':{'id':1}}, {'old_val':null, 'new_val':{'id':2}}]) */ var expected_ compare.Expected = compare.UnorderedMatch([]interface{}{map[interface{}]interface{}{"old_val": nil, "new_val": map[interface{}]interface{}{"id": 1}}, map[interface{}]interface{}{"old_val": nil, "new_val": map[interface{}]interface{}{"id": 2}}}) /* fetch(allVirtual, 2) */ suite.T().Log("About to run line #76: fetch(allVirtual, 2)") fetchAndAssert(suite.Suite, expected_, allVirtual, 2) suite.T().Log("Finished running line #76") } { // changefeeds/table.yaml line #81 /* partial({'errors':0, 'replaced':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "replaced": 1}) /* vtbl.get(1).update({'version':1}) */ suite.T().Log("About to run line #81: vtbl.Get(1).Update(map[interface{}]interface{}{'version': 1, })") runAndAssert(suite.Suite, expected_, vtbl.Get(1).Update(map[interface{}]interface{}{"version": 1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #81") } { // changefeeds/table.yaml line #83 /* [{'old_val':{'id':1}, 'new_val':{'id':1, 'version':1}}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"old_val": map[interface{}]interface{}{"id": 1}, "new_val": map[interface{}]interface{}{"id": 1, "version": 1}}} /* fetch(allVirtual, 1) */ suite.T().Log("About to run line #83: fetch(allVirtual, 1)") fetchAndAssert(suite.Suite, expected_, allVirtual, 1) suite.T().Log("Finished running line #83") } { // changefeeds/table.yaml line #88 /* partial({'errors':0, 'deleted':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "deleted": 1}) /* vtbl.get(1).delete() */ suite.T().Log("About to run line #88: vtbl.Get(1).Delete()") runAndAssert(suite.Suite, expected_, vtbl.Get(1).Delete(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #88") } { // changefeeds/table.yaml line #90 /* [{'old_val':{'id':1, 'version':1}, 'new_val':null}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"old_val": map[interface{}]interface{}{"id": 1, "version": 1}, "new_val": nil}} /* fetch(allVirtual, 1) */ suite.T().Log("About to run line #90: fetch(allVirtual, 1)") fetchAndAssert(suite.Suite, expected_, allVirtual, 1) suite.T().Log("Finished running line #90") } // changefeeds/table.yaml line #95 // vpluck = vtbl.changes().pluck({'new_val':['version']}) suite.T().Log("Possibly executing: var vpluck r.Term = vtbl.Changes().Pluck(map[interface{}]interface{}{'new_val': []interface{}{'version'}, })") vpluck := maybeRun(vtbl.Changes().Pluck(map[interface{}]interface{}{"new_val": []interface{}{"version"}}), suite.session, r.RunOpts{}) _ = vpluck // Prevent any noused variable errors { // changefeeds/table.yaml line #96 /* partial({'errors':0, 'inserted':1}) */ var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "inserted": 1}) /* vtbl.insert([{'id':5, 'version':5}]) */ suite.T().Log("About to run line #96: vtbl.Insert([]interface{}{map[interface{}]interface{}{'id': 5, 'version': 5, }})") runAndAssert(suite.Suite, expected_, vtbl.Insert([]interface{}{map[interface{}]interface{}{"id": 5, "version": 5}}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #96") } { // changefeeds/table.yaml line #98 /* [{'new_val':{'version':5}}] */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"version": 5}}} /* fetch(vpluck, 1) */ suite.T().Log("About to run line #98: fetch(vpluck, 1)") fetchAndAssert(suite.Suite, expected_, vpluck, 1) suite.T().Log("Finished running line #98") } }