Add foreign fragment tests

Add tree construction test cases for the fragment parsing algorithm with foreign context elements. Extend the test format to support this case.