gopkg.in/rethinkdb/rethinkdb-go.v6@v6.2.2/internal/integration/reql_tests/reql_control_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 RQL control flow structures 17 func TestControlSuite(t *testing.T) { 18 suite.Run(t, new(ControlSuite)) 19 } 20 21 type ControlSuite struct { 22 suite.Suite 23 24 session *r.Session 25 } 26 27 func (suite *ControlSuite) SetupTest() { 28 suite.T().Log("Setting up ControlSuite") 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 } 56 57 func (suite *ControlSuite) TearDownSuite() { 58 suite.T().Log("Tearing down ControlSuite") 59 60 if suite.session != nil { 61 r.DB("rethinkdb").Table("_debug_scratch").Delete().Exec(suite.session) 62 r.DB("test").TableDrop("tbl").Exec(suite.session) 63 r.DB("test").TableDrop("tbl2").Exec(suite.session) 64 r.DBDrop("test").Exec(suite.session) 65 66 suite.session.Close() 67 } 68 } 69 70 func (suite *ControlSuite) TestCases() { 71 suite.T().Log("Running ControlSuite: Tests RQL control flow structures") 72 73 tbl := r.DB("test").Table("tbl") 74 _ = tbl // Prevent any noused variable errors 75 tbl2 := r.DB("test").Table("tbl2") 76 _ = tbl2 // Prevent any noused variable errors 77 78 { 79 // control.yaml line #7 80 /* 2 */ 81 var expected_ int = 2 82 /* r.expr(1).do(lambda v: v * 2) */ 83 84 suite.T().Log("About to run line #7: r.Expr(1).Do(func(v r.Term) interface{} { return r.Mul(v, 2)})") 85 86 runAndAssert(suite.Suite, expected_, r.Expr(1).Do(func(v r.Term) interface{} { return r.Mul(v, 2) }), suite.session, r.RunOpts{ 87 GeometryFormat: "raw", 88 GroupFormat: "map", 89 }) 90 suite.T().Log("Finished running line #7") 91 } 92 93 { 94 // control.yaml line #12 95 /* [0, 1, 2, 3] */ 96 var expected_ []interface{} = []interface{}{0, 1, 2, 3} 97 /* r.expr([0, 1, 2]).do(lambda v: v.append(3)) */ 98 99 suite.T().Log("About to run line #12: r.Expr([]interface{}{0, 1, 2}).Do(func(v r.Term) interface{} { return v.Append(3)})") 100 101 runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{0, 1, 2}).Do(func(v r.Term) interface{} { return v.Append(3) }), suite.session, r.RunOpts{ 102 GeometryFormat: "raw", 103 GroupFormat: "map", 104 }) 105 suite.T().Log("Finished running line #12") 106 } 107 108 { 109 // control.yaml line #17 110 /* 3 */ 111 var expected_ int = 3 112 /* r.do(1, 2, lambda x, y: x + y) */ 113 114 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)})") 115 116 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{ 117 GeometryFormat: "raw", 118 GroupFormat: "map", 119 }) 120 suite.T().Log("Finished running line #17") 121 } 122 123 { 124 // control.yaml line #22 125 /* 1 */ 126 var expected_ int = 1 127 /* r.do(lambda: 1) */ 128 129 suite.T().Log("About to run line #22: r.Do(func() interface{} { return 1})") 130 131 runAndAssert(suite.Suite, expected_, r.Do(func() interface{} { return 1 }), suite.session, r.RunOpts{ 132 GeometryFormat: "raw", 133 GroupFormat: "map", 134 }) 135 suite.T().Log("Finished running line #22") 136 } 137 138 { 139 // control.yaml line #38 140 /* 1 */ 141 var expected_ int = 1 142 /* r.do(1) */ 143 144 suite.T().Log("About to run line #38: r.Do(1)") 145 146 runAndAssert(suite.Suite, expected_, r.Do(1), suite.session, r.RunOpts{ 147 GeometryFormat: "raw", 148 GroupFormat: "map", 149 }) 150 suite.T().Log("Finished running line #38") 151 } 152 153 { 154 // control.yaml line #53 155 /* err("ReqlQueryLogicError", "Expected type ARRAY but found STRING.", [1, 0]) */ 156 var expected_ Err = err("ReqlQueryLogicError", "Expected type ARRAY but found STRING.") 157 /* r.expr('abc').do(lambda v: v.append(3)) */ 158 159 suite.T().Log("About to run line #53: r.Expr('abc').Do(func(v r.Term) interface{} { return v.Append(3)})") 160 161 runAndAssert(suite.Suite, expected_, r.Expr("abc").Do(func(v r.Term) interface{} { return v.Append(3) }), suite.session, r.RunOpts{ 162 GeometryFormat: "raw", 163 GroupFormat: "map", 164 }) 165 suite.T().Log("Finished running line #53") 166 } 167 168 { 169 // control.yaml line #58 170 /* err("ReqlQueryLogicError", "Expected type STRING but found NUMBER.", [1, 1]) */ 171 var expected_ Err = err("ReqlQueryLogicError", "Expected type STRING but found NUMBER.") 172 /* r.expr('abc').do(lambda v: v + 3) */ 173 174 suite.T().Log("About to run line #58: r.Expr('abc').Do(func(v r.Term) interface{} { return r.Add(v, 3)})") 175 176 runAndAssert(suite.Suite, expected_, r.Expr("abc").Do(func(v r.Term) interface{} { return r.Add(v, 3) }), suite.session, r.RunOpts{ 177 GeometryFormat: "raw", 178 GroupFormat: "map", 179 }) 180 suite.T().Log("Finished running line #58") 181 } 182 183 { 184 // control.yaml line #63 185 /* err("ReqlQueryLogicError", "Expected type STRING but found NUMBER.", [1]) */ 186 var expected_ Err = err("ReqlQueryLogicError", "Expected type STRING but found NUMBER.") 187 /* r.expr('abc').do(lambda v: v + 'def') + 3 */ 188 189 suite.T().Log("About to run line #63: r.Expr('abc').Do(func(v r.Term) interface{} { return r.Add(v, 'def')}).Add(3)") 190 191 runAndAssert(suite.Suite, expected_, r.Expr("abc").Do(func(v r.Term) interface{} { return r.Add(v, "def") }).Add(3), suite.session, r.RunOpts{ 192 GeometryFormat: "raw", 193 GroupFormat: "map", 194 }) 195 suite.T().Log("Finished running line #63") 196 } 197 198 { 199 // control.yaml line #78 200 /* 5 */ 201 var expected_ int = 5 202 /* r.expr(5).do(r.row) */ 203 204 suite.T().Log("About to run line #78: r.Expr(5).Do(r.Row)") 205 206 runAndAssert(suite.Suite, expected_, r.Expr(5).Do(r.Row), suite.session, r.RunOpts{ 207 GeometryFormat: "raw", 208 GroupFormat: "map", 209 }) 210 suite.T().Log("Finished running line #78") 211 } 212 213 { 214 // control.yaml line #84 215 /* 1 */ 216 var expected_ int = 1 217 /* r.branch(True, 1, 2) */ 218 219 suite.T().Log("About to run line #84: r.Branch(true, 1, 2)") 220 221 runAndAssert(suite.Suite, expected_, r.Branch(true, 1, 2), suite.session, r.RunOpts{ 222 GeometryFormat: "raw", 223 GroupFormat: "map", 224 }) 225 suite.T().Log("Finished running line #84") 226 } 227 228 { 229 // control.yaml line #86 230 /* 2 */ 231 var expected_ int = 2 232 /* r.branch(False, 1, 2) */ 233 234 suite.T().Log("About to run line #86: r.Branch(false, 1, 2)") 235 236 runAndAssert(suite.Suite, expected_, r.Branch(false, 1, 2), suite.session, r.RunOpts{ 237 GeometryFormat: "raw", 238 GroupFormat: "map", 239 }) 240 suite.T().Log("Finished running line #86") 241 } 242 243 { 244 // control.yaml line #88 245 /* ("c") */ 246 var expected_ string = "c" 247 /* r.branch(1, 'c', False) */ 248 249 suite.T().Log("About to run line #88: r.Branch(1, 'c', false)") 250 251 runAndAssert(suite.Suite, expected_, r.Branch(1, "c", false), suite.session, r.RunOpts{ 252 GeometryFormat: "raw", 253 GroupFormat: "map", 254 }) 255 suite.T().Log("Finished running line #88") 256 } 257 258 { 259 // control.yaml line #90 260 /* ([]) */ 261 var expected_ []interface{} = []interface{}{} 262 /* r.branch(null, {}, []) */ 263 264 suite.T().Log("About to run line #90: r.Branch(nil, map[interface{}]interface{}{}, []interface{}{})") 265 266 runAndAssert(suite.Suite, expected_, r.Branch(nil, map[interface{}]interface{}{}, []interface{}{}), suite.session, r.RunOpts{ 267 GeometryFormat: "raw", 268 GroupFormat: "map", 269 }) 270 suite.T().Log("Finished running line #90") 271 } 272 273 { 274 // control.yaml line #93 275 /* err("ReqlQueryLogicError", "Expected type DATUM but found DATABASE:", []) */ 276 var expected_ Err = err("ReqlQueryLogicError", "Expected type DATUM but found DATABASE:") 277 /* r.branch(r.db('test'), 1, 2) */ 278 279 suite.T().Log("About to run line #93: r.Branch(r.DB('test'), 1, 2)") 280 281 runAndAssert(suite.Suite, expected_, r.Branch(r.DB("test"), 1, 2), suite.session, r.RunOpts{ 282 GeometryFormat: "raw", 283 GroupFormat: "map", 284 }) 285 suite.T().Log("Finished running line #93") 286 } 287 288 { 289 // control.yaml line #95 290 /* err("ReqlQueryLogicError", "Expected type DATUM but found TABLE:", []) */ 291 var expected_ Err = err("ReqlQueryLogicError", "Expected type DATUM but found TABLE:") 292 /* r.branch(tbl, 1, 2) */ 293 294 suite.T().Log("About to run line #95: r.Branch(tbl, 1, 2)") 295 296 runAndAssert(suite.Suite, expected_, r.Branch(tbl, 1, 2), suite.session, r.RunOpts{ 297 GeometryFormat: "raw", 298 GroupFormat: "map", 299 }) 300 suite.T().Log("Finished running line #95") 301 } 302 303 { 304 // control.yaml line #97 305 /* err("ReqlUserError", "a", []) */ 306 var expected_ Err = err("ReqlUserError", "a") 307 /* r.branch(r.error("a"), 1, 2) */ 308 309 suite.T().Log("About to run line #97: r.Branch(r.Error('a'), 1, 2)") 310 311 runAndAssert(suite.Suite, expected_, r.Branch(r.Error("a"), 1, 2), suite.session, r.RunOpts{ 312 GeometryFormat: "raw", 313 GroupFormat: "map", 314 }) 315 suite.T().Log("Finished running line #97") 316 } 317 318 { 319 // control.yaml line #100 320 /* 1 */ 321 var expected_ int = 1 322 /* r.branch([], 1, 2) */ 323 324 suite.T().Log("About to run line #100: r.Branch([]interface{}{}, 1, 2)") 325 326 runAndAssert(suite.Suite, expected_, r.Branch([]interface{}{}, 1, 2), suite.session, r.RunOpts{ 327 GeometryFormat: "raw", 328 GroupFormat: "map", 329 }) 330 suite.T().Log("Finished running line #100") 331 } 332 333 { 334 // control.yaml line #102 335 /* 1 */ 336 var expected_ int = 1 337 /* r.branch({}, 1, 2) */ 338 339 suite.T().Log("About to run line #102: r.Branch(map[interface{}]interface{}{}, 1, 2)") 340 341 runAndAssert(suite.Suite, expected_, r.Branch(map[interface{}]interface{}{}, 1, 2), suite.session, r.RunOpts{ 342 GeometryFormat: "raw", 343 GroupFormat: "map", 344 }) 345 suite.T().Log("Finished running line #102") 346 } 347 348 { 349 // control.yaml line #104 350 /* 1 */ 351 var expected_ int = 1 352 /* r.branch("a", 1, 2) */ 353 354 suite.T().Log("About to run line #104: r.Branch('a', 1, 2)") 355 356 runAndAssert(suite.Suite, expected_, r.Branch("a", 1, 2), suite.session, r.RunOpts{ 357 GeometryFormat: "raw", 358 GroupFormat: "map", 359 }) 360 suite.T().Log("Finished running line #104") 361 } 362 363 { 364 // control.yaml line #106 365 /* 1 */ 366 var expected_ int = 1 367 /* r.branch(1.2, 1, 2) */ 368 369 suite.T().Log("About to run line #106: r.Branch(1.2, 1, 2)") 370 371 runAndAssert(suite.Suite, expected_, r.Branch(1.2, 1, 2), suite.session, r.RunOpts{ 372 GeometryFormat: "raw", 373 GroupFormat: "map", 374 }) 375 suite.T().Log("Finished running line #106") 376 } 377 378 { 379 // control.yaml line #109 380 /* 1 */ 381 var expected_ int = 1 382 /* r.branch(True, 1, True, 2, 3) */ 383 384 suite.T().Log("About to run line #109: r.Branch(true, 1, true, 2, 3)") 385 386 runAndAssert(suite.Suite, expected_, r.Branch(true, 1, true, 2, 3), suite.session, r.RunOpts{ 387 GeometryFormat: "raw", 388 GroupFormat: "map", 389 }) 390 suite.T().Log("Finished running line #109") 391 } 392 393 { 394 // control.yaml line #111 395 /* 1 */ 396 var expected_ int = 1 397 /* r.branch(True, 1, False, 2, 3) */ 398 399 suite.T().Log("About to run line #111: r.Branch(true, 1, false, 2, 3)") 400 401 runAndAssert(suite.Suite, expected_, r.Branch(true, 1, false, 2, 3), suite.session, r.RunOpts{ 402 GeometryFormat: "raw", 403 GroupFormat: "map", 404 }) 405 suite.T().Log("Finished running line #111") 406 } 407 408 { 409 // control.yaml line #113 410 /* 2 */ 411 var expected_ int = 2 412 /* r.branch(False, 1, True, 2, 3) */ 413 414 suite.T().Log("About to run line #113: r.Branch(false, 1, true, 2, 3)") 415 416 runAndAssert(suite.Suite, expected_, r.Branch(false, 1, true, 2, 3), suite.session, r.RunOpts{ 417 GeometryFormat: "raw", 418 GroupFormat: "map", 419 }) 420 suite.T().Log("Finished running line #113") 421 } 422 423 { 424 // control.yaml line #115 425 /* 3 */ 426 var expected_ int = 3 427 /* r.branch(False, 1, False, 2, 3) */ 428 429 suite.T().Log("About to run line #115: r.Branch(false, 1, false, 2, 3)") 430 431 runAndAssert(suite.Suite, expected_, r.Branch(false, 1, false, 2, 3), suite.session, r.RunOpts{ 432 GeometryFormat: "raw", 433 GroupFormat: "map", 434 }) 435 suite.T().Log("Finished running line #115") 436 } 437 438 { 439 // control.yaml line #118 440 /* err("ReqlQueryLogicError", "Cannot call `branch` term with an even number of arguments.") */ 441 var expected_ Err = err("ReqlQueryLogicError", "Cannot call `branch` term with an even number of arguments.") 442 /* r.branch(True, 1, True, 2) */ 443 444 suite.T().Log("About to run line #118: r.Branch(true, 1, true, 2)") 445 446 runAndAssert(suite.Suite, expected_, r.Branch(true, 1, true, 2), suite.session, r.RunOpts{ 447 GeometryFormat: "raw", 448 GroupFormat: "map", 449 }) 450 suite.T().Log("Finished running line #118") 451 } 452 453 { 454 // control.yaml line #122 455 /* err("ReqlUserError", "Hello World", [0]) */ 456 var expected_ Err = err("ReqlUserError", "Hello World") 457 /* r.error('Hello World') */ 458 459 suite.T().Log("About to run line #122: r.Error('Hello World')") 460 461 runAndAssert(suite.Suite, expected_, r.Error("Hello World"), suite.session, r.RunOpts{ 462 GeometryFormat: "raw", 463 GroupFormat: "map", 464 }) 465 suite.T().Log("Finished running line #122") 466 } 467 468 { 469 // control.yaml line #125 470 /* err("ReqlQueryLogicError", "Expected type STRING but found NUMBER.", [0]) */ 471 var expected_ Err = err("ReqlQueryLogicError", "Expected type STRING but found NUMBER.") 472 /* r.error(5) */ 473 474 suite.T().Log("About to run line #125: r.Error(5)") 475 476 runAndAssert(suite.Suite, expected_, r.Error(5), suite.session, r.RunOpts{ 477 GeometryFormat: "raw", 478 GroupFormat: "map", 479 }) 480 suite.T().Log("Finished running line #125") 481 } 482 483 { 484 // control.yaml line #140 485 /* 2 */ 486 var expected_ int = 2 487 /* r.js('1 + 1') */ 488 489 suite.T().Log("About to run line #140: r.JS('1 + 1')") 490 491 runAndAssert(suite.Suite, expected_, r.JS("1 + 1"), suite.session, r.RunOpts{ 492 GeometryFormat: "raw", 493 GroupFormat: "map", 494 }) 495 suite.T().Log("Finished running line #140") 496 } 497 498 { 499 // control.yaml line #143 500 /* 4 */ 501 var expected_ int = 4 502 /* r.js('1 + 1; 2 + 2') */ 503 504 suite.T().Log("About to run line #143: r.JS('1 + 1; 2 + 2')") 505 506 runAndAssert(suite.Suite, expected_, r.JS("1 + 1; 2 + 2"), suite.session, r.RunOpts{ 507 GeometryFormat: "raw", 508 GroupFormat: "map", 509 }) 510 suite.T().Log("Finished running line #143") 511 } 512 513 { 514 // control.yaml line #146 515 /* 3 */ 516 var expected_ int = 3 517 /* r.do(1, 2, r.js('(function(a, b) { return a + b; })')) */ 518 519 suite.T().Log("About to run line #146: r.Do(1, 2, r.JS('(function(a, b) { return a + b; })'))") 520 521 runAndAssert(suite.Suite, expected_, r.Do(1, 2, r.JS("(function(a, b) { return a + b; })")), suite.session, r.RunOpts{ 522 GeometryFormat: "raw", 523 GroupFormat: "map", 524 }) 525 suite.T().Log("Finished running line #146") 526 } 527 528 { 529 // control.yaml line #149 530 /* 2 */ 531 var expected_ int = 2 532 /* r.expr(1).do(r.js('(function(x) { return x + 1; })')) */ 533 534 suite.T().Log("About to run line #149: r.Expr(1).Do(r.JS('(function(x) { return x + 1; })'))") 535 536 runAndAssert(suite.Suite, expected_, r.Expr(1).Do(r.JS("(function(x) { return x + 1; })")), suite.session, r.RunOpts{ 537 GeometryFormat: "raw", 538 GroupFormat: "map", 539 }) 540 suite.T().Log("Finished running line #149") 541 } 542 543 { 544 // control.yaml line #152 545 /* 'foobar' */ 546 var expected_ string = "foobar" 547 /* r.expr('foo').do(r.js('(function(x) { return x + "bar"; })')) */ 548 549 suite.T().Log("About to run line #152: r.Expr('foo').Do(r.JS('(function(x) { return x + \\'bar\\'; })'))") 550 551 runAndAssert(suite.Suite, expected_, r.Expr("foo").Do(r.JS("(function(x) { return x + \"bar\"; })")), suite.session, r.RunOpts{ 552 GeometryFormat: "raw", 553 GroupFormat: "map", 554 }) 555 suite.T().Log("Finished running line #152") 556 } 557 558 { 559 // control.yaml line #157 560 /* 3 */ 561 var expected_ int = 3 562 /* r.js('1 + 2', timeout=1.2) */ 563 564 suite.T().Log("About to run line #157: r.JS('1 + 2').OptArgs(r.JSOpts{Timeout: 1.2, })") 565 566 runAndAssert(suite.Suite, expected_, r.JS("1 + 2").OptArgs(r.JSOpts{Timeout: 1.2}), suite.session, r.RunOpts{ 567 GeometryFormat: "raw", 568 GroupFormat: "map", 569 }) 570 suite.T().Log("Finished running line #157") 571 } 572 573 { 574 // control.yaml line #161 575 /* err("ReqlQueryLogicError", "Query result must be of type DATUM, GROUPED_DATA, or STREAM (got FUNCTION).", [0]) */ 576 var expected_ Err = err("ReqlQueryLogicError", "Query result must be of type DATUM, GROUPED_DATA, or STREAM (got FUNCTION).") 577 /* r.js('(function() { return 1; })') */ 578 579 suite.T().Log("About to run line #161: r.JS('(function() { return 1; })')") 580 581 runAndAssert(suite.Suite, expected_, r.JS("(function() { return 1; })"), suite.session, r.RunOpts{ 582 GeometryFormat: "raw", 583 GroupFormat: "map", 584 }) 585 suite.T().Log("Finished running line #161") 586 } 587 588 { 589 // control.yaml line #164 590 /* err("ReqlQueryLogicError", "SyntaxError: Unexpected token (", [0]) */ 591 var expected_ Err = err("ReqlQueryLogicError", "SyntaxError: Unexpected token (") 592 /* r.js('function() { return 1; }') */ 593 594 suite.T().Log("About to run line #164: r.JS('function() { return 1; }')") 595 596 runAndAssert(suite.Suite, expected_, r.JS("function() { return 1; }"), suite.session, r.RunOpts{ 597 GeometryFormat: "raw", 598 GroupFormat: "map", 599 }) 600 suite.T().Log("Finished running line #164") 601 } 602 603 { 604 // control.yaml line #168 605 /* 1 */ 606 var expected_ int = 1 607 /* r.do(1, 2, r.js('(function(a) { return a; })')) */ 608 609 suite.T().Log("About to run line #168: r.Do(1, 2, r.JS('(function(a) { return a; })'))") 610 611 runAndAssert(suite.Suite, expected_, r.Do(1, 2, r.JS("(function(a) { return a; })")), suite.session, r.RunOpts{ 612 GeometryFormat: "raw", 613 GroupFormat: "map", 614 }) 615 suite.T().Log("Finished running line #168") 616 } 617 618 { 619 // control.yaml line #171 620 /* 1 */ 621 var expected_ int = 1 622 /* r.do(1, 2, r.js('(function(a, b, c) { return a; })')) */ 623 624 suite.T().Log("About to run line #171: r.Do(1, 2, r.JS('(function(a, b, c) { return a; })'))") 625 626 runAndAssert(suite.Suite, expected_, r.Do(1, 2, r.JS("(function(a, b, c) { return a; })")), suite.session, r.RunOpts{ 627 GeometryFormat: "raw", 628 GroupFormat: "map", 629 }) 630 suite.T().Log("Finished running line #171") 631 } 632 633 { 634 // control.yaml line #174 635 /* err("ReqlQueryLogicError", "Cannot convert javascript `undefined` to ql::datum_t.", [0]) */ 636 var expected_ Err = err("ReqlQueryLogicError", "Cannot convert javascript `undefined` to ql::datum_t.") 637 /* r.do(1, 2, r.js('(function(a, b, c) { return c; })')) */ 638 639 suite.T().Log("About to run line #174: r.Do(1, 2, r.JS('(function(a, b, c) { return c; })'))") 640 641 runAndAssert(suite.Suite, expected_, r.Do(1, 2, r.JS("(function(a, b, c) { return c; })")), suite.session, r.RunOpts{ 642 GeometryFormat: "raw", 643 GroupFormat: "map", 644 }) 645 suite.T().Log("Finished running line #174") 646 } 647 648 { 649 // control.yaml line #177 650 /* ([2, 3]) */ 651 var expected_ []interface{} = []interface{}{2, 3} 652 /* r.expr([1, 2, 3]).filter(r.js('(function(a) { return a >= 2; })')) */ 653 654 suite.T().Log("About to run line #177: r.Expr([]interface{}{1, 2, 3}).Filter(r.JS('(function(a) { return a >= 2; })'))") 655 656 runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).Filter(r.JS("(function(a) { return a >= 2; })")), suite.session, r.RunOpts{ 657 GeometryFormat: "raw", 658 GroupFormat: "map", 659 }) 660 suite.T().Log("Finished running line #177") 661 } 662 663 { 664 // control.yaml line #180 665 /* ([2, 3, 4]) */ 666 var expected_ []interface{} = []interface{}{2, 3, 4} 667 /* r.expr([1, 2, 3]).map(r.js('(function(a) { return a + 1; })')) */ 668 669 suite.T().Log("About to run line #180: r.Expr([]interface{}{1, 2, 3}).Map(r.JS('(function(a) { return a + 1; })'))") 670 671 runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).Map(r.JS("(function(a) { return a + 1; })")), suite.session, r.RunOpts{ 672 GeometryFormat: "raw", 673 GroupFormat: "map", 674 }) 675 suite.T().Log("Finished running line #180") 676 } 677 678 { 679 // control.yaml line #183 680 /* err("ReqlQueryLogicError", "Expected type FUNCTION but found DATUM:", [0]) */ 681 var expected_ Err = err("ReqlQueryLogicError", "Expected type FUNCTION but found DATUM:") 682 /* r.expr([1, 2, 3]).map(r.js('1')) */ 683 684 suite.T().Log("About to run line #183: r.Expr([]interface{}{1, 2, 3}).Map(r.JS('1'))") 685 686 runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).Map(r.JS("1")), suite.session, r.RunOpts{ 687 GeometryFormat: "raw", 688 GroupFormat: "map", 689 }) 690 suite.T().Log("Finished running line #183") 691 } 692 693 { 694 // control.yaml line #186 695 /* err("ReqlQueryLogicError", "Cannot convert javascript `undefined` to ql::datum_t.", [0]) */ 696 var expected_ Err = err("ReqlQueryLogicError", "Cannot convert javascript `undefined` to ql::datum_t.") 697 /* r.expr([1, 2, 3]).filter(r.js('(function(a) {})')) */ 698 699 suite.T().Log("About to run line #186: r.Expr([]interface{}{1, 2, 3}).Filter(r.JS('(function(a) {})'))") 700 701 runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).Filter(r.JS("(function(a) {})")), suite.session, r.RunOpts{ 702 GeometryFormat: "raw", 703 GroupFormat: "map", 704 }) 705 suite.T().Log("Finished running line #186") 706 } 707 708 { 709 // control.yaml line #190 710 /* err("ReqlQueryLogicError", "Expected type FUNCTION but found DATUM:", [0]) */ 711 var expected_ Err = err("ReqlQueryLogicError", "Expected type FUNCTION but found DATUM:") 712 /* r.expr([1, 2, 3]).map(1) */ 713 714 suite.T().Log("About to run line #190: r.Expr([]interface{}{1, 2, 3}).Map(1)") 715 716 runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).Map(1), suite.session, r.RunOpts{ 717 GeometryFormat: "raw", 718 GroupFormat: "map", 719 }) 720 suite.T().Log("Finished running line #190") 721 } 722 723 { 724 // control.yaml line #193 725 /* ([1, 2, 3]) */ 726 var expected_ []interface{} = []interface{}{1, 2, 3} 727 /* r.expr([1, 2, 3]).filter('foo') */ 728 729 suite.T().Log("About to run line #193: r.Expr([]interface{}{1, 2, 3}).Filter('foo')") 730 731 runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).Filter("foo"), suite.session, r.RunOpts{ 732 GeometryFormat: "raw", 733 GroupFormat: "map", 734 }) 735 suite.T().Log("Finished running line #193") 736 } 737 738 { 739 // control.yaml line #195 740 /* ([1, 2, 4]) */ 741 var expected_ []interface{} = []interface{}{1, 2, 4} 742 /* r.expr([1, 2, 4]).filter([]) */ 743 744 suite.T().Log("About to run line #195: r.Expr([]interface{}{1, 2, 4}).Filter([]interface{}{})") 745 746 runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 4}).Filter([]interface{}{}), suite.session, r.RunOpts{ 747 GeometryFormat: "raw", 748 GroupFormat: "map", 749 }) 750 suite.T().Log("Finished running line #195") 751 } 752 753 { 754 // control.yaml line #197 755 /* ([]) */ 756 var expected_ []interface{} = []interface{}{} 757 /* r.expr([1, 2, 3]).filter(null) */ 758 759 suite.T().Log("About to run line #197: r.Expr([]interface{}{1, 2, 3}).Filter(nil)") 760 761 runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).Filter(nil), suite.session, r.RunOpts{ 762 GeometryFormat: "raw", 763 GroupFormat: "map", 764 }) 765 suite.T().Log("Finished running line #197") 766 } 767 768 { 769 // control.yaml line #200 770 /* ([]) */ 771 var expected_ []interface{} = []interface{}{} 772 /* r.expr([1, 2, 4]).filter(False) */ 773 774 suite.T().Log("About to run line #200: r.Expr([]interface{}{1, 2, 4}).Filter(false)") 775 776 runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 4}).Filter(false), suite.session, r.RunOpts{ 777 GeometryFormat: "raw", 778 GroupFormat: "map", 779 }) 780 suite.T().Log("Finished running line #200") 781 } 782 783 { 784 // control.yaml line #205 785 /* 0 */ 786 var expected_ int = 0 787 /* tbl.count() */ 788 789 suite.T().Log("About to run line #205: tbl.Count()") 790 791 runAndAssert(suite.Suite, expected_, tbl.Count(), suite.session, r.RunOpts{ 792 GeometryFormat: "raw", 793 GroupFormat: "map", 794 }) 795 suite.T().Log("Finished running line #205") 796 } 797 798 { 799 // control.yaml line #210 800 /* ({'deleted':0.0,'replaced':0.0,'unchanged':0.0,'errors':0.0,'skipped':0.0,'inserted':3}) */ 801 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} 802 /* r.expr([1, 2, 3]).for_each(lambda row:tbl.insert({ 'id':row })) */ 803 804 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, })})") 805 806 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{ 807 GeometryFormat: "raw", 808 GroupFormat: "map", 809 }) 810 suite.T().Log("Finished running line #210") 811 } 812 813 { 814 // control.yaml line #214 815 /* 3 */ 816 var expected_ int = 3 817 /* tbl.count() */ 818 819 suite.T().Log("About to run line #214: tbl.Count()") 820 821 runAndAssert(suite.Suite, expected_, tbl.Count(), suite.session, r.RunOpts{ 822 GeometryFormat: "raw", 823 GroupFormat: "map", 824 }) 825 suite.T().Log("Finished running line #214") 826 } 827 828 { 829 // control.yaml line #219 830 /* ({'deleted':0.0,'replaced':9,'unchanged':0.0,'errors':0.0,'skipped':0.0,'inserted':0.0}) */ 831 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} 832 /* r.expr([1,2,3]).for_each(lambda row:tbl.update({'foo':row})) */ 833 834 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, })})") 835 836 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{ 837 GeometryFormat: "raw", 838 GroupFormat: "map", 839 }) 840 suite.T().Log("Finished running line #219") 841 } 842 843 { 844 // control.yaml line #225 845 /* {'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} */ 846 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} 847 /* r.expr([1,2,3]).for_each(lambda row:[tbl.insert({ 'id':row }), tbl.insert({ 'id':row*10 })]) */ 848 849 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), })}})") 850 851 runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).ForEach(func(row r.Term) interface{} { 852 return []interface{}{tbl.Insert(map[interface{}]interface{}{"id": row}), tbl.Insert(map[interface{}]interface{}{"id": r.Mul(row, 10)})} 853 }), suite.session, r.RunOpts{ 854 GeometryFormat: "raw", 855 GroupFormat: "map", 856 }) 857 suite.T().Log("Finished running line #225") 858 } 859 860 { 861 // control.yaml line #229 862 /* 6 */ 863 var expected_ int = 6 864 /* tbl.count() */ 865 866 suite.T().Log("About to run line #229: tbl.Count()") 867 868 runAndAssert(suite.Suite, expected_, tbl.Count(), suite.session, r.RunOpts{ 869 GeometryFormat: "raw", 870 GroupFormat: "map", 871 }) 872 suite.T().Log("Finished running line #229") 873 } 874 875 // control.yaml line #232 876 // tableCount = tbl2.count() 877 suite.T().Log("Possibly executing: var tableCount r.Term = tbl2.Count()") 878 879 tableCount := maybeRun(tbl2.Count(), suite.session, r.RunOpts{}) 880 _ = tableCount // Prevent any noused variable errors 881 882 { 883 // control.yaml line #233 884 /* ({'deleted':0.0,'replaced':0.0,'generated_keys':arrlen(3,uuid()),'unchanged':0.0,'errors':0.0,'skipped':0.0,'inserted':3}) */ 885 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} 886 /* r.expr([1, 2, 3]).for_each( tbl2.insert({}) ) */ 887 888 suite.T().Log("About to run line #233: r.Expr([]interface{}{1, 2, 3}).ForEach(tbl2.Insert(map[interface{}]interface{}{}))") 889 890 runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).ForEach(tbl2.Insert(map[interface{}]interface{}{})), suite.session, r.RunOpts{ 891 GeometryFormat: "raw", 892 GroupFormat: "map", 893 }) 894 suite.T().Log("Finished running line #233") 895 } 896 897 { 898 // control.yaml line #241 899 /* ({'deleted':0.0,'replaced':36,'unchanged':0.0,'errors':0.0,'skipped':0.0,'inserted':0.0}) */ 900 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} 901 /* r.expr([1,2,3]).for_each(lambda row:[tbl.update({'foo':row}), tbl.update({'bar':row})]) */ 902 903 suite.T().Log("About to run line #241: 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, })}})") 904 905 runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).ForEach(func(row r.Term) interface{} { 906 return []interface{}{tbl.Update(map[interface{}]interface{}{"foo": row}), tbl.Update(map[interface{}]interface{}{"bar": row})} 907 }), suite.session, r.RunOpts{ 908 GeometryFormat: "raw", 909 GroupFormat: "map", 910 }) 911 suite.T().Log("Finished running line #241") 912 } 913 914 { 915 // control.yaml line #246 916 /* ({'deleted':0.0,'replaced':0.0,'unchanged':0.0,'errors':0.0,'skipped':0.0,'inserted':3}) */ 917 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} 918 /* r.expr([1, 2, 3]).for_each( tbl2.insert({ 'id':r.row }) ) */ 919 920 suite.T().Log("About to run line #246: r.Expr([]interface{}{1, 2, 3}).ForEach(tbl2.Insert(map[interface{}]interface{}{'id': r.Row, }))") 921 922 runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).ForEach(tbl2.Insert(map[interface{}]interface{}{"id": r.Row})), suite.session, r.RunOpts{ 923 GeometryFormat: "raw", 924 GroupFormat: "map", 925 }) 926 suite.T().Log("Finished running line #246") 927 } 928 929 { 930 // control.yaml line #250 931 /* err("ReqlQueryLogicError", "FOR_EACH expects one or more basic write queries. Expected type ARRAY but found NUMBER.", [0]) */ 932 var expected_ Err = err("ReqlQueryLogicError", "FOR_EACH expects one or more basic write queries. Expected type ARRAY but found NUMBER.") 933 /* r.expr([1, 2, 3]).for_each(1) */ 934 935 suite.T().Log("About to run line #250: r.Expr([]interface{}{1, 2, 3}).ForEach(1)") 936 937 runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).ForEach(1), suite.session, r.RunOpts{ 938 GeometryFormat: "raw", 939 GroupFormat: "map", 940 }) 941 suite.T().Log("Finished running line #250") 942 } 943 944 { 945 // control.yaml line #253 946 /* err("ReqlQueryLogicError", "FOR_EACH expects one or more basic write queries. Expected type ARRAY but found NUMBER.", [1, 1]) */ 947 var expected_ Err = err("ReqlQueryLogicError", "FOR_EACH expects one or more basic write queries. Expected type ARRAY but found NUMBER.") 948 /* r.expr([1, 2, 3]).for_each(lambda x:x) */ 949 950 suite.T().Log("About to run line #253: r.Expr([]interface{}{1, 2, 3}).ForEach(func(x r.Term) interface{} { return x})") 951 952 runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).ForEach(func(x r.Term) interface{} { return x }), suite.session, r.RunOpts{ 953 GeometryFormat: "raw", 954 GroupFormat: "map", 955 }) 956 suite.T().Log("Finished running line #253") 957 } 958 959 { 960 // control.yaml line #258 961 /* err("ReqlQueryLogicError", "FOR_EACH expects one or more basic write queries. Expected type ARRAY but found NUMBER.", [1, 1]) */ 962 var expected_ Err = err("ReqlQueryLogicError", "FOR_EACH expects one or more basic write queries. Expected type ARRAY but found NUMBER.") 963 /* r.expr([1, 2, 3]).for_each(r.row) */ 964 965 suite.T().Log("About to run line #258: r.Expr([]interface{}{1, 2, 3}).ForEach(r.Row)") 966 967 runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).ForEach(r.Row), suite.session, r.RunOpts{ 968 GeometryFormat: "raw", 969 GroupFormat: "map", 970 }) 971 suite.T().Log("Finished running line #258") 972 } 973 974 { 975 // control.yaml line #263 976 /* err("ReqlQueryLogicError", "FOR_EACH expects one or more basic write queries.", [1, 1]) */ 977 var expected_ Err = err("ReqlQueryLogicError", "FOR_EACH expects one or more basic write queries.") 978 /* r.expr([1, 2, 3]).for_each(lambda row:tbl) */ 979 980 suite.T().Log("About to run line #263: r.Expr([]interface{}{1, 2, 3}).ForEach(func(row r.Term) interface{} { return tbl})") 981 982 runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).ForEach(func(row r.Term) interface{} { return tbl }), suite.session, r.RunOpts{ 983 GeometryFormat: "raw", 984 GroupFormat: "map", 985 }) 986 suite.T().Log("Finished running line #263") 987 } 988 989 { 990 // control.yaml line #272 991 /* ({'deleted':0.0,'replaced':0.0,'generated_keys':arrlen(1,uuid()),'unchanged':0.0,'errors':0.0,'skipped':0.0,'inserted':1}) */ 992 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} 993 /* r.expr(1).do(tbl.insert({'foo':r.row})) */ 994 995 suite.T().Log("About to run line #272: r.Expr(1).Do(tbl.Insert(map[interface{}]interface{}{'foo': r.Row, }))") 996 997 runAndAssert(suite.Suite, expected_, r.Expr(1).Do(tbl.Insert(map[interface{}]interface{}{"foo": r.Row})), suite.session, r.RunOpts{ 998 GeometryFormat: "raw", 999 GroupFormat: "map", 1000 }) 1001 suite.T().Log("Finished running line #272") 1002 } 1003 1004 { 1005 // control.yaml line #276 1006 /* ({'deleted':0.0,'replaced':0.0,'generated_keys':arrlen(1,uuid()),'unchanged':0.0,'errors':0.0,'skipped':0.0,'inserted':1}) */ 1007 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} 1008 /* r.expr([1, 2])[0].do(tbl.insert({'foo':r.row})) */ 1009 1010 suite.T().Log("About to run line #276: r.Expr([]interface{}{1, 2}).AtIndex(0).Do(tbl.Insert(map[interface{}]interface{}{'foo': r.Row, }))") 1011 1012 runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2}).AtIndex(0).Do(tbl.Insert(map[interface{}]interface{}{"foo": r.Row})), suite.session, r.RunOpts{ 1013 GeometryFormat: "raw", 1014 GroupFormat: "map", 1015 }) 1016 suite.T().Log("Finished running line #276") 1017 } 1018 1019 { 1020 // control.yaml line #281 1021 /* err('ReqlCompileError', 'Cannot nest writes or meta ops in stream operations. Use FOR_EACH instead.', [0]) */ 1022 var expected_ Err = err("ReqlCompileError", "Cannot nest writes or meta ops in stream operations. Use FOR_EACH instead.") 1023 /* r.expr([1, 2]).map(tbl.insert({'foo':r.row})) */ 1024 1025 suite.T().Log("About to run line #281: r.Expr([]interface{}{1, 2}).Map(tbl.Insert(map[interface{}]interface{}{'foo': r.Row, }))") 1026 1027 runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2}).Map(tbl.Insert(map[interface{}]interface{}{"foo": r.Row})), suite.session, r.RunOpts{ 1028 GeometryFormat: "raw", 1029 GroupFormat: "map", 1030 }) 1031 suite.T().Log("Finished running line #281") 1032 } 1033 1034 { 1035 // control.yaml line #285 1036 /* err('ReqlCompileError', 'Cannot nest writes or meta ops in stream operations. Use FOR_EACH instead.', [0]) */ 1037 var expected_ Err = err("ReqlCompileError", "Cannot nest writes or meta ops in stream operations. Use FOR_EACH instead.") 1038 /* r.expr([1, 2]).map(r.db('test').table_create('table_create_failure')) */ 1039 1040 suite.T().Log("About to run line #285: r.Expr([]interface{}{1, 2}).Map(r.DB('test').TableCreate('table_create_failure'))") 1041 1042 runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2}).Map(r.DB("test").TableCreate("table_create_failure")), suite.session, r.RunOpts{ 1043 GeometryFormat: "raw", 1044 GroupFormat: "map", 1045 }) 1046 suite.T().Log("Finished running line #285") 1047 } 1048 1049 { 1050 // control.yaml line #288 1051 /* err('ReqlCompileError', 'Cannot nest writes or meta ops in stream operations. Use FOR_EACH instead.', [0]) */ 1052 var expected_ Err = err("ReqlCompileError", "Cannot nest writes or meta ops in stream operations. Use FOR_EACH instead.") 1053 /* r.expr([1, 2]).map(tbl.insert({'foo':r.row}).get_field('inserted')) */ 1054 1055 suite.T().Log("About to run line #288: r.Expr([]interface{}{1, 2}).Map(tbl.Insert(map[interface{}]interface{}{'foo': r.Row, }).Field('inserted'))") 1056 1057 runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2}).Map(tbl.Insert(map[interface{}]interface{}{"foo": r.Row}).Field("inserted")), suite.session, r.RunOpts{ 1058 GeometryFormat: "raw", 1059 GroupFormat: "map", 1060 }) 1061 suite.T().Log("Finished running line #288") 1062 } 1063 1064 { 1065 // control.yaml line #292 1066 /* err('ReqlCompileError', 'Cannot nest writes or meta ops in stream operations. Use FOR_EACH instead.', [0]) */ 1067 var expected_ Err = err("ReqlCompileError", "Cannot nest writes or meta ops in stream operations. Use FOR_EACH instead.") 1068 /* r.expr([1, 2]).map(tbl.insert({'foo':r.row}).get_field('inserted').add(5)) */ 1069 1070 suite.T().Log("About to run line #292: r.Expr([]interface{}{1, 2}).Map(tbl.Insert(map[interface{}]interface{}{'foo': r.Row, }).Field('inserted').Add(5))") 1071 1072 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{ 1073 GeometryFormat: "raw", 1074 GroupFormat: "map", 1075 }) 1076 suite.T().Log("Finished running line #292") 1077 } 1078 1079 { 1080 // control.yaml line #296 1081 /* partial({'tables_created':1}) */ 1082 var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1}) 1083 /* r.expr(1).do(r.db('test').table_create('table_create_success')) */ 1084 1085 suite.T().Log("About to run line #296: r.Expr(1).Do(r.DB('test').TableCreate('table_create_success'))") 1086 1087 runAndAssert(suite.Suite, expected_, r.Expr(1).Do(r.DB("test").TableCreate("table_create_success")), suite.session, r.RunOpts{ 1088 GeometryFormat: "raw", 1089 GroupFormat: "map", 1090 }) 1091 suite.T().Log("Finished running line #296") 1092 } 1093 1094 { 1095 // control.yaml line #300 1096 /* [1, 2] */ 1097 var expected_ []interface{} = []interface{}{1, 2} 1098 /* r.expr([1, 2]) */ 1099 1100 suite.T().Log("About to run line #300: r.Expr([]interface{}{1, 2})") 1101 1102 runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2}), suite.session, r.RunOpts{ 1103 GeometryFormat: "raw", 1104 GroupFormat: "map", 1105 ReadMode: []interface{}{"a", "b"}, 1106 }) 1107 suite.T().Log("Finished running line #300") 1108 } 1109 }