Writing a pack function with a test