test: freeze the callstack for better failure messages

This commit is contained in:
Primrose 2025-09-24 17:07:02 +08:00
parent 00a6e11f67
commit 21241d44ed
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA

View file

@ -11,6 +11,7 @@ import Types
import Data.String (IsString (..))
import Data.Text (Text)
import Text.Parsec.Pos
import GHC.Stack
main :: IO ()
main = hspec $ do
@ -185,6 +186,7 @@ instance IsString (Doc String) where
shouldLexTo :: String -> [(Int, Int, Token)] -> Expectation
shouldLexTo input expected =
withFrozenCallStack $
case lexer input of
Right tokens -> do
let actual = map (\(pos, tok) -> (sourceLine pos, sourceColumn pos, tok)) tokens