Add test for CTE #486