Test It Before You Trust It: Applying Software Testing for Trustworthy In-context Learning