tory encoding" ~:
    [ utf8TestValidHist i [ "\ESC[A" ]
        [prompt 0, utf8 "abcα" ]
    , utf8TestInvalidHist i [ "\ESC[A" ]
        -- NB: this is decoded by either utf8-string or base;
        -- either way they produce \65533 instead of '?'.
        [prompt 0, utf8 "abcα\65533x\65533x\65533" ]
    -- In latin-1: read errors as utf-8 '\65533', display as '?'
    , latin1TestInvalidHist i  [ "\ESC[A" ]
        [prompt 0, utf8 "abc??x?x?" ]
    ]

invalidHist :: BC.ByteString
invalidHist =  utf8 "abcα"
 
historyTests :: Invocation -> Test
historyTests i =  "history encoding" ~:
    [ utf8TestValidHist i [ "\ESC[A" ]
        [prompt 0, utf8 "abcα" ]
    , utf8TestInvalidHist i [ "\ESC[A" ]
        -- NB: this is decoded by either utf8-string or base;
        -- either way they produce \65533 instead of '?'.
        [prompt 0, utf8 "abcα\65533x\65533x\65533" ]
    -- In latin-1: read errors as utf-8 '\65533', display as '?'
    , latin1TestInvalidHist i  [ "\ESC[A" ]
        [prompt 0, utf8 "abc??x?x?" ]
    ]
historyTests i =  "history encoding" ~:
    [ utf8TestValidHist i [ "\ESC[A" ]
        [prompt 0, utf8 "abcα" ]
    , utf8TestInvalidHist i [ "\ESC[A" ]
        -- NB: this is decoded by either utf8-string or base;
        -- either way they produce \65533 instead of '?'.
        [prompt 0, utf8 "abcα\65533x\65533x\65533" ]
    -- In latin-1: read errors as utf-8 '\65533', display as '?'
    , latin1TestInvalidHist i  [ "\ESC[A" ]
        [prompt 0, utf8 "abc??x?x?" ]
    ]