gopkg.in/rethinkdb/rethinkdb-go.v6@v6.2.2/internal/integration/reql_tests/reql_transformation_test.go (about) 1 // Code generated by gen_tests.py and process_polyglot.py. 2 // Do not edit this file directly. 3 // The template for this file is located at: 4 // ../template.go.tpl 5 package reql_tests 6 7 import ( 8 "testing" 9 "time" 10 11 "github.com/stretchr/testify/suite" 12 r "gopkg.in/rethinkdb/rethinkdb-go.v6" 13 "gopkg.in/rethinkdb/rethinkdb-go.v6/internal/compare" 14 ) 15 16 // Tests that manipulation data in tables 17 func TestTransformationSuite(t *testing.T) { 18 suite.Run(t, new(TransformationSuite)) 19 } 20 21 type TransformationSuite struct { 22 suite.Suite 23 24 session *r.Session 25 } 26 27 func (suite *TransformationSuite) SetupTest() { 28 suite.T().Log("Setting up TransformationSuite") 29 // Use imports to prevent errors 30 _ = time.Time{} 31 _ = compare.AnythingIsFine 32 33 session, err := r.Connect(r.ConnectOpts{ 34 Address: url, 35 }) 36 suite.Require().NoError(err, "Error returned when connecting to server") 37 suite.session = session 38 39 r.DBDrop("test").Exec(suite.session) 40 err = r.DBCreate("test").Exec(suite.session) 41 suite.Require().NoError(err) 42 err = r.DB("test").Wait().Exec(suite.session) 43 suite.Require().NoError(err) 44 45 r.DB("test").TableDrop("tbl").Exec(suite.session) 46 err = r.DB("test").TableCreate("tbl").Exec(suite.session) 47 suite.Require().NoError(err) 48 err = r.DB("test").Table("tbl").Wait().Exec(suite.session) 49 suite.Require().NoError(err) 50 r.DB("test").TableDrop("tbl2").Exec(suite.session) 51 err = r.DB("test").TableCreate("tbl2").Exec(suite.session) 52 suite.Require().NoError(err) 53 err = r.DB("test").Table("tbl2").Wait().Exec(suite.session) 54 suite.Require().NoError(err) 55 r.DB("test").TableDrop("tbl3").Exec(suite.session) 56 err = r.DB("test").TableCreate("tbl3").Exec(suite.session) 57 suite.Require().NoError(err) 58 err = r.DB("test").Table("tbl3").Wait().Exec(suite.session) 59 suite.Require().NoError(err) 60 } 61 62 func (suite *TransformationSuite) TearDownSuite() { 63 suite.T().Log("Tearing down TransformationSuite") 64 65 if suite.session != nil { 66 r.DB("rethinkdb").Table("_debug_scratch").Delete().Exec(suite.session) 67 r.DB("test").TableDrop("tbl").Exec(suite.session) 68 r.DB("test").TableDrop("tbl2").Exec(suite.session) 69 r.DB("test").TableDrop("tbl3").Exec(suite.session) 70 r.DBDrop("test").Exec(suite.session) 71 72 suite.session.Close() 73 } 74 } 75 76 func (suite *TransformationSuite) TestCases() { 77 suite.T().Log("Running TransformationSuite: Tests that manipulation data in tables") 78 79 tbl := r.DB("test").Table("tbl") 80 _ = tbl // Prevent any noused variable errors 81 tbl2 := r.DB("test").Table("tbl2") 82 _ = tbl2 // Prevent any noused variable errors 83 tbl3 := r.DB("test").Table("tbl3") 84 _ = tbl3 // Prevent any noused variable errors 85 86 { 87 // transformation.yaml line #6 88 /* {'deleted':0.0,'replaced':0.0,'unchanged':0.0,'errors':0.0,'skipped':0.0,'inserted':100} */ 89 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0.0, "replaced": 0.0, "unchanged": 0.0, "errors": 0.0, "skipped": 0.0, "inserted": 100} 90 /* tbl.insert([{'id':i, 'a':i%4} for i in xrange(100)]) */ 91 92 suite.T().Log("About to run line #6: tbl.Insert((func() []interface{} {\n res := []interface{}{}\n for iterator_ := 0; iterator_ < 100; iterator_++ {\n i := iterator_\n res = append(res, map[interface{}]interface{}{'id': i, 'a': r.Mod(i, 4), })\n }\n return res\n}()))") 93 94 runAndAssert(suite.Suite, expected_, tbl.Insert((func() []interface{} { 95 res := []interface{}{} 96 for iterator_ := 0; iterator_ < 100; iterator_++ { 97 i := iterator_ 98 res = append(res, map[interface{}]interface{}{"id": i, "a": r.Mod(i, 4)}) 99 } 100 return res 101 }())), suite.session, r.RunOpts{ 102 GeometryFormat: "raw", 103 GroupFormat: "map", 104 }) 105 suite.T().Log("Finished running line #6") 106 } 107 108 { 109 // transformation.yaml line #18 110 /* {'created':1} */ 111 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"created": 1} 112 /* tbl.index_create('a') */ 113 114 suite.T().Log("About to run line #18: tbl.IndexCreate('a')") 115 116 runAndAssert(suite.Suite, expected_, tbl.IndexCreate("a"), suite.session, r.RunOpts{ 117 GeometryFormat: "raw", 118 GroupFormat: "map", 119 }) 120 suite.T().Log("Finished running line #18") 121 } 122 123 { 124 // transformation.yaml line #21 125 /* {'created':1} */ 126 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"created": 1} 127 /* tbl.index_create('truncated_a', lambda x: ['a' * 300, x['a']]) */ 128 129 suite.T().Log("About to run line #21: tbl.IndexCreateFunc('truncated_a', func(x r.Term) interface{} { return []interface{}{'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', x.AtIndex('a')}})") 130 131 runAndAssert(suite.Suite, expected_, tbl.IndexCreateFunc("truncated_a", func(x r.Term) interface{} { 132 return []interface{}{"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", x.AtIndex("a")} 133 }), suite.session, r.RunOpts{ 134 GeometryFormat: "raw", 135 GroupFormat: "map", 136 }) 137 suite.T().Log("Finished running line #21") 138 } 139 140 { 141 // transformation.yaml line #24 142 /* {'created':1} */ 143 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"created": 1} 144 /* tbl.index_create('error_prone', lambda x: 1/x['a']) */ 145 146 suite.T().Log("About to run line #24: tbl.IndexCreateFunc('error_prone', func(x r.Term) interface{} { return r.Div(1, x.AtIndex('a'))})") 147 148 runAndAssert(suite.Suite, expected_, tbl.IndexCreateFunc("error_prone", func(x r.Term) interface{} { return r.Div(1, x.AtIndex("a")) }), suite.session, r.RunOpts{ 149 GeometryFormat: "raw", 150 GroupFormat: "map", 151 }) 152 suite.T().Log("Finished running line #24") 153 } 154 155 { 156 // transformation.yaml line #27 157 /* AnythingIsFine */ 158 var expected_ string = compare.AnythingIsFine 159 /* tbl.index_wait().pluck('index', 'ready') */ 160 161 suite.T().Log("About to run line #27: tbl.IndexWait().Pluck('index', 'ready')") 162 163 runAndAssert(suite.Suite, expected_, tbl.IndexWait().Pluck("index", "ready"), suite.session, r.RunOpts{ 164 GeometryFormat: "raw", 165 GroupFormat: "map", 166 }) 167 suite.T().Log("Finished running line #27") 168 } 169 170 { 171 // transformation.yaml line #29 172 /* {'deleted':0.0,'replaced':0.0,'unchanged':0.0,'errors':0.0,'skipped':0.0,'inserted':100} */ 173 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0.0, "replaced": 0.0, "unchanged": 0.0, "errors": 0.0, "skipped": 0.0, "inserted": 100} 174 /* tbl2.insert([{'id':i, 'b':i%4} for i in xrange(100)]) */ 175 176 suite.T().Log("About to run line #29: tbl2.Insert((func() []interface{} {\n res := []interface{}{}\n for iterator_ := 0; iterator_ < 100; iterator_++ {\n i := iterator_\n res = append(res, map[interface{}]interface{}{'id': i, 'b': r.Mod(i, 4), })\n }\n return res\n}()))") 177 178 runAndAssert(suite.Suite, expected_, tbl2.Insert((func() []interface{} { 179 res := []interface{}{} 180 for iterator_ := 0; iterator_ < 100; iterator_++ { 181 i := iterator_ 182 res = append(res, map[interface{}]interface{}{"id": i, "b": r.Mod(i, 4)}) 183 } 184 return res 185 }())), suite.session, r.RunOpts{ 186 GeometryFormat: "raw", 187 GroupFormat: "map", 188 }) 189 suite.T().Log("Finished running line #29") 190 } 191 192 { 193 // transformation.yaml line #41 194 /* {'deleted':0.0,'replaced':0.0,'unchanged':0.0,'errors':0.0,'skipped':0.0,'inserted':100} */ 195 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0.0, "replaced": 0.0, "unchanged": 0.0, "errors": 0.0, "skipped": 0.0, "inserted": 100} 196 /* tbl3.insert([{'id':i, 'a':i%4, 'b':{'c':i%5}} for i in xrange(100)]) */ 197 198 suite.T().Log("About to run line #41: tbl3.Insert((func() []interface{} {\n res := []interface{}{}\n for iterator_ := 0; iterator_ < 100; iterator_++ {\n i := iterator_\n res = append(res, map[interface{}]interface{}{'id': i, 'a': r.Mod(i, 4), 'b': map[interface{}]interface{}{'c': r.Mod(i, 5), }, })\n }\n return res\n}()))") 199 200 runAndAssert(suite.Suite, expected_, tbl3.Insert((func() []interface{} { 201 res := []interface{}{} 202 for iterator_ := 0; iterator_ < 100; iterator_++ { 203 i := iterator_ 204 res = append(res, map[interface{}]interface{}{"id": i, "a": r.Mod(i, 4), "b": map[interface{}]interface{}{"c": r.Mod(i, 5)}}) 205 } 206 return res 207 }())), suite.session, r.RunOpts{ 208 GeometryFormat: "raw", 209 GroupFormat: "map", 210 }) 211 suite.T().Log("Finished running line #41") 212 } 213 214 { 215 // transformation.yaml line #55 216 /* 4950 */ 217 var expected_ int = 4950 218 /* tbl.map(lambda row:row['id']).reduce(lambda a,b:a+b) */ 219 220 suite.T().Log("About to run line #55: tbl.Map(func(row r.Term) interface{} { return row.AtIndex('id')}).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b)})") 221 222 runAndAssert(suite.Suite, expected_, tbl.Map(func(row r.Term) interface{} { return row.AtIndex("id") }).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b) }), suite.session, r.RunOpts{ 223 GeometryFormat: "raw", 224 GroupFormat: "map", 225 }) 226 suite.T().Log("Finished running line #55") 227 } 228 229 { 230 // transformation.yaml line #56 231 /* 4950 */ 232 var expected_ int = 4950 233 /* tbl.map(r.row['id']).reduce(lambda a,b:a+b) */ 234 235 suite.T().Log("About to run line #56: tbl.Map(r.Row.AtIndex('id')).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b)})") 236 237 runAndAssert(suite.Suite, expected_, tbl.Map(r.Row.AtIndex("id")).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b) }), suite.session, r.RunOpts{ 238 GeometryFormat: "raw", 239 GroupFormat: "map", 240 }) 241 suite.T().Log("Finished running line #56") 242 } 243 244 { 245 // transformation.yaml line #65 246 /* 9900 */ 247 var expected_ int = 9900 248 /* tbl.union(tbl).map(lambda row:row['id']).reduce(lambda a,b:a+b) */ 249 250 suite.T().Log("About to run line #65: tbl.Union(tbl).Map(func(row r.Term) interface{} { return row.AtIndex('id')}).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b)})") 251 252 runAndAssert(suite.Suite, expected_, tbl.Union(tbl).Map(func(row r.Term) interface{} { return row.AtIndex("id") }).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b) }), suite.session, r.RunOpts{ 253 GeometryFormat: "raw", 254 GroupFormat: "map", 255 }) 256 suite.T().Log("Finished running line #65") 257 } 258 259 { 260 // transformation.yaml line #66 261 /* 9900 */ 262 var expected_ int = 9900 263 /* tbl.union(tbl).map(r.row['id']).reduce(lambda a,b:a+b) */ 264 265 suite.T().Log("About to run line #66: tbl.Union(tbl).Map(r.Row.AtIndex('id')).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b)})") 266 267 runAndAssert(suite.Suite, expected_, tbl.Union(tbl).Map(r.Row.AtIndex("id")).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b) }), suite.session, r.RunOpts{ 268 GeometryFormat: "raw", 269 GroupFormat: "map", 270 }) 271 suite.T().Log("Finished running line #66") 272 } 273 274 { 275 // transformation.yaml line #75 276 /* 9900 */ 277 var expected_ int = 9900 278 /* tbl.coerce_to("array").union(tbl).map(lambda row:row['id']).reduce(lambda a,b:a+b) */ 279 280 suite.T().Log("About to run line #75: tbl.CoerceTo('array').Union(tbl).Map(func(row r.Term) interface{} { return row.AtIndex('id')}).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b)})") 281 282 runAndAssert(suite.Suite, expected_, tbl.CoerceTo("array").Union(tbl).Map(func(row r.Term) interface{} { return row.AtIndex("id") }).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b) }), suite.session, r.RunOpts{ 283 GeometryFormat: "raw", 284 GroupFormat: "map", 285 }) 286 suite.T().Log("Finished running line #75") 287 } 288 289 { 290 // transformation.yaml line #76 291 /* 9900 */ 292 var expected_ int = 9900 293 /* tbl.coerce_to("array").union(tbl).map(r.row['id']).reduce(lambda a,b:a+b) */ 294 295 suite.T().Log("About to run line #76: tbl.CoerceTo('array').Union(tbl).Map(r.Row.AtIndex('id')).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b)})") 296 297 runAndAssert(suite.Suite, expected_, tbl.CoerceTo("array").Union(tbl).Map(r.Row.AtIndex("id")).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b) }), suite.session, r.RunOpts{ 298 GeometryFormat: "raw", 299 GroupFormat: "map", 300 }) 301 suite.T().Log("Finished running line #76") 302 } 303 304 { 305 // transformation.yaml line #85 306 /* 9900 */ 307 var expected_ int = 9900 308 /* tbl.union(tbl.coerce_to("array")).map(lambda row:row['id']).reduce(lambda a,b:a+b) */ 309 310 suite.T().Log("About to run line #85: tbl.Union(tbl.CoerceTo('array')).Map(func(row r.Term) interface{} { return row.AtIndex('id')}).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b)})") 311 312 runAndAssert(suite.Suite, expected_, tbl.Union(tbl.CoerceTo("array")).Map(func(row r.Term) interface{} { return row.AtIndex("id") }).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b) }), suite.session, r.RunOpts{ 313 GeometryFormat: "raw", 314 GroupFormat: "map", 315 }) 316 suite.T().Log("Finished running line #85") 317 } 318 319 { 320 // transformation.yaml line #86 321 /* 9900 */ 322 var expected_ int = 9900 323 /* tbl.union(tbl.coerce_to("array")).map(r.row['id']).reduce(lambda a,b:a+b) */ 324 325 suite.T().Log("About to run line #86: tbl.Union(tbl.CoerceTo('array')).Map(r.Row.AtIndex('id')).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b)})") 326 327 runAndAssert(suite.Suite, expected_, tbl.Union(tbl.CoerceTo("array")).Map(r.Row.AtIndex("id")).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b) }), suite.session, r.RunOpts{ 328 GeometryFormat: "raw", 329 GroupFormat: "map", 330 }) 331 suite.T().Log("Finished running line #86") 332 } 333 334 { 335 // transformation.yaml line #94 336 /* [] */ 337 var expected_ []interface{} = []interface{}{} 338 /* tbl.get_all().fold(0, lambda acc, _: acc.add(1), emit=lambda old,row,acc: [acc]) */ 339 340 suite.T().Log("About to run line #94: tbl.GetAll().Fold(0, func(acc r.Term, _ r.Term) interface{} { return acc.Add(1)}).OptArgs(r.FoldOpts{Emit: func(old r.Term, row r.Term, acc r.Term) interface{} { return []interface{}{acc}}, })") 341 342 runAndAssert(suite.Suite, expected_, tbl.GetAll().Fold(0, func(acc r.Term, _ r.Term) interface{} { return acc.Add(1) }).OptArgs(r.FoldOpts{Emit: func(old r.Term, row r.Term, acc r.Term) interface{} { return []interface{}{acc} }}), suite.session, r.RunOpts{ 343 GeometryFormat: "raw", 344 GroupFormat: "map", 345 }) 346 suite.T().Log("Finished running line #94") 347 } 348 349 { 350 // transformation.yaml line #97 351 /* err("ReqlQueryLogicError", "Expected type ARRAY but found NUMBER.") */ 352 var expected_ Err = err("ReqlQueryLogicError", "Expected type ARRAY but found NUMBER.") 353 /* r.range(0, 10).fold(0, lambda acc, _: acc.add(1), emit=lambda old,row,acc: acc) */ 354 355 suite.T().Log("About to run line #97: r.Range(0, 10).Fold(0, func(acc r.Term, _ r.Term) interface{} { return acc.Add(1)}).OptArgs(r.FoldOpts{Emit: func(old r.Term, row r.Term, acc r.Term) interface{} { return acc}, })") 356 357 runAndAssert(suite.Suite, expected_, r.Range(0, 10).Fold(0, func(acc r.Term, _ r.Term) interface{} { return acc.Add(1) }).OptArgs(r.FoldOpts{Emit: func(old r.Term, row r.Term, acc r.Term) interface{} { return acc }}), suite.session, r.RunOpts{ 358 GeometryFormat: "raw", 359 GroupFormat: "map", 360 }) 361 suite.T().Log("Finished running line #97") 362 } 363 364 { 365 // transformation.yaml line #100 366 /* err("ReqlQueryLogicError", "Expected type DATUM but found SEQUENCE:") */ 367 var expected_ Err = err("ReqlQueryLogicError", "Expected type DATUM but found SEQUENCE:") 368 /* r.range(0, 10).fold(0, lambda acc, _: acc.add(1), emit=lambda old,row,acc: r.range()) */ 369 370 suite.T().Log("About to run line #100: r.Range(0, 10).Fold(0, func(acc r.Term, _ r.Term) interface{} { return acc.Add(1)}).OptArgs(r.FoldOpts{Emit: func(old r.Term, row r.Term, acc r.Term) interface{} { return r.Range()}, })") 371 372 runAndAssert(suite.Suite, expected_, r.Range(0, 10).Fold(0, func(acc r.Term, _ r.Term) interface{} { return acc.Add(1) }).OptArgs(r.FoldOpts{Emit: func(old r.Term, row r.Term, acc r.Term) interface{} { return r.Range() }}), suite.session, r.RunOpts{ 373 GeometryFormat: "raw", 374 GroupFormat: "map", 375 }) 376 suite.T().Log("Finished running line #100") 377 } 378 379 { 380 // transformation.yaml line #103 381 /* err("ReqlQueryLogicError", "Cannot call `changes` on an eager stream.") */ 382 var expected_ Err = err("ReqlQueryLogicError", "Cannot call `changes` on an eager stream.") 383 /* r.range(0, 10).fold(0, lambda acc, _: acc.add(1), emit=lambda old,row,acc: [acc]).changes() */ 384 385 suite.T().Log("About to run line #103: r.Range(0, 10).Fold(0, func(acc r.Term, _ r.Term) interface{} { return acc.Add(1)}).OptArgs(r.FoldOpts{Emit: func(old r.Term, row r.Term, acc r.Term) interface{} { return []interface{}{acc}}, }).Changes()") 386 387 runAndAssert(suite.Suite, expected_, r.Range(0, 10).Fold(0, func(acc r.Term, _ r.Term) interface{} { return acc.Add(1) }).OptArgs(r.FoldOpts{Emit: func(old r.Term, row r.Term, acc r.Term) interface{} { return []interface{}{acc} }}).Changes(), suite.session, r.RunOpts{ 388 GeometryFormat: "raw", 389 GroupFormat: "map", 390 }) 391 suite.T().Log("Finished running line #103") 392 } 393 394 { 395 // transformation.yaml line #111 396 /* [] */ 397 var expected_ []interface{} = []interface{}{} 398 /* tbl.concat_map(lambda row:[]) */ 399 400 suite.T().Log("About to run line #111: tbl.ConcatMap(func(row r.Term) interface{} { return []interface{}{}})") 401 402 runAndAssert(suite.Suite, expected_, tbl.ConcatMap(func(row r.Term) interface{} { return []interface{}{} }), suite.session, r.RunOpts{ 403 GeometryFormat: "raw", 404 GroupFormat: "map", 405 }) 406 suite.T().Log("Finished running line #111") 407 } 408 409 // transformation.yaml line #116 410 // ccm = tbl.concat_map(lambda row:[row['a'], (row['a'] + 1) % 4]) 411 suite.T().Log("Possibly executing: var ccm r.Term = tbl.ConcatMap(func(row r.Term) interface{} { return []interface{}{row.AtIndex('a'), row.AtIndex('a').Add(1).Mod(4)}})") 412 413 ccm := tbl.ConcatMap(func(row r.Term) interface{} { return []interface{}{row.AtIndex("a"), row.AtIndex("a").Add(1).Mod(4)} }) 414 _ = ccm // Prevent any noused variable errors 415 416 { 417 // transformation.yaml line #119 418 /* 200 */ 419 var expected_ int = 200 420 /* ccm.count() */ 421 422 suite.T().Log("About to run line #119: ccm.Count()") 423 424 runAndAssert(suite.Suite, expected_, ccm.Count(), suite.session, r.RunOpts{ 425 GeometryFormat: "raw", 426 GroupFormat: "map", 427 }) 428 suite.T().Log("Finished running line #119") 429 } 430 431 { 432 // transformation.yaml line #121 433 /* 0 */ 434 var expected_ int = 0 435 /* ccm.reduce(lambda a,b:(a+b) % 4) */ 436 437 suite.T().Log("About to run line #121: ccm.Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b).Mod(4)})") 438 439 runAndAssert(suite.Suite, expected_, ccm.Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b).Mod(4) }), suite.session, r.RunOpts{ 440 GeometryFormat: "raw", 441 GroupFormat: "map", 442 }) 443 suite.T().Log("Finished running line #121") 444 } 445 446 { 447 // transformation.yaml line #127 448 /* {'id':0, 'a':0} */ 449 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 0, "a": 0} 450 /* tbl.order_by('id')[0] */ 451 452 suite.T().Log("About to run line #127: tbl.OrderBy('id').AtIndex(0)") 453 454 runAndAssert(suite.Suite, expected_, tbl.OrderBy("id").AtIndex(0), suite.session, r.RunOpts{ 455 GeometryFormat: "raw", 456 GroupFormat: "map", 457 }) 458 suite.T().Log("Finished running line #127") 459 } 460 461 { 462 // transformation.yaml line #132 463 /* err('ReqlQueryLogicError', 'Expected type STRING but found ARRAY.', [0]) */ 464 var expected_ Err = err("ReqlQueryLogicError", "Expected type STRING but found ARRAY.") 465 /* tbl.order_by([1,2,3]) */ 466 467 suite.T().Log("About to run line #132: tbl.OrderBy([]interface{}{1, 2, 3})") 468 469 runAndAssert(suite.Suite, expected_, tbl.OrderBy([]interface{}{1, 2, 3}), suite.session, r.RunOpts{ 470 GeometryFormat: "raw", 471 GroupFormat: "map", 472 }) 473 suite.T().Log("Finished running line #132") 474 } 475 476 { 477 // transformation.yaml line #137 478 /* {'id':0, 'a':0} */ 479 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 0, "a": 0} 480 /* tbl.order_by(index='id')[0] */ 481 482 suite.T().Log("About to run line #137: tbl.OrderBy().OptArgs(r.OrderByOpts{Index: 'id', }).AtIndex(0)") 483 484 runAndAssert(suite.Suite, expected_, tbl.OrderBy().OptArgs(r.OrderByOpts{Index: "id"}).AtIndex(0), suite.session, r.RunOpts{ 485 GeometryFormat: "raw", 486 GroupFormat: "map", 487 }) 488 suite.T().Log("Finished running line #137") 489 } 490 491 { 492 // transformation.yaml line #142 493 /* 1 */ 494 var expected_ int = 1 495 /* tbl.order_by(index='id')[0].update({'a':0})['unchanged'] */ 496 497 suite.T().Log("About to run line #142: tbl.OrderBy().OptArgs(r.OrderByOpts{Index: 'id', }).AtIndex(0).Update(map[interface{}]interface{}{'a': 0, }).AtIndex('unchanged')") 498 499 runAndAssert(suite.Suite, expected_, tbl.OrderBy().OptArgs(r.OrderByOpts{Index: "id"}).AtIndex(0).Update(map[interface{}]interface{}{"a": 0}).AtIndex("unchanged"), suite.session, r.RunOpts{ 500 GeometryFormat: "raw", 501 GroupFormat: "map", 502 }) 503 suite.T().Log("Finished running line #142") 504 } 505 506 { 507 // transformation.yaml line #147 508 /* 1 */ 509 var expected_ int = 1 510 /* tbl.get_all(0).update({'a':0})['unchanged'] */ 511 512 suite.T().Log("About to run line #147: tbl.GetAll(0).Update(map[interface{}]interface{}{'a': 0, }).AtIndex('unchanged')") 513 514 runAndAssert(suite.Suite, expected_, tbl.GetAll(0).Update(map[interface{}]interface{}{"a": 0}).AtIndex("unchanged"), suite.session, r.RunOpts{ 515 GeometryFormat: "raw", 516 GroupFormat: "map", 517 }) 518 suite.T().Log("Finished running line #147") 519 } 520 521 { 522 // transformation.yaml line #152 523 /* err('ReqlQueryLogicError', 'Cannot perform multiple indexed ORDER_BYs on the same table.', [0]) */ 524 var expected_ Err = err("ReqlQueryLogicError", "Cannot perform multiple indexed ORDER_BYs on the same table.") 525 /* tbl.order_by(index='id').order_by(index='id')[0] */ 526 527 suite.T().Log("About to run line #152: tbl.OrderBy().OptArgs(r.OrderByOpts{Index: 'id', }).OrderBy().OptArgs(r.OrderByOpts{Index: 'id', }).AtIndex(0)") 528 529 runAndAssert(suite.Suite, expected_, tbl.OrderBy().OptArgs(r.OrderByOpts{Index: "id"}).OrderBy().OptArgs(r.OrderByOpts{Index: "id"}).AtIndex(0), suite.session, r.RunOpts{ 530 GeometryFormat: "raw", 531 GroupFormat: "map", 532 }) 533 suite.T().Log("Finished running line #152") 534 } 535 536 { 537 // transformation.yaml line #158 538 /* err('ReqlQueryLogicError', 'Cannot perform multiple indexed ORDER_BYs on the same table.', [0]) */ 539 var expected_ Err = err("ReqlQueryLogicError", "Cannot perform multiple indexed ORDER_BYs on the same table.") 540 /* tbl.order_by(index='id').order_by(index='id')[0] */ 541 542 suite.T().Log("About to run line #158: tbl.OrderBy().OptArgs(r.OrderByOpts{Index: 'id', }).OrderBy().OptArgs(r.OrderByOpts{Index: 'id', }).AtIndex(0)") 543 544 runAndAssert(suite.Suite, expected_, tbl.OrderBy().OptArgs(r.OrderByOpts{Index: "id"}).OrderBy().OptArgs(r.OrderByOpts{Index: "id"}).AtIndex(0), suite.session, r.RunOpts{ 545 GeometryFormat: "raw", 546 GroupFormat: "map", 547 }) 548 suite.T().Log("Finished running line #158") 549 } 550 551 { 552 // transformation.yaml line #163 553 /* err('ReqlQueryLogicError', 'Indexed order_by can only be performed on a TABLE or TABLE_SLICE. Make sure order_by comes before any transformations (such as map) or filters.', [0]) */ 554 var expected_ Err = err("ReqlQueryLogicError", "Indexed order_by can only be performed on a TABLE or TABLE_SLICE. Make sure order_by comes before any transformations (such as map) or filters.") 555 /* tbl.order_by('id').order_by(index='id')[0] */ 556 557 suite.T().Log("About to run line #163: tbl.OrderBy('id').OrderBy().OptArgs(r.OrderByOpts{Index: 'id', }).AtIndex(0)") 558 559 runAndAssert(suite.Suite, expected_, tbl.OrderBy("id").OrderBy().OptArgs(r.OrderByOpts{Index: "id"}).AtIndex(0), suite.session, r.RunOpts{ 560 GeometryFormat: "raw", 561 GroupFormat: "map", 562 }) 563 suite.T().Log("Finished running line #163") 564 } 565 566 { 567 // transformation.yaml line #168 568 /* err('ReqlQueryLogicError', 'Indexed order_by can only be performed on a TABLE or TABLE_SLICE. Make sure order_by comes before any transformations (such as map) or filters.', [0]) */ 569 var expected_ Err = err("ReqlQueryLogicError", "Indexed order_by can only be performed on a TABLE or TABLE_SLICE. Make sure order_by comes before any transformations (such as map) or filters.") 570 /* tbl.order_by('id').order_by(index='a')[0] */ 571 572 suite.T().Log("About to run line #168: tbl.OrderBy('id').OrderBy().OptArgs(r.OrderByOpts{Index: 'a', }).AtIndex(0)") 573 574 runAndAssert(suite.Suite, expected_, tbl.OrderBy("id").OrderBy().OptArgs(r.OrderByOpts{Index: "a"}).AtIndex(0), suite.session, r.RunOpts{ 575 GeometryFormat: "raw", 576 GroupFormat: "map", 577 }) 578 suite.T().Log("Finished running line #168") 579 } 580 581 { 582 // transformation.yaml line #173 583 /* {'id':5, 'a':1} */ 584 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 5, "a": 1} 585 /* tbl.between(5, r.maxval, index='id').order_by(index='id')[0] */ 586 587 suite.T().Log("About to run line #173: tbl.Between(5, r.MaxVal).OptArgs(r.BetweenOpts{Index: 'id', }).OrderBy().OptArgs(r.OrderByOpts{Index: 'id', }).AtIndex(0)") 588 589 runAndAssert(suite.Suite, expected_, tbl.Between(5, r.MaxVal).OptArgs(r.BetweenOpts{Index: "id"}).OrderBy().OptArgs(r.OrderByOpts{Index: "id"}).AtIndex(0), suite.session, r.RunOpts{ 590 GeometryFormat: "raw", 591 GroupFormat: "map", 592 }) 593 suite.T().Log("Finished running line #173") 594 } 595 596 { 597 // transformation.yaml line #178 598 /* err('ReqlQueryLogicError', 'Expected type TABLE_SLICE but found SELECTION:', [0]) */ 599 var expected_ Err = err("ReqlQueryLogicError", "Expected type TABLE_SLICE but found SELECTION:") 600 /* tbl.order_by('a', index='id').between(5, r.maxval, index='id')[0] */ 601 602 suite.T().Log("About to run line #178: tbl.OrderBy('a').OptArgs(r.OrderByOpts{Index: 'id', }).Between(5, r.MaxVal).OptArgs(r.BetweenOpts{Index: 'id', }).AtIndex(0)") 603 604 runAndAssert(suite.Suite, expected_, tbl.OrderBy("a").OptArgs(r.OrderByOpts{Index: "id"}).Between(5, r.MaxVal).OptArgs(r.BetweenOpts{Index: "id"}).AtIndex(0), suite.session, r.RunOpts{ 605 GeometryFormat: "raw", 606 GroupFormat: "map", 607 }) 608 suite.T().Log("Finished running line #178") 609 } 610 611 { 612 // transformation.yaml line #183 613 /* {'id':0, 'a':0} */ 614 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 0, "a": 0} 615 /* tbl.order_by(lambda x: x['id'])[0] */ 616 617 suite.T().Log("About to run line #183: tbl.OrderBy(func(x r.Term) interface{} { return x.AtIndex('id')}).AtIndex(0)") 618 619 runAndAssert(suite.Suite, expected_, tbl.OrderBy(func(x r.Term) interface{} { return x.AtIndex("id") }).AtIndex(0), suite.session, r.RunOpts{ 620 GeometryFormat: "raw", 621 GroupFormat: "map", 622 }) 623 suite.T().Log("Finished running line #183") 624 } 625 626 { 627 // transformation.yaml line #188 628 /* {'id':0,'a':0} */ 629 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 0, "a": 0} 630 /* tbl.order_by('a', 'id').nth(0) */ 631 632 suite.T().Log("About to run line #188: tbl.OrderBy('a', 'id').Nth(0)") 633 634 runAndAssert(suite.Suite, expected_, tbl.OrderBy("a", "id").Nth(0), suite.session, r.RunOpts{ 635 GeometryFormat: "raw", 636 GroupFormat: "map", 637 }) 638 suite.T().Log("Finished running line #188") 639 } 640 641 { 642 // transformation.yaml line #191 643 /* {'id':0,'a':0} */ 644 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 0, "a": 0} 645 /* tbl.order_by('id', index='a').nth(0) */ 646 647 suite.T().Log("About to run line #191: tbl.OrderBy('id').OptArgs(r.OrderByOpts{Index: 'a', }).Nth(0)") 648 649 runAndAssert(suite.Suite, expected_, tbl.OrderBy("id").OptArgs(r.OrderByOpts{Index: "a"}).Nth(0), suite.session, r.RunOpts{ 650 GeometryFormat: "raw", 651 GroupFormat: "map", 652 }) 653 suite.T().Log("Finished running line #191") 654 } 655 656 { 657 // transformation.yaml line #196 658 /* {'id':0,'a':0} */ 659 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 0, "a": 0} 660 /* tbl.order_by('id', index='truncated_a').nth(0) */ 661 662 suite.T().Log("About to run line #196: tbl.OrderBy('id').OptArgs(r.OrderByOpts{Index: 'truncated_a', }).Nth(0)") 663 664 runAndAssert(suite.Suite, expected_, tbl.OrderBy("id").OptArgs(r.OrderByOpts{Index: "truncated_a"}).Nth(0), suite.session, r.RunOpts{ 665 GeometryFormat: "raw", 666 GroupFormat: "map", 667 }) 668 suite.T().Log("Finished running line #196") 669 } 670 671 { 672 // transformation.yaml line #199 673 /* {'id':3,'a':3} */ 674 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 3, "a": 3} 675 /* tbl.order_by('id', index='error_prone').nth(0) */ 676 677 suite.T().Log("About to run line #199: tbl.OrderBy('id').OptArgs(r.OrderByOpts{Index: 'error_prone', }).Nth(0)") 678 679 runAndAssert(suite.Suite, expected_, tbl.OrderBy("id").OptArgs(r.OrderByOpts{Index: "error_prone"}).Nth(0), suite.session, r.RunOpts{ 680 GeometryFormat: "raw", 681 GroupFormat: "map", 682 }) 683 suite.T().Log("Finished running line #199") 684 } 685 686 { 687 // transformation.yaml line #202 688 /* {'id':0, 'a':0} */ 689 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 0, "a": 0} 690 /* tbl.order_by(lambda x: [x['a'], x['id']])[0] */ 691 692 suite.T().Log("About to run line #202: tbl.OrderBy(func(x r.Term) interface{} { return []interface{}{x.AtIndex('a'), x.AtIndex('id')}}).AtIndex(0)") 693 694 runAndAssert(suite.Suite, expected_, tbl.OrderBy(func(x r.Term) interface{} { return []interface{}{x.AtIndex("a"), x.AtIndex("id")} }).AtIndex(0), suite.session, r.RunOpts{ 695 GeometryFormat: "raw", 696 GroupFormat: "map", 697 }) 698 suite.T().Log("Finished running line #202") 699 } 700 701 { 702 // transformation.yaml line #207 703 /* {'id':3,'a':3} */ 704 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 3, "a": 3} 705 /* tbl.order_by(r.desc('a'), r.asc('id')).nth(0) */ 706 707 suite.T().Log("About to run line #207: tbl.OrderBy(r.Desc('a'), r.Asc('id')).Nth(0)") 708 709 runAndAssert(suite.Suite, expected_, tbl.OrderBy(r.Desc("a"), r.Asc("id")).Nth(0), suite.session, r.RunOpts{ 710 GeometryFormat: "raw", 711 GroupFormat: "map", 712 }) 713 suite.T().Log("Finished running line #207") 714 } 715 716 { 717 // transformation.yaml line #210 718 /* {'id':3,'a':3} */ 719 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 3, "a": 3} 720 /* tbl.order_by('id', index=r.desc('a')).nth(0) */ 721 722 suite.T().Log("About to run line #210: tbl.OrderBy('id').OptArgs(r.OrderByOpts{Index: r.Desc('a'), }).Nth(0)") 723 724 runAndAssert(suite.Suite, expected_, tbl.OrderBy("id").OptArgs(r.OrderByOpts{Index: r.Desc("a")}).Nth(0), suite.session, r.RunOpts{ 725 GeometryFormat: "raw", 726 GroupFormat: "map", 727 }) 728 suite.T().Log("Finished running line #210") 729 } 730 731 { 732 // transformation.yaml line #215 733 /* {'id':3, 'a':3} */ 734 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 3, "a": 3} 735 /* tbl.order_by(r.desc(lambda x: x['a']), lambda x: x['id'])[0] */ 736 737 suite.T().Log("About to run line #215: tbl.OrderBy(r.Desc(func(x r.Term) interface{} { return x.AtIndex('a')}), func(x r.Term) interface{} { return x.AtIndex('id')}).AtIndex(0)") 738 739 runAndAssert(suite.Suite, expected_, tbl.OrderBy(r.Desc(func(x r.Term) interface{} { return x.AtIndex("a") }), func(x r.Term) interface{} { return x.AtIndex("id") }).AtIndex(0), suite.session, r.RunOpts{ 740 GeometryFormat: "raw", 741 GroupFormat: "map", 742 }) 743 suite.T().Log("Finished running line #215") 744 } 745 746 { 747 // transformation.yaml line #220 748 /* {'id':96,'a':0} */ 749 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 96, "a": 0} 750 /* tbl.order_by(r.asc('a'), r.desc('id')).nth(0) */ 751 752 suite.T().Log("About to run line #220: tbl.OrderBy(r.Asc('a'), r.Desc('id')).Nth(0)") 753 754 runAndAssert(suite.Suite, expected_, tbl.OrderBy(r.Asc("a"), r.Desc("id")).Nth(0), suite.session, r.RunOpts{ 755 GeometryFormat: "raw", 756 GroupFormat: "map", 757 }) 758 suite.T().Log("Finished running line #220") 759 } 760 761 { 762 // transformation.yaml line #223 763 /* {'id':96,'a':0} */ 764 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 96, "a": 0} 765 /* tbl.order_by(r.desc('id'), index='a').nth(0) */ 766 767 suite.T().Log("About to run line #223: tbl.OrderBy(r.Desc('id')).OptArgs(r.OrderByOpts{Index: 'a', }).Nth(0)") 768 769 runAndAssert(suite.Suite, expected_, tbl.OrderBy(r.Desc("id")).OptArgs(r.OrderByOpts{Index: "a"}).Nth(0), suite.session, r.RunOpts{ 770 GeometryFormat: "raw", 771 GroupFormat: "map", 772 }) 773 suite.T().Log("Finished running line #223") 774 } 775 776 { 777 // transformation.yaml line #228 778 /* 'SELECTION<ARRAY>' */ 779 var expected_ string = "SELECTION<ARRAY>" 780 /* tbl.order_by('id').type_of() */ 781 782 suite.T().Log("About to run line #228: tbl.OrderBy('id').TypeOf()") 783 784 runAndAssert(suite.Suite, expected_, tbl.OrderBy("id").TypeOf(), suite.session, r.RunOpts{ 785 GeometryFormat: "raw", 786 GroupFormat: "map", 787 }) 788 suite.T().Log("Finished running line #228") 789 } 790 791 { 792 // transformation.yaml line #231 793 /* {'id':0, 'a':0} */ 794 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 0, "a": 0} 795 /* tbl.order_by('missing').order_by('id').nth(0) */ 796 797 suite.T().Log("About to run line #231: tbl.OrderBy('missing').OrderBy('id').Nth(0)") 798 799 runAndAssert(suite.Suite, expected_, tbl.OrderBy("missing").OrderBy("id").Nth(0), suite.session, r.RunOpts{ 800 GeometryFormat: "raw", 801 GroupFormat: "map", 802 }) 803 suite.T().Log("Finished running line #231") 804 } 805 806 { 807 // transformation.yaml line #234 808 /* err('ReqlQueryLogicError', 'Indexed order_by can only be performed on a TABLE or TABLE_SLICE. Make sure order_by comes before any transformations (such as map) or filters.', [0]) */ 809 var expected_ Err = err("ReqlQueryLogicError", "Indexed order_by can only be performed on a TABLE or TABLE_SLICE. Make sure order_by comes before any transformations (such as map) or filters.") 810 /* tbl.order_by('missing').order_by(index='id').nth(0) */ 811 812 suite.T().Log("About to run line #234: tbl.OrderBy('missing').OrderBy().OptArgs(r.OrderByOpts{Index: 'id', }).Nth(0)") 813 814 runAndAssert(suite.Suite, expected_, tbl.OrderBy("missing").OrderBy().OptArgs(r.OrderByOpts{Index: "id"}).Nth(0), suite.session, r.RunOpts{ 815 GeometryFormat: "raw", 816 GroupFormat: "map", 817 }) 818 suite.T().Log("Finished running line #234") 819 } 820 821 { 822 // transformation.yaml line #239 823 /* {'id':0, 'a':0} */ 824 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 0, "a": 0} 825 /* tbl.order_by('id', 'missing').nth(0) */ 826 827 suite.T().Log("About to run line #239: tbl.OrderBy('id', 'missing').Nth(0)") 828 829 runAndAssert(suite.Suite, expected_, tbl.OrderBy("id", "missing").Nth(0), suite.session, r.RunOpts{ 830 GeometryFormat: "raw", 831 GroupFormat: "map", 832 }) 833 suite.T().Log("Finished running line #239") 834 } 835 836 { 837 // transformation.yaml line #242 838 /* {'id':0, 'a':0} */ 839 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 0, "a": 0} 840 /* tbl.order_by('missing', index='id').nth(0) */ 841 842 suite.T().Log("About to run line #242: tbl.OrderBy('missing').OptArgs(r.OrderByOpts{Index: 'id', }).Nth(0)") 843 844 runAndAssert(suite.Suite, expected_, tbl.OrderBy("missing").OptArgs(r.OrderByOpts{Index: "id"}).Nth(0), suite.session, r.RunOpts{ 845 GeometryFormat: "raw", 846 GroupFormat: "map", 847 }) 848 suite.T().Log("Finished running line #242") 849 } 850 851 { 852 // transformation.yaml line #247 853 /* true */ 854 var expected_ bool = true 855 /* tbl.order_by(r.desc('id')).coerce_to('ARRAY') == tbl.order_by(lambda x: 0 - x['id']).coerce_to('ARRAY') */ 856 857 suite.T().Log("About to run line #247: tbl.OrderBy(r.Desc('id')).CoerceTo('ARRAY').Eq(tbl.OrderBy(func(x r.Term) interface{} { return r.Sub(0, x.AtIndex('id'))}).CoerceTo('ARRAY'))") 858 859 runAndAssert(suite.Suite, expected_, tbl.OrderBy(r.Desc("id")).CoerceTo("ARRAY").Eq(tbl.OrderBy(func(x r.Term) interface{} { return r.Sub(0, x.AtIndex("id")) }).CoerceTo("ARRAY")), suite.session, r.RunOpts{ 860 GeometryFormat: "raw", 861 GroupFormat: "map", 862 }) 863 suite.T().Log("Finished running line #247") 864 } 865 866 { 867 // transformation.yaml line #252 868 /* true */ 869 var expected_ bool = true 870 /* tbl.order_by(index=r.desc('id')).coerce_to('ARRAY') == tbl.order_by(lambda x: 0 - x['id']).coerce_to('ARRAY') */ 871 872 suite.T().Log("About to run line #252: tbl.OrderBy().OptArgs(r.OrderByOpts{Index: r.Desc('id'), }).CoerceTo('ARRAY').Eq(tbl.OrderBy(func(x r.Term) interface{} { return r.Sub(0, x.AtIndex('id'))}).CoerceTo('ARRAY'))") 873 874 runAndAssert(suite.Suite, expected_, tbl.OrderBy().OptArgs(r.OrderByOpts{Index: r.Desc("id")}).CoerceTo("ARRAY").Eq(tbl.OrderBy(func(x r.Term) interface{} { return r.Sub(0, x.AtIndex("id")) }).CoerceTo("ARRAY")), suite.session, r.RunOpts{ 875 GeometryFormat: "raw", 876 GroupFormat: "map", 877 }) 878 suite.T().Log("Finished running line #252") 879 } 880 881 { 882 // transformation.yaml line #257 883 /* true */ 884 var expected_ bool = true 885 /* tbl.order_by(index=r.desc('id')).coerce_to('ARRAY') == tbl.order_by(r.desc('id')).coerce_to('ARRAY') */ 886 887 suite.T().Log("About to run line #257: tbl.OrderBy().OptArgs(r.OrderByOpts{Index: r.Desc('id'), }).CoerceTo('ARRAY').Eq(tbl.OrderBy(r.Desc('id')).CoerceTo('ARRAY'))") 888 889 runAndAssert(suite.Suite, expected_, tbl.OrderBy().OptArgs(r.OrderByOpts{Index: r.Desc("id")}).CoerceTo("ARRAY").Eq(tbl.OrderBy(r.Desc("id")).CoerceTo("ARRAY")), suite.session, r.RunOpts{ 890 GeometryFormat: "raw", 891 GroupFormat: "map", 892 }) 893 suite.T().Log("Finished running line #257") 894 } 895 896 { 897 // transformation.yaml line #263 898 /* 99 */ 899 var expected_ int = 99 900 /* tbl.skip(1).count() */ 901 902 suite.T().Log("About to run line #263: tbl.Skip(1).Count()") 903 904 runAndAssert(suite.Suite, expected_, tbl.Skip(1).Count(), suite.session, r.RunOpts{ 905 GeometryFormat: "raw", 906 GroupFormat: "map", 907 }) 908 suite.T().Log("Finished running line #263") 909 } 910 911 { 912 // transformation.yaml line #265 913 /* err('ReqlQueryLogicError', 'Cannot use a negative left index on a stream.', [0]) */ 914 var expected_ Err = err("ReqlQueryLogicError", "Cannot use a negative left index on a stream.") 915 /* tbl.skip(-1).count() */ 916 917 suite.T().Log("About to run line #265: tbl.Skip(-1).Count()") 918 919 runAndAssert(suite.Suite, expected_, tbl.Skip(-1).Count(), suite.session, r.RunOpts{ 920 GeometryFormat: "raw", 921 GroupFormat: "map", 922 }) 923 suite.T().Log("Finished running line #265") 924 } 925 926 { 927 // transformation.yaml line #267 928 /* err('ReqlQueryLogicError', 'Expected type NUMBER but found STRING.', [0]) */ 929 var expected_ Err = err("ReqlQueryLogicError", "Expected type NUMBER but found STRING.") 930 /* tbl.skip('foo').count() */ 931 932 suite.T().Log("About to run line #267: tbl.Skip('foo').Count()") 933 934 runAndAssert(suite.Suite, expected_, tbl.Skip("foo").Count(), suite.session, r.RunOpts{ 935 GeometryFormat: "raw", 936 GroupFormat: "map", 937 }) 938 suite.T().Log("Finished running line #267") 939 } 940 941 { 942 // transformation.yaml line #271 943 /* 1 */ 944 var expected_ int = 1 945 /* tbl.limit(1).count() */ 946 947 suite.T().Log("About to run line #271: tbl.Limit(1).Count()") 948 949 runAndAssert(suite.Suite, expected_, tbl.Limit(1).Count(), suite.session, r.RunOpts{ 950 GeometryFormat: "raw", 951 GroupFormat: "map", 952 }) 953 suite.T().Log("Finished running line #271") 954 } 955 956 { 957 // transformation.yaml line #273 958 /* err('ReqlQueryLogicError', 'LIMIT takes a non-negative argument (got -1)', [0]) */ 959 var expected_ Err = err("ReqlQueryLogicError", "LIMIT takes a non-negative argument (got -1)") 960 /* tbl.limit(-1).count() */ 961 962 suite.T().Log("About to run line #273: tbl.Limit(-1).Count()") 963 964 runAndAssert(suite.Suite, expected_, tbl.Limit(-1).Count(), suite.session, r.RunOpts{ 965 GeometryFormat: "raw", 966 GroupFormat: "map", 967 }) 968 suite.T().Log("Finished running line #273") 969 } 970 971 { 972 // transformation.yaml line #275 973 /* err('ReqlQueryLogicError', 'Expected type NUMBER but found STRING.', [0]) */ 974 var expected_ Err = err("ReqlQueryLogicError", "Expected type NUMBER but found STRING.") 975 /* tbl.limit('foo').count() */ 976 977 suite.T().Log("About to run line #275: tbl.Limit('foo').Count()") 978 979 runAndAssert(suite.Suite, expected_, tbl.Limit("foo").Count(), suite.session, r.RunOpts{ 980 GeometryFormat: "raw", 981 GroupFormat: "map", 982 }) 983 suite.T().Log("Finished running line #275") 984 } 985 986 { 987 // transformation.yaml line #279 988 /* 2 */ 989 var expected_ int = 2 990 /* tbl.slice(1, 3).count() */ 991 992 suite.T().Log("About to run line #279: tbl.Slice(1, 3).Count()") 993 994 runAndAssert(suite.Suite, expected_, tbl.Slice(1, 3).Count(), suite.session, r.RunOpts{ 995 GeometryFormat: "raw", 996 GroupFormat: "map", 997 }) 998 suite.T().Log("Finished running line #279") 999 } 1000 1001 { 1002 // transformation.yaml line #281 1003 /* 95 */ 1004 var expected_ int = 95 1005 /* tbl.slice(5).count() */ 1006 1007 suite.T().Log("About to run line #281: tbl.Slice(5).Count()") 1008 1009 runAndAssert(suite.Suite, expected_, tbl.Slice(5).Count(), suite.session, r.RunOpts{ 1010 GeometryFormat: "raw", 1011 GroupFormat: "map", 1012 }) 1013 suite.T().Log("Finished running line #281") 1014 } 1015 1016 { 1017 // transformation.yaml line #283 1018 /* err('ReqlQueryLogicError', 'Cannot use a negative left index on a stream.', [0]) */ 1019 var expected_ Err = err("ReqlQueryLogicError", "Cannot use a negative left index on a stream.") 1020 /* tbl.slice(-1, -3).count() */ 1021 1022 suite.T().Log("About to run line #283: tbl.Slice(-1, -3).Count()") 1023 1024 runAndAssert(suite.Suite, expected_, tbl.Slice(-1, -3).Count(), suite.session, r.RunOpts{ 1025 GeometryFormat: "raw", 1026 GroupFormat: "map", 1027 }) 1028 suite.T().Log("Finished running line #283") 1029 } 1030 1031 { 1032 // transformation.yaml line #285 1033 /* err('ReqlQueryLogicError', 'Cannot use a right index < -1 on a stream.', [0]) */ 1034 var expected_ Err = err("ReqlQueryLogicError", "Cannot use a right index < -1 on a stream.") 1035 /* tbl.slice(0, -3).count() */ 1036 1037 suite.T().Log("About to run line #285: tbl.Slice(0, -3).Count()") 1038 1039 runAndAssert(suite.Suite, expected_, tbl.Slice(0, -3).Count(), suite.session, r.RunOpts{ 1040 GeometryFormat: "raw", 1041 GroupFormat: "map", 1042 }) 1043 suite.T().Log("Finished running line #285") 1044 } 1045 1046 { 1047 // transformation.yaml line #287 1048 /* err('ReqlQueryLogicError', 'Cannot slice to an open right index of -1 on a stream.', []) */ 1049 var expected_ Err = err("ReqlQueryLogicError", "Cannot slice to an open right index of -1 on a stream.") 1050 /* tbl.slice(0, -1).count() */ 1051 1052 suite.T().Log("About to run line #287: tbl.Slice(0, -1).Count()") 1053 1054 runAndAssert(suite.Suite, expected_, tbl.Slice(0, -1).Count(), suite.session, r.RunOpts{ 1055 GeometryFormat: "raw", 1056 GroupFormat: "map", 1057 }) 1058 suite.T().Log("Finished running line #287") 1059 } 1060 1061 { 1062 // transformation.yaml line #289 1063 /* err('ReqlQueryLogicError', 'Expected type NUMBER but found STRING.', [0]) */ 1064 var expected_ Err = err("ReqlQueryLogicError", "Expected type NUMBER but found STRING.") 1065 /* tbl.slice('foo', 'bar').count() */ 1066 1067 suite.T().Log("About to run line #289: tbl.Slice('foo', 'bar').Count()") 1068 1069 runAndAssert(suite.Suite, expected_, tbl.Slice("foo", "bar").Count(), suite.session, r.RunOpts{ 1070 GeometryFormat: "raw", 1071 GroupFormat: "map", 1072 }) 1073 suite.T().Log("Finished running line #289") 1074 } 1075 1076 { 1077 // transformation.yaml line #291 1078 /* err('ReqlNonExistenceError', 'Expected type NUMBER but found NULL.', [0]) */ 1079 var expected_ Err = err("ReqlNonExistenceError", "Expected type NUMBER but found NULL.") 1080 /* tbl.slice(1, null).count() */ 1081 1082 suite.T().Log("About to run line #291: tbl.Slice(1, nil).Count()") 1083 1084 runAndAssert(suite.Suite, expected_, tbl.Slice(1, nil).Count(), suite.session, r.RunOpts{ 1085 GeometryFormat: "raw", 1086 GroupFormat: "map", 1087 }) 1088 suite.T().Log("Finished running line #291") 1089 } 1090 1091 { 1092 // transformation.yaml line #293 1093 /* err('ReqlNonExistenceError', 'Expected type NUMBER but found NULL.', [0]) */ 1094 var expected_ Err = err("ReqlNonExistenceError", "Expected type NUMBER but found NULL.") 1095 /* tbl.slice(null, 1).count() */ 1096 1097 suite.T().Log("About to run line #293: tbl.Slice(nil, 1).Count()") 1098 1099 runAndAssert(suite.Suite, expected_, tbl.Slice(nil, 1).Count(), suite.session, r.RunOpts{ 1100 GeometryFormat: "raw", 1101 GroupFormat: "map", 1102 }) 1103 suite.T().Log("Finished running line #293") 1104 } 1105 1106 { 1107 // transformation.yaml line #296 1108 /* 8 */ 1109 var expected_ int = 8 1110 /* tbl.slice(12, 20).count() */ 1111 1112 suite.T().Log("About to run line #296: tbl.Slice(12, 20).Count()") 1113 1114 runAndAssert(suite.Suite, expected_, tbl.Slice(12, 20).Count(), suite.session, r.RunOpts{ 1115 GeometryFormat: "raw", 1116 GroupFormat: "map", 1117 }) 1118 suite.T().Log("Finished running line #296") 1119 } 1120 1121 { 1122 // transformation.yaml line #299 1123 /* 9 */ 1124 var expected_ int = 9 1125 /* tbl.slice(12, 20, right_bound='closed').count() */ 1126 1127 suite.T().Log("About to run line #299: tbl.Slice(12, 20).OptArgs(r.SliceOpts{RightBound: 'closed', }).Count()") 1128 1129 runAndAssert(suite.Suite, expected_, tbl.Slice(12, 20).OptArgs(r.SliceOpts{RightBound: "closed"}).Count(), suite.session, r.RunOpts{ 1130 GeometryFormat: "raw", 1131 GroupFormat: "map", 1132 }) 1133 suite.T().Log("Finished running line #299") 1134 } 1135 1136 { 1137 // transformation.yaml line #303 1138 /* 7 */ 1139 var expected_ int = 7 1140 /* tbl.slice(12, 20, left_bound='open').count() */ 1141 1142 suite.T().Log("About to run line #303: tbl.Slice(12, 20).OptArgs(r.SliceOpts{LeftBound: 'open', }).Count()") 1143 1144 runAndAssert(suite.Suite, expected_, tbl.Slice(12, 20).OptArgs(r.SliceOpts{LeftBound: "open"}).Count(), suite.session, r.RunOpts{ 1145 GeometryFormat: "raw", 1146 GroupFormat: "map", 1147 }) 1148 suite.T().Log("Finished running line #303") 1149 } 1150 1151 { 1152 // transformation.yaml line #307 1153 /* 8 */ 1154 var expected_ int = 8 1155 /* tbl.slice(12, 20, left_bound='open', right_bound='closed').count() */ 1156 1157 suite.T().Log("About to run line #307: tbl.Slice(12, 20).OptArgs(r.SliceOpts{LeftBound: 'open', RightBound: 'closed', }).Count()") 1158 1159 runAndAssert(suite.Suite, expected_, tbl.Slice(12, 20).OptArgs(r.SliceOpts{LeftBound: "open", RightBound: "closed"}).Count(), suite.session, r.RunOpts{ 1160 GeometryFormat: "raw", 1161 GroupFormat: "map", 1162 }) 1163 suite.T().Log("Finished running line #307") 1164 } 1165 1166 { 1167 // transformation.yaml line #311 1168 /* err("ReqlQueryLogicError", "Cannot slice to an open right index of -1 on a stream.", []) */ 1169 var expected_ Err = err("ReqlQueryLogicError", "Cannot slice to an open right index of -1 on a stream.") 1170 /* tbl.slice(12, -1).count() */ 1171 1172 suite.T().Log("About to run line #311: tbl.Slice(12, -1).Count()") 1173 1174 runAndAssert(suite.Suite, expected_, tbl.Slice(12, -1).Count(), suite.session, r.RunOpts{ 1175 GeometryFormat: "raw", 1176 GroupFormat: "map", 1177 }) 1178 suite.T().Log("Finished running line #311") 1179 } 1180 1181 { 1182 // transformation.yaml line #314 1183 /* 88 */ 1184 var expected_ int = 88 1185 /* tbl.slice(12, -1, right_bound='closed').count() */ 1186 1187 suite.T().Log("About to run line #314: tbl.Slice(12, -1).OptArgs(r.SliceOpts{RightBound: 'closed', }).Count()") 1188 1189 runAndAssert(suite.Suite, expected_, tbl.Slice(12, -1).OptArgs(r.SliceOpts{RightBound: "closed"}).Count(), suite.session, r.RunOpts{ 1190 GeometryFormat: "raw", 1191 GroupFormat: "map", 1192 }) 1193 suite.T().Log("Finished running line #314") 1194 } 1195 1196 { 1197 // transformation.yaml line #318 1198 /* err("ReqlQueryLogicError", "Cannot use a right index < -1 on a stream.", []) */ 1199 var expected_ Err = err("ReqlQueryLogicError", "Cannot use a right index < -1 on a stream.") 1200 /* tbl.slice(12, -2).count() */ 1201 1202 suite.T().Log("About to run line #318: tbl.Slice(12, -2).Count()") 1203 1204 runAndAssert(suite.Suite, expected_, tbl.Slice(12, -2).Count(), suite.session, r.RunOpts{ 1205 GeometryFormat: "raw", 1206 GroupFormat: "map", 1207 }) 1208 suite.T().Log("Finished running line #318") 1209 } 1210 1211 { 1212 // transformation.yaml line #321 1213 /* err("ReqlQueryLogicError", "Cannot use a right index < -1 on a stream.", []) */ 1214 var expected_ Err = err("ReqlQueryLogicError", "Cannot use a right index < -1 on a stream.") 1215 /* tbl.slice(12, -2, right_bound='closed').count() */ 1216 1217 suite.T().Log("About to run line #321: tbl.Slice(12, -2).OptArgs(r.SliceOpts{RightBound: 'closed', }).Count()") 1218 1219 runAndAssert(suite.Suite, expected_, tbl.Slice(12, -2).OptArgs(r.SliceOpts{RightBound: "closed"}).Count(), suite.session, r.RunOpts{ 1220 GeometryFormat: "raw", 1221 GroupFormat: "map", 1222 }) 1223 suite.T().Log("Finished running line #321") 1224 } 1225 1226 { 1227 // transformation.yaml line #325 1228 /* err("ReqlQueryLogicError", "Cannot use a negative left index on a stream.", []) */ 1229 var expected_ Err = err("ReqlQueryLogicError", "Cannot use a negative left index on a stream.") 1230 /* tbl.slice(-12, -2).count() */ 1231 1232 suite.T().Log("About to run line #325: tbl.Slice(-12, -2).Count()") 1233 1234 runAndAssert(suite.Suite, expected_, tbl.Slice(-12, -2).Count(), suite.session, r.RunOpts{ 1235 GeometryFormat: "raw", 1236 GroupFormat: "map", 1237 }) 1238 suite.T().Log("Finished running line #325") 1239 } 1240 1241 { 1242 // transformation.yaml line #328 1243 /* err("ReqlQueryLogicError", "Cannot use a negative left index on a stream.", []) */ 1244 var expected_ Err = err("ReqlQueryLogicError", "Cannot use a negative left index on a stream.") 1245 /* tbl.slice(-12, -2, right_bound='closed').count() */ 1246 1247 suite.T().Log("About to run line #328: tbl.Slice(-12, -2).OptArgs(r.SliceOpts{RightBound: 'closed', }).Count()") 1248 1249 runAndAssert(suite.Suite, expected_, tbl.Slice(-12, -2).OptArgs(r.SliceOpts{RightBound: "closed"}).Count(), suite.session, r.RunOpts{ 1250 GeometryFormat: "raw", 1251 GroupFormat: "map", 1252 }) 1253 suite.T().Log("Finished running line #328") 1254 } 1255 1256 { 1257 // transformation.yaml line #332 1258 /* 8 */ 1259 var expected_ int = 8 1260 /* tbl.coerce_to('array').slice(12, 20).count() */ 1261 1262 suite.T().Log("About to run line #332: tbl.CoerceTo('array').Slice(12, 20).Count()") 1263 1264 runAndAssert(suite.Suite, expected_, tbl.CoerceTo("array").Slice(12, 20).Count(), suite.session, r.RunOpts{ 1265 GeometryFormat: "raw", 1266 GroupFormat: "map", 1267 }) 1268 suite.T().Log("Finished running line #332") 1269 } 1270 1271 { 1272 // transformation.yaml line #335 1273 /* 9 */ 1274 var expected_ int = 9 1275 /* tbl.coerce_to('array').slice(12, 20, right_bound='closed').count() */ 1276 1277 suite.T().Log("About to run line #335: tbl.CoerceTo('array').Slice(12, 20).OptArgs(r.SliceOpts{RightBound: 'closed', }).Count()") 1278 1279 runAndAssert(suite.Suite, expected_, tbl.CoerceTo("array").Slice(12, 20).OptArgs(r.SliceOpts{RightBound: "closed"}).Count(), suite.session, r.RunOpts{ 1280 GeometryFormat: "raw", 1281 GroupFormat: "map", 1282 }) 1283 suite.T().Log("Finished running line #335") 1284 } 1285 1286 { 1287 // transformation.yaml line #339 1288 /* 7 */ 1289 var expected_ int = 7 1290 /* tbl.coerce_to('array').slice(12, 20, left_bound='open').count() */ 1291 1292 suite.T().Log("About to run line #339: tbl.CoerceTo('array').Slice(12, 20).OptArgs(r.SliceOpts{LeftBound: 'open', }).Count()") 1293 1294 runAndAssert(suite.Suite, expected_, tbl.CoerceTo("array").Slice(12, 20).OptArgs(r.SliceOpts{LeftBound: "open"}).Count(), suite.session, r.RunOpts{ 1295 GeometryFormat: "raw", 1296 GroupFormat: "map", 1297 }) 1298 suite.T().Log("Finished running line #339") 1299 } 1300 1301 { 1302 // transformation.yaml line #343 1303 /* 8 */ 1304 var expected_ int = 8 1305 /* tbl.coerce_to('array').slice(12, 20, left_bound='open', right_bound='closed').count() */ 1306 1307 suite.T().Log("About to run line #343: tbl.CoerceTo('array').Slice(12, 20).OptArgs(r.SliceOpts{LeftBound: 'open', RightBound: 'closed', }).Count()") 1308 1309 runAndAssert(suite.Suite, expected_, tbl.CoerceTo("array").Slice(12, 20).OptArgs(r.SliceOpts{LeftBound: "open", RightBound: "closed"}).Count(), suite.session, r.RunOpts{ 1310 GeometryFormat: "raw", 1311 GroupFormat: "map", 1312 }) 1313 suite.T().Log("Finished running line #343") 1314 } 1315 1316 { 1317 // transformation.yaml line #347 1318 /* 87 */ 1319 var expected_ int = 87 1320 /* tbl.coerce_to('array').slice(12, -1).count() */ 1321 1322 suite.T().Log("About to run line #347: tbl.CoerceTo('array').Slice(12, -1).Count()") 1323 1324 runAndAssert(suite.Suite, expected_, tbl.CoerceTo("array").Slice(12, -1).Count(), suite.session, r.RunOpts{ 1325 GeometryFormat: "raw", 1326 GroupFormat: "map", 1327 }) 1328 suite.T().Log("Finished running line #347") 1329 } 1330 1331 { 1332 // transformation.yaml line #350 1333 /* 88 */ 1334 var expected_ int = 88 1335 /* tbl.coerce_to('array').slice(12, -1, right_bound='closed').count() */ 1336 1337 suite.T().Log("About to run line #350: tbl.CoerceTo('array').Slice(12, -1).OptArgs(r.SliceOpts{RightBound: 'closed', }).Count()") 1338 1339 runAndAssert(suite.Suite, expected_, tbl.CoerceTo("array").Slice(12, -1).OptArgs(r.SliceOpts{RightBound: "closed"}).Count(), suite.session, r.RunOpts{ 1340 GeometryFormat: "raw", 1341 GroupFormat: "map", 1342 }) 1343 suite.T().Log("Finished running line #350") 1344 } 1345 1346 { 1347 // transformation.yaml line #354 1348 /* 86 */ 1349 var expected_ int = 86 1350 /* tbl.coerce_to('array').slice(12, -2).count() */ 1351 1352 suite.T().Log("About to run line #354: tbl.CoerceTo('array').Slice(12, -2).Count()") 1353 1354 runAndAssert(suite.Suite, expected_, tbl.CoerceTo("array").Slice(12, -2).Count(), suite.session, r.RunOpts{ 1355 GeometryFormat: "raw", 1356 GroupFormat: "map", 1357 }) 1358 suite.T().Log("Finished running line #354") 1359 } 1360 1361 { 1362 // transformation.yaml line #357 1363 /* 87 */ 1364 var expected_ int = 87 1365 /* tbl.coerce_to('array').slice(12, -2, right_bound='closed').count() */ 1366 1367 suite.T().Log("About to run line #357: tbl.CoerceTo('array').Slice(12, -2).OptArgs(r.SliceOpts{RightBound: 'closed', }).Count()") 1368 1369 runAndAssert(suite.Suite, expected_, tbl.CoerceTo("array").Slice(12, -2).OptArgs(r.SliceOpts{RightBound: "closed"}).Count(), suite.session, r.RunOpts{ 1370 GeometryFormat: "raw", 1371 GroupFormat: "map", 1372 }) 1373 suite.T().Log("Finished running line #357") 1374 } 1375 1376 { 1377 // transformation.yaml line #361 1378 /* 10 */ 1379 var expected_ int = 10 1380 /* tbl.coerce_to('array').slice(-12, -2).count() */ 1381 1382 suite.T().Log("About to run line #361: tbl.CoerceTo('array').Slice(-12, -2).Count()") 1383 1384 runAndAssert(suite.Suite, expected_, tbl.CoerceTo("array").Slice(-12, -2).Count(), suite.session, r.RunOpts{ 1385 GeometryFormat: "raw", 1386 GroupFormat: "map", 1387 }) 1388 suite.T().Log("Finished running line #361") 1389 } 1390 1391 { 1392 // transformation.yaml line #364 1393 /* 11 */ 1394 var expected_ int = 11 1395 /* tbl.coerce_to('array').slice(-12, -2, right_bound='closed').count() */ 1396 1397 suite.T().Log("About to run line #364: tbl.CoerceTo('array').Slice(-12, -2).OptArgs(r.SliceOpts{RightBound: 'closed', }).Count()") 1398 1399 runAndAssert(suite.Suite, expected_, tbl.CoerceTo("array").Slice(-12, -2).OptArgs(r.SliceOpts{RightBound: "closed"}).Count(), suite.session, r.RunOpts{ 1400 GeometryFormat: "raw", 1401 GroupFormat: "map", 1402 }) 1403 suite.T().Log("Finished running line #364") 1404 } 1405 1406 // transformation.yaml line #368 1407 // arr = r.expr([1,2,3,4,5]) 1408 suite.T().Log("Possibly executing: var arr r.Term = r.Expr([]interface{}{1, 2, 3, 4, 5})") 1409 1410 arr := r.Expr([]interface{}{1, 2, 3, 4, 5}) 1411 _ = arr // Prevent any noused variable errors 1412 1413 { 1414 // transformation.yaml line #372 1415 /* [2, 3] */ 1416 var expected_ []interface{} = []interface{}{2, 3} 1417 /* arr[1:3] */ 1418 1419 suite.T().Log("About to run line #372: arr.Slice(1, 3)") 1420 1421 runAndAssert(suite.Suite, expected_, arr.Slice(1, 3), suite.session, r.RunOpts{ 1422 GeometryFormat: "raw", 1423 GroupFormat: "map", 1424 }) 1425 suite.T().Log("Finished running line #372") 1426 } 1427 1428 { 1429 // transformation.yaml line #377 1430 /* [2] */ 1431 var expected_ []interface{} = []interface{}{2} 1432 /* arr[1:-3] */ 1433 1434 suite.T().Log("About to run line #377: arr.Slice(1, -3)") 1435 1436 runAndAssert(suite.Suite, expected_, arr.Slice(1, -3), suite.session, r.RunOpts{ 1437 GeometryFormat: "raw", 1438 GroupFormat: "map", 1439 }) 1440 suite.T().Log("Finished running line #377") 1441 } 1442 1443 { 1444 // transformation.yaml line #380 1445 /* [2,3,4,5] */ 1446 var expected_ []interface{} = []interface{}{2, 3, 4, 5} 1447 /* arr[1:] */ 1448 1449 suite.T().Log("About to run line #380: arr.Slice(1, -1, r.SliceOpts{RightBound: 'closed'})") 1450 1451 runAndAssert(suite.Suite, expected_, arr.Slice(1, -1, r.SliceOpts{RightBound: "closed"}), suite.session, r.RunOpts{ 1452 GeometryFormat: "raw", 1453 GroupFormat: "map", 1454 }) 1455 suite.T().Log("Finished running line #380") 1456 } 1457 1458 { 1459 // transformation.yaml line #383 1460 /* [2,3,4] */ 1461 var expected_ []interface{} = []interface{}{2, 3, 4} 1462 /* arr[1:-1] */ 1463 1464 suite.T().Log("About to run line #383: arr.Slice(1, -1)") 1465 1466 runAndAssert(suite.Suite, expected_, arr.Slice(1, -1), suite.session, r.RunOpts{ 1467 GeometryFormat: "raw", 1468 GroupFormat: "map", 1469 }) 1470 suite.T().Log("Finished running line #383") 1471 } 1472 1473 { 1474 // transformation.yaml line #387 1475 /* {'id':1,'a':1} */ 1476 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 1, "a": 1} 1477 /* tbl.order_by('id').nth(1) */ 1478 1479 suite.T().Log("About to run line #387: tbl.OrderBy('id').Nth(1)") 1480 1481 runAndAssert(suite.Suite, expected_, tbl.OrderBy("id").Nth(1), suite.session, r.RunOpts{ 1482 GeometryFormat: "raw", 1483 GroupFormat: "map", 1484 }) 1485 suite.T().Log("Finished running line #387") 1486 } 1487 1488 { 1489 // transformation.yaml line #389 1490 /* {'id':99,'a':3} */ 1491 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 99, "a": 3} 1492 /* tbl.order_by('id').nth(-1) */ 1493 1494 suite.T().Log("About to run line #389: tbl.OrderBy('id').Nth(-1)") 1495 1496 runAndAssert(suite.Suite, expected_, tbl.OrderBy("id").Nth(-1), suite.session, r.RunOpts{ 1497 GeometryFormat: "raw", 1498 GroupFormat: "map", 1499 }) 1500 suite.T().Log("Finished running line #389") 1501 } 1502 1503 { 1504 // transformation.yaml line #391 1505 /* err('ReqlQueryLogicError', 'Expected type NUMBER but found STRING.', [0]) */ 1506 var expected_ Err = err("ReqlQueryLogicError", "Expected type NUMBER but found STRING.") 1507 /* tbl.order_by('id').nth('foo').count() */ 1508 1509 suite.T().Log("About to run line #391: tbl.OrderBy('id').Nth('foo').Count()") 1510 1511 runAndAssert(suite.Suite, expected_, tbl.OrderBy("id").Nth("foo").Count(), suite.session, r.RunOpts{ 1512 GeometryFormat: "raw", 1513 GroupFormat: "map", 1514 }) 1515 suite.T().Log("Finished running line #391") 1516 } 1517 1518 { 1519 // transformation.yaml line #395 1520 /* false */ 1521 var expected_ bool = false 1522 /* tbl.is_empty() */ 1523 1524 suite.T().Log("About to run line #395: tbl.IsEmpty()") 1525 1526 runAndAssert(suite.Suite, expected_, tbl.IsEmpty(), suite.session, r.RunOpts{ 1527 GeometryFormat: "raw", 1528 GroupFormat: "map", 1529 }) 1530 suite.T().Log("Finished running line #395") 1531 } 1532 1533 { 1534 // transformation.yaml line #397 1535 /* true */ 1536 var expected_ bool = true 1537 /* tbl.limit(0).is_empty() */ 1538 1539 suite.T().Log("About to run line #397: tbl.Limit(0).IsEmpty()") 1540 1541 runAndAssert(suite.Suite, expected_, tbl.Limit(0).IsEmpty(), suite.session, r.RunOpts{ 1542 GeometryFormat: "raw", 1543 GroupFormat: "map", 1544 }) 1545 suite.T().Log("Finished running line #397") 1546 } 1547 1548 { 1549 // transformation.yaml line #399 1550 /* err('ReqlQueryLogicError', 'Cannot convert NUMBER to SEQUENCE', []) */ 1551 var expected_ Err = err("ReqlQueryLogicError", "Cannot convert NUMBER to SEQUENCE") 1552 /* r.expr(1).is_empty() */ 1553 1554 suite.T().Log("About to run line #399: r.Expr(1).IsEmpty()") 1555 1556 runAndAssert(suite.Suite, expected_, r.Expr(1).IsEmpty(), suite.session, r.RunOpts{ 1557 GeometryFormat: "raw", 1558 GroupFormat: "map", 1559 }) 1560 suite.T().Log("Finished running line #399") 1561 } 1562 1563 { 1564 // transformation.yaml line #401 1565 /* err('ReqlQueryLogicError', 'Cannot convert STRING to SEQUENCE', []) */ 1566 var expected_ Err = err("ReqlQueryLogicError", "Cannot convert STRING to SEQUENCE") 1567 /* r.expr("").is_empty() */ 1568 1569 suite.T().Log("About to run line #401: r.Expr('').IsEmpty()") 1570 1571 runAndAssert(suite.Suite, expected_, r.Expr("").IsEmpty(), suite.session, r.RunOpts{ 1572 GeometryFormat: "raw", 1573 GroupFormat: "map", 1574 }) 1575 suite.T().Log("Finished running line #401") 1576 } 1577 1578 { 1579 // transformation.yaml line #405 1580 /* {} */ 1581 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{} 1582 /* tbl3.pluck().nth(0) */ 1583 1584 suite.T().Log("About to run line #405: tbl3.Pluck().Nth(0)") 1585 1586 runAndAssert(suite.Suite, expected_, tbl3.Pluck().Nth(0), suite.session, r.RunOpts{ 1587 GeometryFormat: "raw", 1588 GroupFormat: "map", 1589 }) 1590 suite.T().Log("Finished running line #405") 1591 } 1592 1593 { 1594 // transformation.yaml line #408 1595 /* {} */ 1596 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{} 1597 /* tbl3.pluck({}).nth(0) */ 1598 1599 suite.T().Log("About to run line #408: tbl3.Pluck(map[interface{}]interface{}{}).Nth(0)") 1600 1601 runAndAssert(suite.Suite, expected_, tbl3.Pluck(map[interface{}]interface{}{}).Nth(0), suite.session, r.RunOpts{ 1602 GeometryFormat: "raw", 1603 GroupFormat: "map", 1604 }) 1605 suite.T().Log("Finished running line #408") 1606 } 1607 1608 { 1609 // transformation.yaml line #411 1610 /* {} */ 1611 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{} 1612 /* tbl3.pluck([]).nth(0) */ 1613 1614 suite.T().Log("About to run line #411: tbl3.Pluck([]interface{}{}).Nth(0)") 1615 1616 runAndAssert(suite.Suite, expected_, tbl3.Pluck([]interface{}{}).Nth(0), suite.session, r.RunOpts{ 1617 GeometryFormat: "raw", 1618 GroupFormat: "map", 1619 }) 1620 suite.T().Log("Finished running line #411") 1621 } 1622 1623 { 1624 // transformation.yaml line #414 1625 /* {'id':0} */ 1626 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 0} 1627 /* tbl3.pluck('id').order_by('id').nth(0) */ 1628 1629 suite.T().Log("About to run line #414: tbl3.Pluck('id').OrderBy('id').Nth(0)") 1630 1631 runAndAssert(suite.Suite, expected_, tbl3.Pluck("id").OrderBy("id").Nth(0), suite.session, r.RunOpts{ 1632 GeometryFormat: "raw", 1633 GroupFormat: "map", 1634 }) 1635 suite.T().Log("Finished running line #414") 1636 } 1637 1638 { 1639 // transformation.yaml line #417 1640 /* {'id':0} */ 1641 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 0} 1642 /* tbl3.pluck(['id']).order_by('id').nth(0) */ 1643 1644 suite.T().Log("About to run line #417: tbl3.Pluck([]interface{}{'id'}).OrderBy('id').Nth(0)") 1645 1646 runAndAssert(suite.Suite, expected_, tbl3.Pluck([]interface{}{"id"}).OrderBy("id").Nth(0), suite.session, r.RunOpts{ 1647 GeometryFormat: "raw", 1648 GroupFormat: "map", 1649 }) 1650 suite.T().Log("Finished running line #417") 1651 } 1652 1653 { 1654 // transformation.yaml line #420 1655 /* {'id':0} */ 1656 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 0} 1657 /* tbl3.pluck({'id':True}).order_by('id').nth(0) */ 1658 1659 suite.T().Log("About to run line #420: tbl3.Pluck(map[interface{}]interface{}{'id': true, }).OrderBy('id').Nth(0)") 1660 1661 runAndAssert(suite.Suite, expected_, tbl3.Pluck(map[interface{}]interface{}{"id": true}).OrderBy("id").Nth(0), suite.session, r.RunOpts{ 1662 GeometryFormat: "raw", 1663 GroupFormat: "map", 1664 }) 1665 suite.T().Log("Finished running line #420") 1666 } 1667 1668 { 1669 // transformation.yaml line #425 1670 /* {'id':0,'a':0} */ 1671 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 0, "a": 0} 1672 /* tbl3.pluck('id', 'a').order_by('id').nth(0) */ 1673 1674 suite.T().Log("About to run line #425: tbl3.Pluck('id', 'a').OrderBy('id').Nth(0)") 1675 1676 runAndAssert(suite.Suite, expected_, tbl3.Pluck("id", "a").OrderBy("id").Nth(0), suite.session, r.RunOpts{ 1677 GeometryFormat: "raw", 1678 GroupFormat: "map", 1679 }) 1680 suite.T().Log("Finished running line #425") 1681 } 1682 1683 { 1684 // transformation.yaml line #428 1685 /* {'id':0,'a':0} */ 1686 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 0, "a": 0} 1687 /* tbl3.pluck(['id', 'a']).order_by('id').nth(0) */ 1688 1689 suite.T().Log("About to run line #428: tbl3.Pluck([]interface{}{'id', 'a'}).OrderBy('id').Nth(0)") 1690 1691 runAndAssert(suite.Suite, expected_, tbl3.Pluck([]interface{}{"id", "a"}).OrderBy("id").Nth(0), suite.session, r.RunOpts{ 1692 GeometryFormat: "raw", 1693 GroupFormat: "map", 1694 }) 1695 suite.T().Log("Finished running line #428") 1696 } 1697 1698 { 1699 // transformation.yaml line #431 1700 /* {'id':0,'a':0} */ 1701 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 0, "a": 0} 1702 /* tbl3.pluck({'id':True, 'a':True}).order_by('id').nth(0) */ 1703 1704 suite.T().Log("About to run line #431: tbl3.Pluck(map[interface{}]interface{}{'id': true, 'a': true, }).OrderBy('id').Nth(0)") 1705 1706 runAndAssert(suite.Suite, expected_, tbl3.Pluck(map[interface{}]interface{}{"id": true, "a": true}).OrderBy("id").Nth(0), suite.session, r.RunOpts{ 1707 GeometryFormat: "raw", 1708 GroupFormat: "map", 1709 }) 1710 suite.T().Log("Finished running line #431") 1711 } 1712 1713 { 1714 // transformation.yaml line #436 1715 /* {'id':0} */ 1716 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 0} 1717 /* tbl3.pluck('id', 'missing').order_by('id').nth(0) */ 1718 1719 suite.T().Log("About to run line #436: tbl3.Pluck('id', 'missing').OrderBy('id').Nth(0)") 1720 1721 runAndAssert(suite.Suite, expected_, tbl3.Pluck("id", "missing").OrderBy("id").Nth(0), suite.session, r.RunOpts{ 1722 GeometryFormat: "raw", 1723 GroupFormat: "map", 1724 }) 1725 suite.T().Log("Finished running line #436") 1726 } 1727 1728 { 1729 // transformation.yaml line #439 1730 /* {'id':0} */ 1731 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 0} 1732 /* tbl3.pluck(['id', 'missing']).order_by('id').nth(0) */ 1733 1734 suite.T().Log("About to run line #439: tbl3.Pluck([]interface{}{'id', 'missing'}).OrderBy('id').Nth(0)") 1735 1736 runAndAssert(suite.Suite, expected_, tbl3.Pluck([]interface{}{"id", "missing"}).OrderBy("id").Nth(0), suite.session, r.RunOpts{ 1737 GeometryFormat: "raw", 1738 GroupFormat: "map", 1739 }) 1740 suite.T().Log("Finished running line #439") 1741 } 1742 1743 { 1744 // transformation.yaml line #442 1745 /* {'id':0} */ 1746 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 0} 1747 /* tbl3.pluck({'id':True, 'missing':True}).order_by('id').nth(0) */ 1748 1749 suite.T().Log("About to run line #442: tbl3.Pluck(map[interface{}]interface{}{'id': true, 'missing': true, }).OrderBy('id').Nth(0)") 1750 1751 runAndAssert(suite.Suite, expected_, tbl3.Pluck(map[interface{}]interface{}{"id": true, "missing": true}).OrderBy("id").Nth(0), suite.session, r.RunOpts{ 1752 GeometryFormat: "raw", 1753 GroupFormat: "map", 1754 }) 1755 suite.T().Log("Finished running line #442") 1756 } 1757 1758 { 1759 // transformation.yaml line #447 1760 /* {'id':0, 'b':{'c':0}} */ 1761 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 0, "b": map[interface{}]interface{}{"c": 0}} 1762 /* tbl3.pluck('id', {'b':'c'}).order_by('id').nth(0) */ 1763 1764 suite.T().Log("About to run line #447: tbl3.Pluck('id', map[interface{}]interface{}{'b': 'c', }).OrderBy('id').Nth(0)") 1765 1766 runAndAssert(suite.Suite, expected_, tbl3.Pluck("id", map[interface{}]interface{}{"b": "c"}).OrderBy("id").Nth(0), suite.session, r.RunOpts{ 1767 GeometryFormat: "raw", 1768 GroupFormat: "map", 1769 }) 1770 suite.T().Log("Finished running line #447") 1771 } 1772 1773 { 1774 // transformation.yaml line #450 1775 /* {'id':0, 'b':{'c':0}} */ 1776 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 0, "b": map[interface{}]interface{}{"c": 0}} 1777 /* tbl3.pluck(['id', {'b':'c'}]).order_by('id').nth(0) */ 1778 1779 suite.T().Log("About to run line #450: tbl3.Pluck([]interface{}{'id', map[interface{}]interface{}{'b': 'c', }}).OrderBy('id').Nth(0)") 1780 1781 runAndAssert(suite.Suite, expected_, tbl3.Pluck([]interface{}{"id", map[interface{}]interface{}{"b": "c"}}).OrderBy("id").Nth(0), suite.session, r.RunOpts{ 1782 GeometryFormat: "raw", 1783 GroupFormat: "map", 1784 }) 1785 suite.T().Log("Finished running line #450") 1786 } 1787 1788 { 1789 // transformation.yaml line #453 1790 /* err('ReqlQueryLogicError', 'Invalid path argument `1`.', []) */ 1791 var expected_ Err = err("ReqlQueryLogicError", "Invalid path argument `1`.") 1792 /* tbl3.pluck(1) */ 1793 1794 suite.T().Log("About to run line #453: tbl3.Pluck(1)") 1795 1796 runAndAssert(suite.Suite, expected_, tbl3.Pluck(1), suite.session, r.RunOpts{ 1797 GeometryFormat: "raw", 1798 GroupFormat: "map", 1799 }) 1800 suite.T().Log("Finished running line #453") 1801 } 1802 1803 { 1804 // transformation.yaml line #456 1805 /* err('ReqlQueryLogicError', 'Cannot perform pluck on a sequence of sequences.', []) */ 1806 var expected_ Err = err("ReqlQueryLogicError", "Cannot perform pluck on a sequence of sequences.") 1807 /* r.expr([[{"foo":1}]]).pluck("foo") */ 1808 1809 suite.T().Log("About to run line #456: r.Expr([]interface{}{[]interface{}{map[interface{}]interface{}{'foo': 1, }}}).Pluck('foo')") 1810 1811 runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{[]interface{}{map[interface{}]interface{}{"foo": 1}}}).Pluck("foo"), suite.session, r.RunOpts{ 1812 GeometryFormat: "raw", 1813 GroupFormat: "map", 1814 }) 1815 suite.T().Log("Finished running line #456") 1816 } 1817 1818 { 1819 // transformation.yaml line #461 1820 /* [{'a':1},{'b':2}] */ 1821 var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}, map[interface{}]interface{}{"b": 2}} 1822 /* r.expr(['a','b']).map(lambda x:r.expr({'a':1,'b':2}).pluck(x)) */ 1823 1824 suite.T().Log("About to run line #461: r.Expr([]interface{}{'a', 'b'}).Map(func(x r.Term) interface{} { return r.Expr(map[interface{}]interface{}{'a': 1, 'b': 2, }).Pluck(x)})") 1825 1826 runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{"a", "b"}).Map(func(x r.Term) interface{} { return r.Expr(map[interface{}]interface{}{"a": 1, "b": 2}).Pluck(x) }), suite.session, r.RunOpts{ 1827 GeometryFormat: "raw", 1828 GroupFormat: "map", 1829 }) 1830 suite.T().Log("Finished running line #461") 1831 } 1832 1833 { 1834 // transformation.yaml line #466 1835 /* {"foo":{}} */ 1836 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"foo": map[interface{}]interface{}{}} 1837 /* r.expr({"foo":{"bar":1}}).pluck({"foo":{"bar":"buzz"}}) */ 1838 1839 suite.T().Log("About to run line #466: r.Expr(map[interface{}]interface{}{'foo': map[interface{}]interface{}{'bar': 1, }, }).Pluck(map[interface{}]interface{}{'foo': map[interface{}]interface{}{'bar': 'buzz', }, })") 1840 1841 runAndAssert(suite.Suite, expected_, r.Expr(map[interface{}]interface{}{"foo": map[interface{}]interface{}{"bar": 1}}).Pluck(map[interface{}]interface{}{"foo": map[interface{}]interface{}{"bar": "buzz"}}), suite.session, r.RunOpts{ 1842 GeometryFormat: "raw", 1843 GroupFormat: "map", 1844 }) 1845 suite.T().Log("Finished running line #466") 1846 } 1847 1848 { 1849 // transformation.yaml line #470 1850 /* {'id':0,'a':0} */ 1851 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 0, "a": 0} 1852 /* tbl.without().order_by('id').nth(0) */ 1853 1854 suite.T().Log("About to run line #470: tbl.Without().OrderBy('id').Nth(0)") 1855 1856 runAndAssert(suite.Suite, expected_, tbl.Without().OrderBy("id").Nth(0), suite.session, r.RunOpts{ 1857 GeometryFormat: "raw", 1858 GroupFormat: "map", 1859 }) 1860 suite.T().Log("Finished running line #470") 1861 } 1862 1863 { 1864 // transformation.yaml line #473 1865 /* {'id':0} */ 1866 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 0} 1867 /* tbl.without('a').order_by('id').nth(0) */ 1868 1869 suite.T().Log("About to run line #473: tbl.Without('a').OrderBy('id').Nth(0)") 1870 1871 runAndAssert(suite.Suite, expected_, tbl.Without("a").OrderBy("id").Nth(0), suite.session, r.RunOpts{ 1872 GeometryFormat: "raw", 1873 GroupFormat: "map", 1874 }) 1875 suite.T().Log("Finished running line #473") 1876 } 1877 1878 { 1879 // transformation.yaml line #476 1880 /* {} */ 1881 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{} 1882 /* tbl.without('id', 'a').nth(0) */ 1883 1884 suite.T().Log("About to run line #476: tbl.Without('id', 'a').Nth(0)") 1885 1886 runAndAssert(suite.Suite, expected_, tbl.Without("id", "a").Nth(0), suite.session, r.RunOpts{ 1887 GeometryFormat: "raw", 1888 GroupFormat: "map", 1889 }) 1890 suite.T().Log("Finished running line #476") 1891 } 1892 1893 { 1894 // transformation.yaml line #479 1895 /* {'id':0} */ 1896 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 0} 1897 /* tbl.without('a', 'missing').order_by('id').nth(0) */ 1898 1899 suite.T().Log("About to run line #479: tbl.Without('a', 'missing').OrderBy('id').Nth(0)") 1900 1901 runAndAssert(suite.Suite, expected_, tbl.Without("a", "missing").OrderBy("id").Nth(0), suite.session, r.RunOpts{ 1902 GeometryFormat: "raw", 1903 GroupFormat: "map", 1904 }) 1905 suite.T().Log("Finished running line #479") 1906 } 1907 1908 { 1909 // transformation.yaml line #482 1910 /* {'id':0, 'b':{}} */ 1911 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 0, "b": map[interface{}]interface{}{}} 1912 /* tbl3.without('a', {'b':'c'}).order_by('id').nth(0) */ 1913 1914 suite.T().Log("About to run line #482: tbl3.Without('a', map[interface{}]interface{}{'b': 'c', }).OrderBy('id').Nth(0)") 1915 1916 runAndAssert(suite.Suite, expected_, tbl3.Without("a", map[interface{}]interface{}{"b": "c"}).OrderBy("id").Nth(0), suite.session, r.RunOpts{ 1917 GeometryFormat: "raw", 1918 GroupFormat: "map", 1919 }) 1920 suite.T().Log("Finished running line #482") 1921 } 1922 1923 { 1924 // transformation.yaml line #485 1925 /* {'id':0, 'b':{}} */ 1926 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 0, "b": map[interface{}]interface{}{}} 1927 /* tbl3.without(['a', {'b':'c'}]).order_by('id').nth(0) */ 1928 1929 suite.T().Log("About to run line #485: tbl3.Without([]interface{}{'a', map[interface{}]interface{}{'b': 'c', }}).OrderBy('id').Nth(0)") 1930 1931 runAndAssert(suite.Suite, expected_, tbl3.Without([]interface{}{"a", map[interface{}]interface{}{"b": "c"}}).OrderBy("id").Nth(0), suite.session, r.RunOpts{ 1932 GeometryFormat: "raw", 1933 GroupFormat: "map", 1934 }) 1935 suite.T().Log("Finished running line #485") 1936 } 1937 1938 { 1939 // transformation.yaml line #488 1940 /* {'id':0, 'b':{'c':0}} */ 1941 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 0, "b": map[interface{}]interface{}{"c": 0}} 1942 /* tbl3.without(['a', {'b':'d'}]).order_by('id').nth(0) */ 1943 1944 suite.T().Log("About to run line #488: tbl3.Without([]interface{}{'a', map[interface{}]interface{}{'b': 'd', }}).OrderBy('id').Nth(0)") 1945 1946 runAndAssert(suite.Suite, expected_, tbl3.Without([]interface{}{"a", map[interface{}]interface{}{"b": "d"}}).OrderBy("id").Nth(0), suite.session, r.RunOpts{ 1947 GeometryFormat: "raw", 1948 GroupFormat: "map", 1949 }) 1950 suite.T().Log("Finished running line #488") 1951 } 1952 1953 { 1954 // transformation.yaml line #492 1955 /* 200 */ 1956 var expected_ int = 200 1957 /* tbl.union(tbl2).count() */ 1958 1959 suite.T().Log("About to run line #492: tbl.Union(tbl2).Count()") 1960 1961 runAndAssert(suite.Suite, expected_, tbl.Union(tbl2).Count(), suite.session, r.RunOpts{ 1962 GeometryFormat: "raw", 1963 GroupFormat: "map", 1964 }) 1965 suite.T().Log("Finished running line #492") 1966 } 1967 1968 { 1969 // transformation.yaml line #494 1970 /* 103 */ 1971 var expected_ int = 103 1972 /* tbl.union([1,2,3]).count() */ 1973 1974 suite.T().Log("About to run line #494: tbl.Union([]interface{}{1, 2, 3}).Count()") 1975 1976 runAndAssert(suite.Suite, expected_, tbl.Union([]interface{}{1, 2, 3}).Count(), suite.session, r.RunOpts{ 1977 GeometryFormat: "raw", 1978 GroupFormat: "map", 1979 }) 1980 suite.T().Log("Finished running line #494") 1981 } 1982 1983 { 1984 // transformation.yaml line #496 1985 /* 103 */ 1986 var expected_ int = 103 1987 /* r.expr([1,2,3]).union(tbl2).count() */ 1988 1989 suite.T().Log("About to run line #496: r.Expr([]interface{}{1, 2, 3}).Union(tbl2).Count()") 1990 1991 runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).Union(tbl2).Count(), suite.session, r.RunOpts{ 1992 GeometryFormat: "raw", 1993 GroupFormat: "map", 1994 }) 1995 suite.T().Log("Finished running line #496") 1996 } 1997 1998 // transformation.yaml line #500 1999 // ord = tbl.order_by('id') 2000 suite.T().Log("Possibly executing: var ord r.Term = tbl.OrderBy('id')") 2001 2002 ord := tbl.OrderBy("id") 2003 _ = ord // Prevent any noused variable errors 2004 2005 { 2006 // transformation.yaml line #502 2007 /* [0,1] */ 2008 var expected_ []interface{} = []interface{}{0, 1} 2009 /* ord.offsets_of(r.row['id'] < 2) */ 2010 2011 suite.T().Log("About to run line #502: ord.OffsetsOf(r.Row.AtIndex('id').Lt(2))") 2012 2013 runAndAssert(suite.Suite, expected_, ord.OffsetsOf(r.Row.AtIndex("id").Lt(2)), suite.session, r.RunOpts{ 2014 GeometryFormat: "raw", 2015 GroupFormat: "map", 2016 }) 2017 suite.T().Log("Finished running line #502") 2018 } 2019 2020 { 2021 // transformation.yaml line #506 2022 /* [2] */ 2023 var expected_ []interface{} = []interface{}{2} 2024 /* r.expr([1,2,3,4]).offsets_of(3) */ 2025 2026 suite.T().Log("About to run line #506: r.Expr([]interface{}{1, 2, 3, 4}).OffsetsOf(3)") 2027 2028 runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3, 4}).OffsetsOf(3), suite.session, r.RunOpts{ 2029 GeometryFormat: "raw", 2030 GroupFormat: "map", 2031 }) 2032 suite.T().Log("Finished running line #506") 2033 } 2034 2035 { 2036 // transformation.yaml line #509 2037 /* err('ReqlQueryLogicError', 'Expected type DATUM but found TABLE:', []) */ 2038 var expected_ Err = err("ReqlQueryLogicError", "Expected type DATUM but found TABLE:") 2039 /* r.expr([1]).offsets_of(tbl) */ 2040 2041 suite.T().Log("About to run line #509: r.Expr([]interface{}{1}).OffsetsOf(tbl)") 2042 2043 runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1}).OffsetsOf(tbl), suite.session, r.RunOpts{ 2044 GeometryFormat: "raw", 2045 GroupFormat: "map", 2046 }) 2047 suite.T().Log("Finished running line #509") 2048 } 2049 2050 { 2051 // transformation.yaml line #512 2052 /* [1] */ 2053 var expected_ []interface{} = []interface{}{1} 2054 /* r.expr(1).do(lambda x: r.expr([2,1,0]).offsets_of(x)) */ 2055 2056 suite.T().Log("About to run line #512: r.Expr(1).Do(func(x r.Term) interface{} { return r.Expr([]interface{}{2, 1, 0}).OffsetsOf(x)})") 2057 2058 runAndAssert(suite.Suite, expected_, r.Expr(1).Do(func(x r.Term) interface{} { return r.Expr([]interface{}{2, 1, 0}).OffsetsOf(x) }), suite.session, r.RunOpts{ 2059 GeometryFormat: "raw", 2060 GroupFormat: "map", 2061 }) 2062 suite.T().Log("Finished running line #512") 2063 } 2064 2065 { 2066 // transformation.yaml line #518 2067 /* true */ 2068 var expected_ bool = true 2069 /* tbl.contains(tbl[0]) */ 2070 2071 suite.T().Log("About to run line #518: tbl.Contains(tbl.AtIndex(0))") 2072 2073 runAndAssert(suite.Suite, expected_, tbl.Contains(tbl.AtIndex(0)), suite.session, r.RunOpts{ 2074 GeometryFormat: "raw", 2075 GroupFormat: "map", 2076 }) 2077 suite.T().Log("Finished running line #518") 2078 } 2079 2080 { 2081 // transformation.yaml line #521 2082 /* false */ 2083 var expected_ bool = false 2084 /* tbl.contains(tbl[0].pluck('id')) */ 2085 2086 suite.T().Log("About to run line #521: tbl.Contains(tbl.AtIndex(0).Pluck('id'))") 2087 2088 runAndAssert(suite.Suite, expected_, tbl.Contains(tbl.AtIndex(0).Pluck("id")), suite.session, r.RunOpts{ 2089 GeometryFormat: "raw", 2090 GroupFormat: "map", 2091 }) 2092 suite.T().Log("Finished running line #521") 2093 } 2094 2095 { 2096 // transformation.yaml line #533 2097 /* {'id':0} */ 2098 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 0} 2099 /* tbl3.filter({'b':{'c':0}}).pluck('id').order_by('id').nth(0) */ 2100 2101 suite.T().Log("About to run line #533: tbl3.Filter(map[interface{}]interface{}{'b': map[interface{}]interface{}{'c': 0, }, }).Pluck('id').OrderBy('id').Nth(0)") 2102 2103 runAndAssert(suite.Suite, expected_, tbl3.Filter(map[interface{}]interface{}{"b": map[interface{}]interface{}{"c": 0}}).Pluck("id").OrderBy("id").Nth(0), suite.session, r.RunOpts{ 2104 GeometryFormat: "raw", 2105 GroupFormat: "map", 2106 }) 2107 suite.T().Log("Finished running line #533") 2108 } 2109 2110 { 2111 // transformation.yaml line #536 2112 /* [] */ 2113 var expected_ []interface{} = []interface{}{} 2114 /* tbl3.filter({'b':{'c':6}}) */ 2115 2116 suite.T().Log("About to run line #536: tbl3.Filter(map[interface{}]interface{}{'b': map[interface{}]interface{}{'c': 6, }, })") 2117 2118 runAndAssert(suite.Suite, expected_, tbl3.Filter(map[interface{}]interface{}{"b": map[interface{}]interface{}{"c": 6}}), suite.session, r.RunOpts{ 2119 GeometryFormat: "raw", 2120 GroupFormat: "map", 2121 }) 2122 suite.T().Log("Finished running line #536") 2123 } 2124 2125 { 2126 // transformation.yaml line #539 2127 /* [] */ 2128 var expected_ []interface{} = []interface{}{} 2129 /* tbl3.filter(r.literal({'id':0})) */ 2130 2131 suite.T().Log("About to run line #539: tbl3.Filter(r.Literal(map[interface{}]interface{}{'id': 0, }))") 2132 2133 runAndAssert(suite.Suite, expected_, tbl3.Filter(r.Literal(map[interface{}]interface{}{"id": 0})), suite.session, r.RunOpts{ 2134 GeometryFormat: "raw", 2135 GroupFormat: "map", 2136 }) 2137 suite.T().Log("Finished running line #539") 2138 } 2139 2140 { 2141 // transformation.yaml line #542 2142 /* {'id':0} */ 2143 var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 0} 2144 /* tbl3.filter({'b':r.literal({'c':0})}).pluck('id').order_by('id').nth(0) */ 2145 2146 suite.T().Log("About to run line #542: tbl3.Filter(map[interface{}]interface{}{'b': r.Literal(map[interface{}]interface{}{'c': 0, }), }).Pluck('id').OrderBy('id').Nth(0)") 2147 2148 runAndAssert(suite.Suite, expected_, tbl3.Filter(map[interface{}]interface{}{"b": r.Literal(map[interface{}]interface{}{"c": 0})}).Pluck("id").OrderBy("id").Nth(0), suite.session, r.RunOpts{ 2149 GeometryFormat: "raw", 2150 GroupFormat: "map", 2151 }) 2152 suite.T().Log("Finished running line #542") 2153 } 2154 }