Fixes foreach and adds a test for it.

Unlang's foreach was spinning infinitely.  The cursor was being initialized inside the loop, and pairfindnext returns the same vp on the first call after init.