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 *ChangefeedsEdgeSuite) TestCases() { suite.T().Log("Running ChangefeedsEdgeSuite: Test edge cases of changefeed operations") tbl := r.DB("test").Table("tbl") _ = tbl // Prevent any noused variable errors // changefeeds/edge.yaml line #5 // common_prefix = r.expr([0,1,2,3,4,5,6,7,8]) suite.T().Log("Possibly executing: var common_prefix r.Term = r.Expr([]interface{}{0, 1, 2, 3, 4, 5, 6, 7, 8})") common_prefix := r.Expr([]interface{}{0, 1, 2, 3, 4, 5, 6, 7, 8}) _ = common_prefix // Prevent any noused variable errors { // changefeeds/edge.yaml line #8 /* ({'created':1}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"created": 1} /* tbl.index_create('sindex', lambda row:common_prefix.append(row['value'])) */ suite.T().Log("About to run line #8: tbl.IndexCreateFunc('sindex', func(row r.Term) interface{} { return common_prefix.Append(row.AtIndex('value'))})") runAndAssert(suite.Suite, expected_, tbl.IndexCreateFunc("sindex", func(row r.Term) interface{} { return common_prefix.Append(row.AtIndex("value")) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #8") } { // changefeeds/edge.yaml line #11 /* AnythingIsFine */ var expected_ string = compare.AnythingIsFine /* tbl.index_wait('sindex') */ suite.T().Log("About to run line #11: tbl.IndexWait('sindex')") runAndAssert(suite.Suite, expected_, tbl.IndexWait("sindex"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #11") } // changefeeds/edge.yaml line #14 // pre = r.range(7).coerce_to('array').add(r.range(10,70).coerce_to('array')).append(100).map(r.row.coerce_to('string')) suite.T().Log("Possibly executing: var pre r.Term = r.Range(7).CoerceTo('array').Add(r.Range(10, 70).CoerceTo('array')).Append(100).Map(r.Row.CoerceTo('string'))") pre := maybeRun(r.Range(7).CoerceTo("array").Add(r.Range(10, 70).CoerceTo("array")).Append(100).Map(r.Row.CoerceTo("string")), suite.session, r.RunOpts{}) _ = pre // Prevent any noused variable errors // changefeeds/edge.yaml line #16 // mid = r.range(2,9).coerce_to('array').add(r.range(20,90).coerce_to('array')).map(r.row.coerce_to('string')) suite.T().Log("Possibly executing: var mid r.Term = r.Range(2, 9).CoerceTo('array').Add(r.Range(20, 90).CoerceTo('array')).Map(r.Row.CoerceTo('string'))") mid := maybeRun(r.Range(2, 9).CoerceTo("array").Add(r.Range(20, 90).CoerceTo("array")).Map(r.Row.CoerceTo("string")), suite.session, r.RunOpts{}) _ = mid // Prevent any noused variable errors // changefeeds/edge.yaml line #18 // post = r.range(3,10).coerce_to('array').add(r.range(30,100).coerce_to('array')).map(r.row.coerce_to('string')) suite.T().Log("Possibly executing: var post r.Term = r.Range(3, 10).CoerceTo('array').Add(r.Range(30, 100).CoerceTo('array')).Map(r.Row.CoerceTo('string'))") post := maybeRun(r.Range(3, 10).CoerceTo("array").Add(r.Range(30, 100).CoerceTo("array")).Map(r.Row.CoerceTo("string")), suite.session, r.RunOpts{}) _ = post // Prevent any noused variable errors // changefeeds/edge.yaml line #21 // erroredres = r.range(2).coerce_to('array').add(r.range(10, 20).coerce_to('array')).append(100).map(r.row.coerce_to('string')) suite.T().Log("Possibly executing: var erroredres r.Term = r.Range(2).CoerceTo('array').Add(r.Range(10, 20).CoerceTo('array')).Append(100).Map(r.Row.CoerceTo('string'))") erroredres := maybeRun(r.Range(2).CoerceTo("array").Add(r.Range(10, 20).CoerceTo("array")).Append(100).Map(r.Row.CoerceTo("string")), suite.session, r.RunOpts{}) _ = erroredres // Prevent any noused variable errors // changefeeds/edge.yaml line #26 // pre_changes = tbl.between(r.minval, common_prefix.append('7'), index='sindex').changes(squash=False).limit(len(pre))['new_val']['value'] suite.T().Log("Possibly executing: var pre_changes r.Term = tbl.Between(r.MinVal, common_prefix.Append('7')).OptArgs(r.BetweenOpts{Index: 'sindex', }).Changes().OptArgs(r.ChangesOpts{Squash: false, }).Limit(maybeLen(pre)).AtIndex('new_val').AtIndex('value')") pre_changes := maybeRun(tbl.Between(r.MinVal, common_prefix.Append("7")).OptArgs(r.BetweenOpts{Index: "sindex"}).Changes().OptArgs(r.ChangesOpts{Squash: false}).Limit(maybeLen(pre)).AtIndex("new_val").AtIndex("value"), suite.session, r.RunOpts{}) _ = pre_changes // Prevent any noused variable errors // changefeeds/edge.yaml line #29 // mid_changes = tbl.between(common_prefix.append('2'), common_prefix.append('9'), index='sindex').changes(squash=False).limit(len(post))['new_val']['value'] suite.T().Log("Possibly executing: var mid_changes r.Term = tbl.Between(common_prefix.Append('2'), common_prefix.Append('9')).OptArgs(r.BetweenOpts{Index: 'sindex', }).Changes().OptArgs(r.ChangesOpts{Squash: false, }).Limit(maybeLen(post)).AtIndex('new_val').AtIndex('value')") mid_changes := maybeRun(tbl.Between(common_prefix.Append("2"), common_prefix.Append("9")).OptArgs(r.BetweenOpts{Index: "sindex"}).Changes().OptArgs(r.ChangesOpts{Squash: false}).Limit(maybeLen(post)).AtIndex("new_val").AtIndex("value"), suite.session, r.RunOpts{}) _ = mid_changes // Prevent any noused variable errors // changefeeds/edge.yaml line #32 // post_changes = tbl.between(common_prefix.append('3'), r.maxval, index='sindex').changes(squash=False).limit(len(mid))['new_val']['value'] suite.T().Log("Possibly executing: var post_changes r.Term = tbl.Between(common_prefix.Append('3'), r.MaxVal).OptArgs(r.BetweenOpts{Index: 'sindex', }).Changes().OptArgs(r.ChangesOpts{Squash: false, }).Limit(maybeLen(mid)).AtIndex('new_val').AtIndex('value')") post_changes := maybeRun(tbl.Between(common_prefix.Append("3"), r.MaxVal).OptArgs(r.BetweenOpts{Index: "sindex"}).Changes().OptArgs(r.ChangesOpts{Squash: false}).Limit(maybeLen(mid)).AtIndex("new_val").AtIndex("value"), suite.session, r.RunOpts{}) _ = post_changes // Prevent any noused variable errors // changefeeds/edge.yaml line #38 // premap_changes1 = tbl.map(r.branch(r.row['value'].lt('2'), r.row, r.row["dummy"])).changes(squash=False).limit(len(erroredres))['new_val']['value'] suite.T().Log("Possibly executing: var premap_changes1 r.Term = tbl.Map(r.Branch(r.Row.AtIndex('value').Lt('2'), r.Row, r.Row.AtIndex('dummy'))).Changes().OptArgs(r.ChangesOpts{Squash: false, }).Limit(maybeLen(erroredres)).AtIndex('new_val').AtIndex('value')") premap_changes1 := maybeRun(tbl.Map(r.Branch(r.Row.AtIndex("value").Lt("2"), r.Row, r.Row.AtIndex("dummy"))).Changes().OptArgs(r.ChangesOpts{Squash: false}).Limit(maybeLen(erroredres)).AtIndex("new_val").AtIndex("value"), suite.session, r.RunOpts{}) _ = premap_changes1 // Prevent any noused variable errors // changefeeds/edge.yaml line #42 // postmap_changes1 = tbl.changes(squash=False).map(r.branch(r.row['new_val']['value'].lt('2'), r.row, r.row["dummy"])).limit(len(erroredres))['new_val']['value'] suite.T().Log("Possibly executing: var postmap_changes1 r.Term = tbl.Changes().OptArgs(r.ChangesOpts{Squash: false, }).Map(r.Branch(r.Row.AtIndex('new_val').AtIndex('value').Lt('2'), r.Row, r.Row.AtIndex('dummy'))).Limit(maybeLen(erroredres)).AtIndex('new_val').AtIndex('value')") postmap_changes1 := maybeRun(tbl.Changes().OptArgs(r.ChangesOpts{Squash: false}).Map(r.Branch(r.Row.AtIndex("new_val").AtIndex("value").Lt("2"), r.Row, r.Row.AtIndex("dummy"))).Limit(maybeLen(erroredres)).AtIndex("new_val").AtIndex("value"), suite.session, r.RunOpts{}) _ = postmap_changes1 // Prevent any noused variable errors // changefeeds/edge.yaml line #46 // prefilter_changes1 = tbl.filter(r.branch(r.row['value'].lt('2'), True, r.row["dummy"])).changes(squash=False).limit(len(erroredres))['new_val']['value'] suite.T().Log("Possibly executing: var prefilter_changes1 r.Term = tbl.Filter(r.Branch(r.Row.AtIndex('value').Lt('2'), true, r.Row.AtIndex('dummy'))).Changes().OptArgs(r.ChangesOpts{Squash: false, }).Limit(maybeLen(erroredres)).AtIndex('new_val').AtIndex('value')") prefilter_changes1 := maybeRun(tbl.Filter(r.Branch(r.Row.AtIndex("value").Lt("2"), true, r.Row.AtIndex("dummy"))).Changes().OptArgs(r.ChangesOpts{Squash: false}).Limit(maybeLen(erroredres)).AtIndex("new_val").AtIndex("value"), suite.session, r.RunOpts{}) _ = prefilter_changes1 // Prevent any noused variable errors // changefeeds/edge.yaml line #50 // postfilter_changes1 = tbl.changes(squash=False).filter(r.branch(r.row['new_val']['value'].lt('2'), True, r.row["dummy"])).limit(len(erroredres))['new_val']['value'] suite.T().Log("Possibly executing: var postfilter_changes1 r.Term = tbl.Changes().OptArgs(r.ChangesOpts{Squash: false, }).Filter(r.Branch(r.Row.AtIndex('new_val').AtIndex('value').Lt('2'), true, r.Row.AtIndex('dummy'))).Limit(maybeLen(erroredres)).AtIndex('new_val').AtIndex('value')") postfilter_changes1 := maybeRun(tbl.Changes().OptArgs(r.ChangesOpts{Squash: false}).Filter(r.Branch(r.Row.AtIndex("new_val").AtIndex("value").Lt("2"), true, r.Row.AtIndex("dummy"))).Limit(maybeLen(erroredres)).AtIndex("new_val").AtIndex("value"), suite.session, r.RunOpts{}) _ = postfilter_changes1 // Prevent any noused variable errors // changefeeds/edge.yaml line #56 // premap_changes2 = tbl.map(r.branch(r.row['value'].lt('2'), r.row, r.expr([])[1])).changes(squash=False).limit(len(erroredres))['new_val']['value'] suite.T().Log("Possibly executing: var premap_changes2 r.Term = tbl.Map(r.Branch(r.Row.AtIndex('value').Lt('2'), r.Row, r.Expr([]interface{}{}).AtIndex(1))).Changes().OptArgs(r.ChangesOpts{Squash: false, }).Limit(maybeLen(erroredres)).AtIndex('new_val').AtIndex('value')") premap_changes2 := maybeRun(tbl.Map(r.Branch(r.Row.AtIndex("value").Lt("2"), r.Row, r.Expr([]interface{}{}).AtIndex(1))).Changes().OptArgs(r.ChangesOpts{Squash: false}).Limit(maybeLen(erroredres)).AtIndex("new_val").AtIndex("value"), suite.session, r.RunOpts{}) _ = premap_changes2 // Prevent any noused variable errors // changefeeds/edge.yaml line #60 // postmap_changes2 = tbl.changes(squash=False).map(r.branch(r.row['new_val']['value'].lt('2'), r.row, r.expr([])[1])).limit(len(erroredres))['new_val']['value'] suite.T().Log("Possibly executing: var postmap_changes2 r.Term = tbl.Changes().OptArgs(r.ChangesOpts{Squash: false, }).Map(r.Branch(r.Row.AtIndex('new_val').AtIndex('value').Lt('2'), r.Row, r.Expr([]interface{}{}).AtIndex(1))).Limit(maybeLen(erroredres)).AtIndex('new_val').AtIndex('value')") postmap_changes2 := maybeRun(tbl.Changes().OptArgs(r.ChangesOpts{Squash: false}).Map(r.Branch(r.Row.AtIndex("new_val").AtIndex("value").Lt("2"), r.Row, r.Expr([]interface{}{}).AtIndex(1))).Limit(maybeLen(erroredres)).AtIndex("new_val").AtIndex("value"), suite.session, r.RunOpts{}) _ = postmap_changes2 // Prevent any noused variable errors // changefeeds/edge.yaml line #64 // prefilter_changes2 = tbl.filter(r.branch(r.row['value'].lt('2'), True, r.expr([])[1])).changes(squash=False).limit(len(erroredres))['new_val']['value'] suite.T().Log("Possibly executing: var prefilter_changes2 r.Term = tbl.Filter(r.Branch(r.Row.AtIndex('value').Lt('2'), true, r.Expr([]interface{}{}).AtIndex(1))).Changes().OptArgs(r.ChangesOpts{Squash: false, }).Limit(maybeLen(erroredres)).AtIndex('new_val').AtIndex('value')") prefilter_changes2 := maybeRun(tbl.Filter(r.Branch(r.Row.AtIndex("value").Lt("2"), true, r.Expr([]interface{}{}).AtIndex(1))).Changes().OptArgs(r.ChangesOpts{Squash: false}).Limit(maybeLen(erroredres)).AtIndex("new_val").AtIndex("value"), suite.session, r.RunOpts{}) _ = prefilter_changes2 // Prevent any noused variable errors // changefeeds/edge.yaml line #68 // postfilter_changes2 = tbl.changes(squash=False).filter(r.branch(r.row['new_val']['value'].lt('2'), True, r.expr([])[1])).limit(len(erroredres))['new_val']['value'] suite.T().Log("Possibly executing: var postfilter_changes2 r.Term = tbl.Changes().OptArgs(r.ChangesOpts{Squash: false, }).Filter(r.Branch(r.Row.AtIndex('new_val').AtIndex('value').Lt('2'), true, r.Expr([]interface{}{}).AtIndex(1))).Limit(maybeLen(erroredres)).AtIndex('new_val').AtIndex('value')") postfilter_changes2 := maybeRun(tbl.Changes().OptArgs(r.ChangesOpts{Squash: false}).Filter(r.Branch(r.Row.AtIndex("new_val").AtIndex("value").Lt("2"), true, r.Expr([]interface{}{}).AtIndex(1))).Limit(maybeLen(erroredres)).AtIndex("new_val").AtIndex("value"), suite.session, r.RunOpts{}) _ = postfilter_changes2 // Prevent any noused variable errors // changefeeds/edge.yaml line #73 // nondetermmap = r.branch(r.random().gt(0.5), r.row, r.error("dummy")) suite.T().Log("Possibly executing: var nondetermmap r.Term = r.Branch(r.Random().Gt(0.5), r.Row, r.Error('dummy'))") nondetermmap := r.Branch(r.Random().Gt(0.5), r.Row, r.Error("dummy")) _ = nondetermmap // Prevent any noused variable errors // changefeeds/edge.yaml line #77 // nondetermfilter = lambda row:r.random().gt(0.5) suite.T().Log("Possibly executing: var nondetermfilter func() = func(row interface{}) interface{} { return r.Random().Gt(0.5)}") nondetermfilter := func(row interface{}) interface{} { return r.Random().Gt(0.5) } _ = nondetermfilter // Prevent any noused variable errors { // changefeeds/edge.yaml line #83 /* err('ReqlQueryLogicError', 'Cannot call `changes` after a non-deterministic function.') */ var expected_ Err = err("ReqlQueryLogicError", "Cannot call `changes` after a non-deterministic function.") /* tbl.map(nondetermmap).changes(squash=False) */ suite.T().Log("About to run line #83: tbl.Map(nondetermmap).Changes().OptArgs(r.ChangesOpts{Squash: false, })") runAndAssert(suite.Suite, expected_, tbl.Map(nondetermmap).Changes().OptArgs(r.ChangesOpts{Squash: false}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #83") } // changefeeds/edge.yaml line #88 // postmap_changes3 = tbl.changes(squash=False).map(nondetermmap).limit(100) suite.T().Log("Possibly executing: var postmap_changes3 r.Term = tbl.Changes().OptArgs(r.ChangesOpts{Squash: false, }).Map(nondetermmap).Limit(100)") postmap_changes3 := maybeRun(tbl.Changes().OptArgs(r.ChangesOpts{Squash: false}).Map(nondetermmap).Limit(100), suite.session, r.RunOpts{}) _ = postmap_changes3 // Prevent any noused variable errors { // changefeeds/edge.yaml line #92 /* err('ReqlQueryLogicError', 'Cannot call `changes` after a non-deterministic function.') */ var expected_ Err = err("ReqlQueryLogicError", "Cannot call `changes` after a non-deterministic function.") /* tbl.filter(nondetermfilter).changes(squash=False) */ suite.T().Log("About to run line #92: tbl.Filter(nondetermfilter).Changes().OptArgs(r.ChangesOpts{Squash: false, })") runAndAssert(suite.Suite, expected_, tbl.Filter(nondetermfilter).Changes().OptArgs(r.ChangesOpts{Squash: false}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #92") } // changefeeds/edge.yaml line #97 // postfilter_changes3 = tbl.changes(squash=False).filter(nondetermfilter).limit(4) suite.T().Log("Possibly executing: var postfilter_changes3 r.Term = tbl.Changes().OptArgs(r.ChangesOpts{Squash: false, }).Filter(nondetermfilter).Limit(4)") postfilter_changes3 := maybeRun(tbl.Changes().OptArgs(r.ChangesOpts{Squash: false}).Filter(nondetermfilter).Limit(4), suite.session, r.RunOpts{}) _ = postfilter_changes3 // Prevent any noused variable errors { // changefeeds/edge.yaml line #100 /* ({'skipped':0,'deleted':0,'unchanged':0,'errors':0,'replaced':0,'inserted':101}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"skipped": 0, "deleted": 0, "unchanged": 0, "errors": 0, "replaced": 0, "inserted": 101} /* tbl.insert(r.range(101).map({'id':r.uuid().coerce_to('binary').slice(0,r.random(4,24)).coerce_to('string'),'value':r.row.coerce_to('string')})) */ suite.T().Log("About to run line #100: tbl.Insert(r.Range(101).Map(map[interface{}]interface{}{'id': r.UUID().CoerceTo('binary').Slice(0, r.Random(4, 24)).CoerceTo('string'), 'value': r.Row.CoerceTo('string'), }))") runAndAssert(suite.Suite, expected_, tbl.Insert(r.Range(101).Map(map[interface{}]interface{}{"id": r.UUID().CoerceTo("binary").Slice(0, r.Random(4, 24)).CoerceTo("string"), "value": r.Row.CoerceTo("string")})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #100") } { // changefeeds/edge.yaml line #105 /* bag(pre) */ var expected_ compare.Expected = compare.UnorderedMatch(pre) /* pre_changes */ suite.T().Log("About to run line #105: pre_changes") runAndAssert(suite.Suite, expected_, pre_changes, suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #105") } { // changefeeds/edge.yaml line #108 /* bag(mid) */ var expected_ compare.Expected = compare.UnorderedMatch(mid) /* mid_changes */ suite.T().Log("About to run line #108: mid_changes") runAndAssert(suite.Suite, expected_, mid_changes, suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #108") } { // changefeeds/edge.yaml line #111 /* bag(post) */ var expected_ compare.Expected = compare.UnorderedMatch(post) /* post_changes */ suite.T().Log("About to run line #111: post_changes") runAndAssert(suite.Suite, expected_, post_changes, suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #111") } { // changefeeds/edge.yaml line #114 /* bag(erroredres) */ var expected_ compare.Expected = compare.UnorderedMatch(erroredres) /* premap_changes1 */ suite.T().Log("About to run line #114: premap_changes1") runAndAssert(suite.Suite, expected_, premap_changes1, suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #114") } { // changefeeds/edge.yaml line #117 /* bag(erroredres) */ var expected_ compare.Expected = compare.UnorderedMatch(erroredres) /* premap_changes2 */ suite.T().Log("About to run line #117: premap_changes2") runAndAssert(suite.Suite, expected_, premap_changes2, suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #117") } { // changefeeds/edge.yaml line #120 /* err('ReqlNonExistenceError', "No attribute `dummy` in object:") */ var expected_ Err = err("ReqlNonExistenceError", "No attribute `dummy` in object:") /* postmap_changes1 */ suite.T().Log("About to run line #120: postmap_changes1") runAndAssert(suite.Suite, expected_, postmap_changes1, suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #120") } { // changefeeds/edge.yaml line #123 /* err('ReqlNonExistenceError', "Index out of bounds:" + " 1") */ var expected_ Err = err("ReqlNonExistenceError", "Index out of bounds:"+" 1") /* postmap_changes2 */ suite.T().Log("About to run line #123: postmap_changes2") runAndAssert(suite.Suite, expected_, postmap_changes2, suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #123") } { // changefeeds/edge.yaml line #126 /* err('ReqlUserError', "dummy") */ var expected_ Err = err("ReqlUserError", "dummy") /* postmap_changes3 */ suite.T().Log("About to run line #126: postmap_changes3") runAndAssert(suite.Suite, expected_, postmap_changes3, suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #126") } { // changefeeds/edge.yaml line #129 /* bag(erroredres) */ var expected_ compare.Expected = compare.UnorderedMatch(erroredres) /* prefilter_changes1 */ suite.T().Log("About to run line #129: prefilter_changes1") runAndAssert(suite.Suite, expected_, prefilter_changes1, suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #129") } { // changefeeds/edge.yaml line #132 /* bag(erroredres) */ var expected_ compare.Expected = compare.UnorderedMatch(erroredres) /* prefilter_changes2 */ suite.T().Log("About to run line #132: prefilter_changes2") runAndAssert(suite.Suite, expected_, prefilter_changes2, suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #132") } { // changefeeds/edge.yaml line #135 /* bag(erroredres) */ var expected_ compare.Expected = compare.UnorderedMatch(erroredres) /* postfilter_changes1 */ suite.T().Log("About to run line #135: postfilter_changes1") runAndAssert(suite.Suite, expected_, postfilter_changes1, suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #135") } { // changefeeds/edge.yaml line #138 /* bag(erroredres) */ var expected_ compare.Expected = compare.UnorderedMatch(erroredres) /* postfilter_changes2 */ suite.T().Log("About to run line #138: postfilter_changes2") runAndAssert(suite.Suite, expected_, postfilter_changes2, suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #138") } }
func (suite *MutationAtomicGetSetSuite) TestCases() { suite.T().Log("Running MutationAtomicGetSetSuite: Tests replacement of selections") tbl := r.DB("test").Table("tbl") _ = tbl // Prevent any noused variable errors { // mutation/atomic_get_set.yaml line #12 /* ({'changes':[{'old_val':null,'new_val':{'id':0}}]}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"changes": []interface{}{map[interface{}]interface{}{"old_val": nil, "new_val": map[interface{}]interface{}{"id": 0}}}} /* tbl.insert({'id':0}, return_changes=True).pluck('changes', 'first_error') */ suite.T().Log("About to run line #12: tbl.Insert(map[interface{}]interface{}{'id': 0, }).OptArgs(r.InsertOpts{ReturnChanges: true, }).Pluck('changes', 'first_error')") runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"id": 0}).OptArgs(r.InsertOpts{ReturnChanges: true}).Pluck("changes", "first_error"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #12") } { // mutation/atomic_get_set.yaml line #16 /* ({'changes':[], 'first_error':"Duplicate primary key `id`:\n{\n\t\"id\":\t0\n}\n{\n\t\"id\":\t0\n}"}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"changes": []interface{}{}, "first_error": "Duplicate primary key `id`:\n{\n\t\"id\":\t0\n}\n{\n\t\"id\":\t0\n}"} /* tbl.insert({'id':0}, return_changes=True).pluck('changes', 'first_error') */ suite.T().Log("About to run line #16: tbl.Insert(map[interface{}]interface{}{'id': 0, }).OptArgs(r.InsertOpts{ReturnChanges: true, }).Pluck('changes', 'first_error')") runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"id": 0}).OptArgs(r.InsertOpts{ReturnChanges: true}).Pluck("changes", "first_error"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #16") } { // mutation/atomic_get_set.yaml line #20 /* ({'first_error':"Duplicate primary key `id`:\n{\n\t\"id\":\t0\n}\n{\n\t\"id\":\t0\n}",'changes':[{'old_val':{'id':0},'new_val':{'id':0},'error':"Duplicate primary key `id`:\n{\n\t\"id\":\t0\n}\n{\n\t\"id\":\t0\n}"}]}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"first_error": "Duplicate primary key `id`:\n{\n\t\"id\":\t0\n}\n{\n\t\"id\":\t0\n}", "changes": []interface{}{map[interface{}]interface{}{"old_val": map[interface{}]interface{}{"id": 0}, "new_val": map[interface{}]interface{}{"id": 0}, "error": "Duplicate primary key `id`:\n{\n\t\"id\":\t0\n}\n{\n\t\"id\":\t0\n}"}}} /* tbl.insert({'id':0}, return_changes='always').pluck('changes', 'first_error') */ suite.T().Log("About to run line #20: tbl.Insert(map[interface{}]interface{}{'id': 0, }).OptArgs(r.InsertOpts{ReturnChanges: 'always', }).Pluck('changes', 'first_error')") runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"id": 0}).OptArgs(r.InsertOpts{ReturnChanges: "always"}).Pluck("changes", "first_error"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #20") } { // mutation/atomic_get_set.yaml line #24 /* ({'changes':[{'new_val':{'id':1},'old_val':null}], 'errors':0, 'deleted':0, 'unchanged':0, 'skipped':0, 'replaced':0, 'inserted':1}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"changes": []interface{}{map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"id": 1}, "old_val": nil}}, "errors": 0, "deleted": 0, "unchanged": 0, "skipped": 0, "replaced": 0, "inserted": 1} /* tbl.insert([{'id':1}], return_changes=True) */ suite.T().Log("About to run line #24: tbl.Insert([]interface{}{map[interface{}]interface{}{'id': 1, }}).OptArgs(r.InsertOpts{ReturnChanges: true, })") runAndAssert(suite.Suite, expected_, tbl.Insert([]interface{}{map[interface{}]interface{}{"id": 1}}).OptArgs(r.InsertOpts{ReturnChanges: true}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #24") } { // mutation/atomic_get_set.yaml line #28 /* ({'changes':[],'first_error':"Duplicate primary key `id`:\n{\n\t\"id\":\t0\n}\n{\n\t\"id\":\t0\n}"}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"changes": []interface{}{}, "first_error": "Duplicate primary key `id`:\n{\n\t\"id\":\t0\n}\n{\n\t\"id\":\t0\n}"} /* tbl.insert([{'id':0}], return_changes=True).pluck('changes', 'first_error') */ suite.T().Log("About to run line #28: tbl.Insert([]interface{}{map[interface{}]interface{}{'id': 0, }}).OptArgs(r.InsertOpts{ReturnChanges: true, }).Pluck('changes', 'first_error')") runAndAssert(suite.Suite, expected_, tbl.Insert([]interface{}{map[interface{}]interface{}{"id": 0}}).OptArgs(r.InsertOpts{ReturnChanges: true}).Pluck("changes", "first_error"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #28") } { // mutation/atomic_get_set.yaml line #33 /* ({'changes':[{'old_val':{'id':0},'new_val':{'id':0,'x':1}}]}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"changes": []interface{}{map[interface{}]interface{}{"old_val": map[interface{}]interface{}{"id": 0}, "new_val": map[interface{}]interface{}{"id": 0, "x": 1}}}} /* tbl.get(0).update({'x':1}, return_changes=True).pluck('changes', 'first_error') */ suite.T().Log("About to run line #33: tbl.Get(0).Update(map[interface{}]interface{}{'x': 1, }).OptArgs(r.UpdateOpts{ReturnChanges: true, }).Pluck('changes', 'first_error')") runAndAssert(suite.Suite, expected_, tbl.Get(0).Update(map[interface{}]interface{}{"x": 1}).OptArgs(r.UpdateOpts{ReturnChanges: true}).Pluck("changes", "first_error"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #33") } { // mutation/atomic_get_set.yaml line #37 /* ({'changes':[],'first_error':'a'}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"changes": []interface{}{}, "first_error": "a"} /* tbl.get(0).update({'x':r.error("a")}, return_changes=True).pluck('changes', 'first_error') */ suite.T().Log("About to run line #37: tbl.Get(0).Update(map[interface{}]interface{}{'x': r.Error('a'), }).OptArgs(r.UpdateOpts{ReturnChanges: true, }).Pluck('changes', 'first_error')") runAndAssert(suite.Suite, expected_, tbl.Get(0).Update(map[interface{}]interface{}{"x": r.Error("a")}).OptArgs(r.UpdateOpts{ReturnChanges: true}).Pluck("changes", "first_error"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #37") } { // mutation/atomic_get_set.yaml line #41 /* ({'changes':[{'old_val':{'id':0, 'x':1},'new_val':{'id':0, 'x':3}}, {'old_val':{'id':1},'new_val':{'id':1, 'x':3}}]}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"changes": []interface{}{map[interface{}]interface{}{"old_val": map[interface{}]interface{}{"id": 0, "x": 1}, "new_val": map[interface{}]interface{}{"id": 0, "x": 3}}, map[interface{}]interface{}{"old_val": map[interface{}]interface{}{"id": 1}, "new_val": map[interface{}]interface{}{"id": 1, "x": 3}}}} /* tbl.update({'x':3}, return_changes=True).pluck('changes', 'first_error').do(lambda d:d.merge({'changes':d['changes'].order_by(lambda a:a['old_val']['id'])})) */ suite.T().Log("About to run line #41: tbl.Update(map[interface{}]interface{}{'x': 3, }).OptArgs(r.UpdateOpts{ReturnChanges: true, }).Pluck('changes', 'first_error').Do(func(d r.Term) interface{} { return d.Merge(map[interface{}]interface{}{'changes': d.AtIndex('changes').OrderBy(func(a r.Term) interface{} { return a.AtIndex('old_val').AtIndex('id')}), })})") runAndAssert(suite.Suite, expected_, tbl.Update(map[interface{}]interface{}{"x": 3}).OptArgs(r.UpdateOpts{ReturnChanges: true}).Pluck("changes", "first_error").Do(func(d r.Term) interface{} { return d.Merge(map[interface{}]interface{}{"changes": d.AtIndex("changes").OrderBy(func(a r.Term) interface{} { return a.AtIndex("old_val").AtIndex("id") })}) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #41") } { // mutation/atomic_get_set.yaml line #46 /* ({'changes':[{'old_val':{'id':0,'x':3},'new_val':{'id':0,'x':2}}]}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"changes": []interface{}{map[interface{}]interface{}{"old_val": map[interface{}]interface{}{"id": 0, "x": 3}, "new_val": map[interface{}]interface{}{"id": 0, "x": 2}}}} /* tbl.get(0).replace({'id':0,'x':2}, return_changes=True).pluck('changes', 'first_error') */ suite.T().Log("About to run line #46: tbl.Get(0).Replace(map[interface{}]interface{}{'id': 0, 'x': 2, }).OptArgs(r.ReplaceOpts{ReturnChanges: true, }).Pluck('changes', 'first_error')") runAndAssert(suite.Suite, expected_, tbl.Get(0).Replace(map[interface{}]interface{}{"id": 0, "x": 2}).OptArgs(r.ReplaceOpts{ReturnChanges: true}).Pluck("changes", "first_error"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #46") } { // mutation/atomic_get_set.yaml line #50 /* ({'changes':[],'first_error':'a'}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"changes": []interface{}{}, "first_error": "a"} /* tbl.get(0).replace(lambda y:{'x':r.error('a')}, return_changes=True).pluck('changes', 'first_error') */ suite.T().Log("About to run line #50: tbl.Get(0).Replace(func(y r.Term) interface{} { return map[interface{}]interface{}{'x': r.Error('a'), }}).OptArgs(r.ReplaceOpts{ReturnChanges: true, }).Pluck('changes', 'first_error')") runAndAssert(suite.Suite, expected_, tbl.Get(0).Replace(func(y r.Term) interface{} { return map[interface{}]interface{}{"x": r.Error("a")} }).OptArgs(r.ReplaceOpts{ReturnChanges: true}).Pluck("changes", "first_error"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #50") } { // mutation/atomic_get_set.yaml line #54 /* ({'first_error':'a','changes':[{'old_val':{'id':0,'x':2},'new_val':{'id':0,'x':2},'error':'a'}]}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"first_error": "a", "changes": []interface{}{map[interface{}]interface{}{"old_val": map[interface{}]interface{}{"id": 0, "x": 2}, "new_val": map[interface{}]interface{}{"id": 0, "x": 2}, "error": "a"}}} /* tbl.get(0).replace(lambda y:{'x':r.error('a')}, return_changes='always').pluck('changes', 'first_error') */ suite.T().Log("About to run line #54: tbl.Get(0).Replace(func(y r.Term) interface{} { return map[interface{}]interface{}{'x': r.Error('a'), }}).OptArgs(r.ReplaceOpts{ReturnChanges: 'always', }).Pluck('changes', 'first_error')") runAndAssert(suite.Suite, expected_, tbl.Get(0).Replace(func(y r.Term) interface{} { return map[interface{}]interface{}{"x": r.Error("a")} }).OptArgs(r.ReplaceOpts{ReturnChanges: "always"}).Pluck("changes", "first_error"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #54") } { // mutation/atomic_get_set.yaml line #58 /* ({'changes':[{'new_val':{'id':0},'old_val':{'id':0, 'x':2}}, {'new_val':{'id':1},'old_val':{'id':1,'x':3}}]}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"changes": []interface{}{map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"id": 0}, "old_val": map[interface{}]interface{}{"id": 0, "x": 2}}, map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"id": 1}, "old_val": map[interface{}]interface{}{"id": 1, "x": 3}}}} /* tbl.replace(lambda y:y.without('x'), return_changes=True).pluck('changes', 'first_error').do(lambda d:d.merge({'changes':d['changes'].order_by(lambda a:a['old_val']['id'])})) */ suite.T().Log("About to run line #58: tbl.Replace(func(y r.Term) interface{} { return y.Without('x')}).OptArgs(r.ReplaceOpts{ReturnChanges: true, }).Pluck('changes', 'first_error').Do(func(d r.Term) interface{} { return d.Merge(map[interface{}]interface{}{'changes': d.AtIndex('changes').OrderBy(func(a r.Term) interface{} { return a.AtIndex('old_val').AtIndex('id')}), })})") runAndAssert(suite.Suite, expected_, tbl.Replace(func(y r.Term) interface{} { return y.Without("x") }).OptArgs(r.ReplaceOpts{ReturnChanges: true}).Pluck("changes", "first_error").Do(func(d r.Term) interface{} { return d.Merge(map[interface{}]interface{}{"changes": d.AtIndex("changes").OrderBy(func(a r.Term) interface{} { return a.AtIndex("old_val").AtIndex("id") })}) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #58") } { // mutation/atomic_get_set.yaml line #62 /* ({'first_error':"Inserted object must have primary key `id`:\n{\n\t\"x\":\t1\n}", 'changes':[{'new_val':{'id':0},'old_val':{'id':0}, 'error':"Inserted object must have primary key `id`:\n{\n\t\"x\":\t1\n}"}, {'new_val':{'id':1},'old_val':{'id':1},'error':"Inserted object must have primary key `id`:\n{\n\t\"x\":\t1\n}"}]}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"first_error": "Inserted object must have primary key `id`:\n{\n\t\"x\":\t1\n}", "changes": []interface{}{map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"id": 0}, "old_val": map[interface{}]interface{}{"id": 0}, "error": "Inserted object must have primary key `id`:\n{\n\t\"x\":\t1\n}"}, map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"id": 1}, "old_val": map[interface{}]interface{}{"id": 1}, "error": "Inserted object must have primary key `id`:\n{\n\t\"x\":\t1\n}"}}} /* tbl.replace({'x':1}, return_changes='always').pluck('changes', 'first_error').do(lambda d:d.merge({'changes':d['changes'].order_by(lambda a:a['old_val']['id'])})) */ suite.T().Log("About to run line #62: tbl.Replace(map[interface{}]interface{}{'x': 1, }).OptArgs(r.ReplaceOpts{ReturnChanges: 'always', }).Pluck('changes', 'first_error').Do(func(d r.Term) interface{} { return d.Merge(map[interface{}]interface{}{'changes': d.AtIndex('changes').OrderBy(func(a r.Term) interface{} { return a.AtIndex('old_val').AtIndex('id')}), })})") runAndAssert(suite.Suite, expected_, tbl.Replace(map[interface{}]interface{}{"x": 1}).OptArgs(r.ReplaceOpts{ReturnChanges: "always"}).Pluck("changes", "first_error").Do(func(d r.Term) interface{} { return d.Merge(map[interface{}]interface{}{"changes": d.AtIndex("changes").OrderBy(func(a r.Term) interface{} { return a.AtIndex("old_val").AtIndex("id") })}) }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #62") } { // mutation/atomic_get_set.yaml line #86 /* ({'changes':[{'old_val':{'id':0},'new_val':null}]}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"changes": []interface{}{map[interface{}]interface{}{"old_val": map[interface{}]interface{}{"id": 0}, "new_val": nil}}} /* tbl.get(0).delete(return_changes=True).pluck('changes', 'first_error') */ suite.T().Log("About to run line #86: tbl.Get(0).Delete().OptArgs(r.DeleteOpts{ReturnChanges: true, }).Pluck('changes', 'first_error')") runAndAssert(suite.Suite, expected_, tbl.Get(0).Delete().OptArgs(r.DeleteOpts{ReturnChanges: true}).Pluck("changes", "first_error"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #86") } { // mutation/atomic_get_set.yaml line #90 /* ({'deleted':1,'errors':0,'inserted':0,'replaced':0,'skipped':0,'unchanged':0,'changes':[{'new_val':null, 'old_val':{'id':1}}]}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 1, "errors": 0, "inserted": 0, "replaced": 0, "skipped": 0, "unchanged": 0, "changes": []interface{}{map[interface{}]interface{}{"new_val": nil, "old_val": map[interface{}]interface{}{"id": 1}}}} /* tbl.delete(return_changes=True) */ suite.T().Log("About to run line #90: tbl.Delete().OptArgs(r.DeleteOpts{ReturnChanges: true, })") runAndAssert(suite.Suite, expected_, tbl.Delete().OptArgs(r.DeleteOpts{ReturnChanges: true}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #90") } }
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") } }