Fixed bug in the capture logic which could cause it to crash if
the named capture collection exists but isn't a list.
Added capture tests
Added missing test_engine_capture.cpp
Fixed recursion detection in capture
Fixed capture test