summaryrefslogtreecommitdiff
path: root/ext/librethinkdbxx/test/upstream/polymorphism.yaml
blob: 14817289d46405df5f55671dcc68ca2934adeefd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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})