Add a test for weak references