func (suite *MathLogicMathSuite) TestCases() { suite.T().Log("Running MathLogicMathSuite: Tests of nested arithmetic expressions") { // math_logic/math.yaml line #4 /* 1 */ var expected_ int = 1 /* (((4 + 2 * (r.expr(26) % 18)) / 5) - 3) */ suite.T().Log("About to run line #4: r.Add(4, r.Mul(2, r.Expr(26).Mod(18))).Div(5).Sub(3)") runAndAssert(suite.Suite, expected_, r.Add(4, r.Mul(2, r.Expr(26).Mod(18))).Div(5).Sub(3), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #4") } }
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 *MathLogicMulSuite) TestCases() { suite.T().Log("Running MathLogicMulSuite: Tests for the basic usage of the multiplication operation") { // math_logic/mul.yaml line #6 /* 2 */ var expected_ int = 2 /* r.expr(1) * 2 */ suite.T().Log("About to run line #6: r.Expr(1).Mul(2)") runAndAssert(suite.Suite, expected_, r.Expr(1).Mul(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #6") } { // math_logic/mul.yaml line #7 /* 2 */ var expected_ int = 2 /* 1 * r.expr(2) */ suite.T().Log("About to run line #7: r.Mul(1, r.Expr(2))") runAndAssert(suite.Suite, expected_, r.Mul(1, r.Expr(2)), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #7") } { // math_logic/mul.yaml line #8 /* 2 */ var expected_ int = 2 /* r.expr(1).mul(2) */ suite.T().Log("About to run line #8: r.Expr(1).Mul(2)") runAndAssert(suite.Suite, expected_, r.Expr(1).Mul(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #8") } { // math_logic/mul.yaml line #15 /* 1 */ var expected_ int = 1 /* r.expr(-1) * -1 */ suite.T().Log("About to run line #15: r.Expr(-1).Mul(-1)") runAndAssert(suite.Suite, expected_, r.Expr(-1).Mul(-1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #15") } { // math_logic/mul.yaml line #21 /* 6.75 */ var expected_ float64 = 6.75 /* r.expr(1.5) * 4.5 */ suite.T().Log("About to run line #21: r.Expr(1.5).Mul(4.5)") runAndAssert(suite.Suite, expected_, r.Expr(1.5).Mul(4.5), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #21") } { // math_logic/mul.yaml line #25 /* [1,2,3,1,2,3,1,2,3] */ var expected_ []interface{} = []interface{}{1, 2, 3, 1, 2, 3, 1, 2, 3} /* r.expr([1,2,3]) * 3 */ suite.T().Log("About to run line #25: r.Expr([]interface{}{1, 2, 3}).Mul(3)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).Mul(3), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #25") } { // math_logic/mul.yaml line #30 /* 120 */ var expected_ int = 120 /* r.expr(1).mul(2,3,4,5) */ suite.T().Log("About to run line #30: r.Expr(1).Mul(2, 3, 4, 5)") runAndAssert(suite.Suite, expected_, r.Expr(1).Mul(2, 3, 4, 5), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #30") } { // math_logic/mul.yaml line #46 /* err('ReqlQueryLogicError', 'Expected type NUMBER but found STRING.', [0]) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type NUMBER but found STRING.") /* r.expr('a') * 0.8 */ suite.T().Log("About to run line #46: r.Expr('a').Mul(0.8)") runAndAssert(suite.Suite, expected_, r.Expr("a").Mul(0.8), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #46") } { // math_logic/mul.yaml line #50 /* err('ReqlQueryLogicError', 'Expected type NUMBER but found STRING.', [1]) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type NUMBER but found STRING.") /* r.expr(1) * 'a' */ suite.T().Log("About to run line #50: r.Expr(1).Mul('a')") runAndAssert(suite.Suite, expected_, r.Expr(1).Mul("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #50") } { // math_logic/mul.yaml line #54 /* err('ReqlQueryLogicError', 'Expected type NUMBER but found STRING.', [0]) */ var expected_ Err = err("ReqlQueryLogicError", "Expected type NUMBER but found STRING.") /* r.expr('b') * 'a' */ suite.T().Log("About to run line #54: r.Expr('b').Mul('a')") runAndAssert(suite.Suite, expected_, r.Expr("b").Mul("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #54") } { // math_logic/mul.yaml line #58 /* err('ReqlQueryLogicError', 'Number not an integer: 1.5', [0]) */ var expected_ Err = err("ReqlQueryLogicError", "Number not an integer: 1.5") /* r.expr([]) * 1.5 */ suite.T().Log("About to run line #58: r.Expr([]interface{}{}).Mul(1.5)") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{}).Mul(1.5), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #58") } }
func (suite *MathLogicAliasesSuite) TestCases() { suite.T().Log("Running MathLogicAliasesSuite: Test named aliases for math and logic operators") { // math_logic/aliases.yaml line #5 /* 1 */ var expected_ int = 1 /* r.expr(0).add(1) */ suite.T().Log("About to run line #5: r.Expr(0).Add(1)") runAndAssert(suite.Suite, expected_, r.Expr(0).Add(1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #5") } { // math_logic/aliases.yaml line #6 /* 1 */ var expected_ int = 1 /* r.add(0, 1) */ suite.T().Log("About to run line #6: r.Add(0, 1)") runAndAssert(suite.Suite, expected_, r.Add(0, 1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #6") } { // math_logic/aliases.yaml line #7 /* 1 */ var expected_ int = 1 /* r.expr(2).sub(1) */ suite.T().Log("About to run line #7: r.Expr(2).Sub(1)") runAndAssert(suite.Suite, expected_, r.Expr(2).Sub(1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #7") } { // math_logic/aliases.yaml line #8 /* 1 */ var expected_ int = 1 /* r.sub(2, 1) */ suite.T().Log("About to run line #8: r.Sub(2, 1)") runAndAssert(suite.Suite, expected_, r.Sub(2, 1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #8") } { // math_logic/aliases.yaml line #9 /* 1 */ var expected_ int = 1 /* r.expr(2).div(2) */ suite.T().Log("About to run line #9: r.Expr(2).Div(2)") runAndAssert(suite.Suite, expected_, r.Expr(2).Div(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #9") } { // math_logic/aliases.yaml line #10 /* 1 */ var expected_ int = 1 /* r.div(2, 2) */ suite.T().Log("About to run line #10: r.Div(2, 2)") runAndAssert(suite.Suite, expected_, r.Div(2, 2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #10") } { // math_logic/aliases.yaml line #11 /* 1 */ var expected_ int = 1 /* r.expr(1).mul(1) */ suite.T().Log("About to run line #11: r.Expr(1).Mul(1)") runAndAssert(suite.Suite, expected_, r.Expr(1).Mul(1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #11") } { // math_logic/aliases.yaml line #12 /* 1 */ var expected_ int = 1 /* r.mul(1, 1) */ suite.T().Log("About to run line #12: r.Mul(1, 1)") runAndAssert(suite.Suite, expected_, r.Mul(1, 1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #12") } { // math_logic/aliases.yaml line #13 /* 1 */ var expected_ int = 1 /* r.expr(1).mod(2) */ suite.T().Log("About to run line #13: r.Expr(1).Mod(2)") runAndAssert(suite.Suite, expected_, r.Expr(1).Mod(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #13") } { // math_logic/aliases.yaml line #14 /* 1 */ var expected_ int = 1 /* r.mod(1, 2) */ suite.T().Log("About to run line #14: r.Mod(1, 2)") runAndAssert(suite.Suite, expected_, r.Mod(1, 2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #14") } { // math_logic/aliases.yaml line #25 /* True */ var expected_ bool = true /* r.expr(True).and_(True) */ suite.T().Log("About to run line #25: r.Expr(true).And(true)") runAndAssert(suite.Suite, expected_, r.Expr(true).And(true), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #25") } { // math_logic/aliases.yaml line #26 /* True */ var expected_ bool = true /* r.expr(True).or_(True) */ suite.T().Log("About to run line #26: r.Expr(true).Or(true)") runAndAssert(suite.Suite, expected_, r.Expr(true).Or(true), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #26") } { // math_logic/aliases.yaml line #27 /* True */ var expected_ bool = true /* r.and_(True, True) */ suite.T().Log("About to run line #27: r.And(true, true)") runAndAssert(suite.Suite, expected_, r.And(true, true), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #27") } { // math_logic/aliases.yaml line #28 /* True */ var expected_ bool = true /* r.or_(True, True) */ suite.T().Log("About to run line #28: r.Or(true, true)") runAndAssert(suite.Suite, expected_, r.Or(true, true), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #28") } { // math_logic/aliases.yaml line #29 /* True */ var expected_ bool = true /* r.expr(False).not_() */ suite.T().Log("About to run line #29: r.Expr(false).Not()") runAndAssert(suite.Suite, expected_, r.Expr(false).Not(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #29") } { // math_logic/aliases.yaml line #30 /* True */ var expected_ bool = true /* r.not_(False) */ suite.T().Log("About to run line #30: r.Not(false)") runAndAssert(suite.Suite, expected_, r.Not(false), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #30") } { // math_logic/aliases.yaml line #34 /* True */ var expected_ bool = true /* r.expr(1).eq(1) */ suite.T().Log("About to run line #34: r.Expr(1).Eq(1)") runAndAssert(suite.Suite, expected_, r.Expr(1).Eq(1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #34") } { // math_logic/aliases.yaml line #35 /* True */ var expected_ bool = true /* r.expr(1).ne(2) */ suite.T().Log("About to run line #35: r.Expr(1).Ne(2)") runAndAssert(suite.Suite, expected_, r.Expr(1).Ne(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #35") } { // math_logic/aliases.yaml line #36 /* True */ var expected_ bool = true /* r.expr(1).lt(2) */ suite.T().Log("About to run line #36: r.Expr(1).Lt(2)") runAndAssert(suite.Suite, expected_, r.Expr(1).Lt(2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #36") } { // math_logic/aliases.yaml line #37 /* True */ var expected_ bool = true /* r.expr(1).gt(0) */ suite.T().Log("About to run line #37: r.Expr(1).Gt(0)") runAndAssert(suite.Suite, expected_, r.Expr(1).Gt(0), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #37") } { // math_logic/aliases.yaml line #38 /* True */ var expected_ bool = true /* r.expr(1).le(1) */ suite.T().Log("About to run line #38: r.Expr(1).Le(1)") runAndAssert(suite.Suite, expected_, r.Expr(1).Le(1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #38") } { // math_logic/aliases.yaml line #39 /* True */ var expected_ bool = true /* r.expr(1).ge(1) */ suite.T().Log("About to run line #39: r.Expr(1).Ge(1)") runAndAssert(suite.Suite, expected_, r.Expr(1).Ge(1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #39") } { // math_logic/aliases.yaml line #40 /* True */ var expected_ bool = true /* r.eq(1, 1) */ suite.T().Log("About to run line #40: r.Eq(1, 1)") runAndAssert(suite.Suite, expected_, r.Eq(1, 1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #40") } { // math_logic/aliases.yaml line #41 /* True */ var expected_ bool = true /* r.ne(1, 2) */ suite.T().Log("About to run line #41: r.Ne(1, 2)") runAndAssert(suite.Suite, expected_, r.Ne(1, 2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #41") } { // math_logic/aliases.yaml line #42 /* True */ var expected_ bool = true /* r.lt(1, 2) */ suite.T().Log("About to run line #42: r.Lt(1, 2)") runAndAssert(suite.Suite, expected_, r.Lt(1, 2), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #42") } { // math_logic/aliases.yaml line #43 /* True */ var expected_ bool = true /* r.gt(1, 0) */ suite.T().Log("About to run line #43: r.Gt(1, 0)") runAndAssert(suite.Suite, expected_, r.Gt(1, 0), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #43") } { // math_logic/aliases.yaml line #44 /* True */ var expected_ bool = true /* r.le(1, 1) */ suite.T().Log("About to run line #44: r.Le(1, 1)") runAndAssert(suite.Suite, expected_, r.Le(1, 1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #44") } { // math_logic/aliases.yaml line #45 /* True */ var expected_ bool = true /* r.ge(1, 1) */ suite.T().Log("About to run line #45: r.Ge(1, 1)") runAndAssert(suite.Suite, expected_, r.Ge(1, 1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #45") } }
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") } }