Adds working tests to charref support issue #495 and #506