summaryrefslogtreecommitdiff
path: root/testsuite/tests/rts/decodeMyStack_emptyListForMissingFlag.hs
blob: d30102ed27aafd55c00d3024dd3c442a8f4e3cd6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
module Main where

import GHC.Stack.CloneStack
import System.IO.Unsafe

returnFrame :: Int -> [StackEntry]
returnFrame i = case ( unsafePerformIO $ do
                         stack <- cloneMyStack
                         stackEntries <- decode stack
                         pure (i, stackEntries)
                     ) of
  (1, stackEntries) -> stackEntries
  _ -> []

main :: IO ()
main = do
  assertEqual (returnFrame 1) []
  return ()

assertEqual :: (Eq a, Show a) => a -> a -> IO ()
assertEqual x y =
  if x == y
    then return ()
    else error $ "assertEqual: " ++ show x ++ " /= " ++ show y