summaryrefslogtreecommitdiff
path: root/ext/librethinkdbxx/test/upstream/polymorphism.yaml
diff options
context:
space:
mode:
Diffstat (limited to 'ext/librethinkdbxx/test/upstream/polymorphism.yaml')
-rw-r--r--ext/librethinkdbxx/test/upstream/polymorphism.yaml33
1 files changed, 33 insertions, 0 deletions
diff --git a/ext/librethinkdbxx/test/upstream/polymorphism.yaml b/ext/librethinkdbxx/test/upstream/polymorphism.yaml
new file mode 100644
index 00000000..14817289
--- /dev/null
+++ b/ext/librethinkdbxx/test/upstream/polymorphism.yaml
@@ -0,0 +1,33 @@
+desc: Tests that manipulation data in tables
+table_variable_name: tbl
+tests:
+
+ - def: obj = r.expr({'id':0,'a':0})
+
+ - py: tbl.insert([{'id':i, 'a':i} for i in xrange(3)])
+ js: |
+ tbl.insert(function(){
+ var res = []
+ for (var i = 0; i < 3; i++) {
+ res.push({id:i, 'a':i});
+ }
+ return res;
+ }())
+ rb: tbl.insert((0..2).map{ |i| { :id => i, :a => i } })
+ ot: ({'deleted':0,'replaced':0,'unchanged':0,'errors':0,'skipped':0,'inserted':3})
+
+ # Polymorphism
+ - cd:
+ - tbl.merge({'c':1}).nth(0)
+ - obj.merge({'c':1})
+ ot: ({'id':0,'c':1,'a':0})
+
+ - cd:
+ - tbl.without('a').nth(0)
+ - obj.without('a')
+ ot: ({'id':0})
+
+ - cd:
+ - tbl.pluck('a').nth(0)
+ - obj.pluck('a')
+ ot: ({'a':0})