Skip to content

Commit

Permalink
additional tweak for #826 replaces #863
Browse files Browse the repository at this point in the history
  • Loading branch information
ptrthomas committed Aug 20, 2019
1 parent 9b46178 commit baf0cf9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions karate-core/src/main/java/com/intuit/karate/Script.java
Original file line number Diff line number Diff line change
Expand Up @@ -1339,6 +1339,14 @@ public static AssertionResult matchNestedObject(char delimiter, String path, Mat
if (matchType == MatchType.CONTAINS_ANY) {
return AssertionResult.PASS; // exit early
}
if (matchType == MatchType.NOT_CONTAINS) {
// did we just bubble-up from a map
ScriptValue childExpValue = new ScriptValue(childExp);
if (childExpValue.isMapLike()) {
// a nested map already fulfilled the NOT_CONTAINS
return AssertionResult.PASS; // exit early
}
}
unMatchedKeysExp.remove(key);
unMatchedKeysAct.remove(key);
} else { // values for this key don't match
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,11 @@ Scenario: contains will recurse
* def expected = { a: 1, c: 3, d: { b: 2 } }
* match original contains expected

Scenario: contains will recurse in reverse !
* def original = { "a": { "b": { "c": { "d":1, "e":2 } } } }
* def compared = { "a": { "b": { "c": { "d":1, "e":2, "f":3 } } } }
* match original !contains compared

Scenario: js eval
* def temperature = { celsius: 100, fahrenheit: 212 }
* string expression = 'temperature.celsius'
Expand Down

0 comments on commit baf0cf9

Please sign in to comment.