unit tests for stringToFormat