我必须验证一个json是否最后包含另一个json,例如此测试:
def subset = { bar: { foo: 'xxx' }}
def superset = { bar: { foo: 'xxx', baz: 'yyy' }}
match superset contains subset
如果失败,是正确的吗?
path: $.bar, actual: {foo=xxx, baz=yyy}, expected: {foo=xxx}, reason: actual value has 1 more key(s) than expected: {baz=yyy}
谢谢
答案 0 :(得分:0)
您在这里:
* def part = { foo: 'xxx' }
* def superset = { bar: { foo: 'xxx', baz: 'yyy' } }
* match superset == { bar: '#(^part)' }