Add some tests for derive()