Add test cases for metadata detachment (issue #17)