mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-02-11 05:31:09 +00:00
94 lines
8.0 KiB
YAML
94 lines
8.0 KiB
YAML
desc: Tests replacement of selections
|
|
table_variable_name: tbl
|
|
tests:
|
|
|
|
# old version of argument
|
|
- cd: tbl.insert({'id':0}, :return_vals => true).pluck('changes', 'first_error')
|
|
py: tbl.insert({'id':0}, return_vals=True).pluck('changes', 'first_error')
|
|
js: tbl.insert({'id':0}, {'return_vals':true}).pluck('changes', 'first__error')
|
|
ot: err("ReqlQueryLogicError", "Error:"+" encountered obsolete optarg `return_vals`. Use `return_changes` instead.", [0])
|
|
|
|
- cd: tbl.insert({'id':0}, :return_changes => true).pluck('changes', 'first_error')
|
|
py: tbl.insert({'id':0}, return_changes=True).pluck('changes', 'first_error')
|
|
js: tbl.insert({'id':0}, {'return__changes':true}).pluck('changes', 'first__error')
|
|
ot: ({'changes':[{'old_val':null,'new_val':{'id':0}}]})
|
|
- cd: tbl.insert({'id':0}, :return_changes => true).pluck('changes', 'first_error')
|
|
py: tbl.insert({'id':0}, return_changes=True).pluck('changes', 'first_error')
|
|
js: tbl.insert({'id':0}, {'return__changes':true}).pluck('changes', 'first__error')
|
|
ot: ({'changes':[], 'first_error':"Duplicate primary key `id`:\n{\n\t\"id\":\t0\n}\n{\n\t\"id\":\t0\n}"})
|
|
- cd: tbl.insert({'id':0}, return_changes:'always').pluck('changes', 'first_error')
|
|
py: tbl.insert({'id':0}, return_changes='always').pluck('changes', 'first_error')
|
|
js: tbl.insert({'id':0}, {'return__changes':'always'}).pluck('changes', 'first__error')
|
|
ot: ({'first_error':"Duplicate primary key `id`:\n{\n\t\"id\":\t0\n}\n{\n\t\"id\":\t0\n}",'changes':[{'old_val':{'id':0},'new_val':{'id':0},'error':"Duplicate primary key `id`:\n{\n\t\"id\":\t0\n}\n{\n\t\"id\":\t0\n}"}]})
|
|
- cd: tbl.insert([{'id':1}], :return_changes => true)
|
|
py: tbl.insert([{'id':1}], return_changes=True)
|
|
js: tbl.insert([{'id':1}], {'return__changes':true})
|
|
ot: ({'changes':[{'new_val':{'id':1},'old_val':null}], 'errors':0, 'deleted':0, 'unchanged':0, 'skipped':0, 'replaced':0, 'inserted':1})
|
|
- cd: tbl.insert([{'id':0}], :return_changes => true).pluck('changes', 'first_error')
|
|
py: tbl.insert([{'id':0}], return_changes=True).pluck('changes', 'first_error')
|
|
js: tbl.insert([{'id':0}], {'return__changes':true}).pluck('changes', 'first__error')
|
|
ot: ({'changes':[],'first_error':"Duplicate primary key `id`:\n{\n\t\"id\":\t0\n}\n{\n\t\"id\":\t0\n}"})
|
|
|
|
- cd: tbl.get(0).update({'x':1}, :return_changes => true).pluck('changes', 'first_error')
|
|
py: tbl.get(0).update({'x':1}, return_changes=True).pluck('changes', 'first_error')
|
|
js: tbl.get(0).update({'x':1}, {'return__changes':true}).pluck('changes', 'first__error')
|
|
ot: ({'changes':[{'old_val':{'id':0},'new_val':{'id':0,'x':1}}]})
|
|
- cd: tbl.get(0).update({'x':r.error("a")}, :return_changes => true).pluck('changes', 'first_error')
|
|
py: tbl.get(0).update({'x':r.error("a")}, return_changes=True).pluck('changes', 'first_error')
|
|
js: tbl.get(0).update({'x':r.error("a")}, {'return__changes':true}).pluck('changes', 'first__error')
|
|
ot: ({'changes':[],'first_error':'a'})
|
|
- rb: tbl.update({'x':3}, :return_changes => true).pluck('changes', 'first_error').do {|d| d.merge({:changes => d['changes'].order_by {|a| a['old_val']['id']}})}
|
|
py: tbl.update({'x':3}, return_changes=True).pluck('changes', 'first_error').do(lambda d:d.merge({'changes':d['changes'].order_by(lambda a:a['old_val']['id'])}))
|
|
js: tbl.update({'x':3}, {'return__changes':true}).pluck('changes', 'first__error').do(function(p){return p.merge({'changes':p('changes').orderBy(function(a){return a('old__val')('id')})})})
|
|
ot: ({'changes':[{'old_val':{'id':0, 'x':1},'new_val':{'id':0, 'x':3}}, {'old_val':{'id':1},'new_val':{'id':1, 'x':3}}]})
|
|
|
|
- cd: tbl.get(0).replace({'id':0,'x':2}, :return_changes => true).pluck('changes', 'first_error')
|
|
py: tbl.get(0).replace({'id':0,'x':2}, return_changes=True).pluck('changes', 'first_error')
|
|
js: tbl.get(0).replace({'id':0,'x':2}, {'return__changes':true}).pluck('changes', 'first__error')
|
|
ot: ({'changes':[{'old_val':{'id':0,'x':3},'new_val':{'id':0,'x':2}}]})
|
|
- cd: tbl.get(0).replace(:return_changes => true){{'x':r.error('a')}}.pluck('changes', 'first_error')
|
|
py: tbl.get(0).replace(lambda y:{'x':r.error('a')}, return_changes=True).pluck('changes', 'first_error')
|
|
js: tbl.get(0).replace(function(y){return {'x':r.error('a')}}, {'return__changes':true}).pluck('changes', 'first__error')
|
|
ot: ({'changes':[],'first_error':'a'})
|
|
- cd: tbl.get(0).replace(:return_changes => 'always'){{'x':r.error('a')}}.pluck('changes', 'first_error')
|
|
py: tbl.get(0).replace(lambda y:{'x':r.error('a')}, return_changes='always').pluck('changes', 'first_error')
|
|
js: tbl.get(0).replace(function(y){return {'x':r.error('a')}}, {'return__changes':'always'}).pluck('changes', 'first__error')
|
|
ot: ({'first_error':'a','changes':[{'old_val':{'id':0,'x':2},'new_val':{'id':0,'x':2},'error':'a'}]})
|
|
- rb: tbl.replace( :return_changes => true) { |d| d.without('x')}.pluck('changes', 'first_error').do {|d| d.merge({:changes => d['changes'].order_by {|a| a['old_val']['id']}})}
|
|
py: tbl.replace(lambda y:y.without('x'), return_changes=True).pluck('changes', 'first_error').do(lambda d:d.merge({'changes':d['changes'].order_by(lambda a:a['old_val']['id'])}))
|
|
js: tbl.replace(function(p){return p.without('x')}, {'return__changes':true}).pluck('changes', 'first__error').do(function(p){return p.merge({'changes':p('changes').orderBy(function(a){return a('old__val')('id')})})})
|
|
ot: ({'changes':[{'new_val':{'id':0},'old_val':{'id':0, 'x':2}}, {'new_val':{'id':1},'old_val':{'id':1,'x':3}}]})
|
|
- rb: tbl.replace({'x':1}, :return_changes => 'always').pluck('changes', 'first_error').do {|d| d.merge({:changes => d['changes'].order_by {|a| a['old_val']['id']}})}
|
|
py: tbl.replace({'x':1}, return_changes='always').pluck('changes', 'first_error').do(lambda d:d.merge({'changes':d['changes'].order_by(lambda a:a['old_val']['id'])}))
|
|
js: tbl.replace({'x':1}, {'return__changes':'always'}).pluck('changes', 'first__error').do(function(p){return p.merge({'changes':p('changes').orderBy(function(a){return a('old__val')('id')})})})
|
|
ot: ({'first_error':"Inserted object must have primary key `id`:\n{\n\t\"x\":\t1\n}", 'changes':[{'new_val':{'id':0},'old_val':{'id':0}, 'error':"Inserted object must have primary key `id`:\n{\n\t\"x\":\t1\n}"}, {'new_val':{'id':1},'old_val':{'id':1},'error':"Inserted object must have primary key `id`:\n{\n\t\"x\":\t1\n}"}]})
|
|
|
|
- rb: tbl.foreach{|row| [tbl.get(0).update(null, :return_changes => true), tbl.get(0).update({a:1}, :return_changes => true)]}.pluck('changes', 'first_error').do {|d| d.merge({:changes => d['changes'].order_by {|a| a['old_val']['id']}})}
|
|
ot: ({'changes':[{"new_val"=>{"a"=>1, "id"=>0}, "old_val"=>{"id"=>0}}]})
|
|
- rb: tbl.get(0).update({a:r.literal()})['replaced']
|
|
ot: 1
|
|
|
|
- rb: tbl.get(0).update({}).pluck('changes')
|
|
ot: ({})
|
|
- rb: tbl.get(0).update({}, return_changes:true).pluck('changes')
|
|
ot: ({'changes':[]})
|
|
- rb: tbl.get(0).update({}, return_changes:'always').pluck('changes')
|
|
ot: ({'changes':[{'new_val':{'id':0}, 'old_val':{'id':0}}]})
|
|
|
|
- rb: tbl.get(-1).update({}).pluck('changes')
|
|
ot: ({})
|
|
- rb: tbl.get(-1).update({}, return_changes:true).pluck('changes')
|
|
ot: ({'changes':[]})
|
|
- rb: tbl.get(-1).update({}, return_changes:'always').pluck('changes')
|
|
ot: ({'changes':[{'new_val':null, 'old_val':null}]})
|
|
|
|
- cd: tbl.get(0).delete(:return_changes => true).pluck('changes', 'first_error')
|
|
py: tbl.get(0).delete(return_changes=True).pluck('changes', 'first_error')
|
|
js: tbl.get(0).delete({'return__changes':true}).pluck('changes', 'first__error')
|
|
ot: ({'changes':[{'old_val':{'id':0},'new_val':null}]})
|
|
- cd: tbl.delete(:return_changes => true)
|
|
py: tbl.delete(return_changes=True)
|
|
js: tbl.delete({'return__changes':true})
|
|
ot: ({'deleted':1,'errors':0,'inserted':0,'replaced':0,'skipped':0,'unchanged':0,'changes':[{'new_val':null, 'old_val':{'id':1}}]})
|
|
|