Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ FlexUnitCompilerApplication.mxml
*.ipr
*.iws
.project
.idea
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,13 @@ package org.hamcrest.collection
matcher5,
[ "e", "c", "b", "d" ]); // 'a' is missing
}

[Test]
public function matchesAllWithArray() : void{
var matcherArray:Array = [equalTo("a"), equalTo("b"), equalTo("c")];
var matcher:Matcher = hasItems(matcherArray);

assertMatches("should match array containing matchers", matcher, ["a", "b", "c"]);
}
}
}
9 changes: 8 additions & 1 deletion hamcrest/src/org/hamcrest/collection/hasItems.as
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@ package org.hamcrest.collection
*/
public function hasItems(... rest):Matcher
{
return allOf.apply(null, rest.map(hasItemsIterator));
var matchers:Array = rest;

if (rest.length == 1 && rest[0] is Array)
{
matchers = rest[0];
}

return allOf.apply(null, matchers.map(hasItemsIterator));
}
}

Expand Down