diff options
author | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2019-01-17 16:57:20 +0300 |
---|---|---|
committer | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2019-01-17 16:57:20 +0300 |
commit | a1e9cd6af8b41fa451fd3be806f4aced0040a14c (patch) | |
tree | 7538fcc8eaf3f0c0b62c05c0a76cb11eaa66f2fa /testsuite | |
parent | 6aaa0655a721605740f23e49c5b4bf6165bfe865 (diff) | |
download | haskell-a1e9cd6af8b41fa451fd3be806f4aced0040a14c.tar.gz |
Add test for #16197wip/T16197
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/stranal/should_run/Makefile | 8 | ||||
-rw-r--r-- | testsuite/tests/stranal/should_run/T16197.hs | 25 | ||||
-rw-r--r-- | testsuite/tests/stranal/should_run/T16197.stdout | 2 | ||||
-rw-r--r-- | testsuite/tests/stranal/should_run/all.T | 5 |
4 files changed, 39 insertions, 1 deletions
diff --git a/testsuite/tests/stranal/should_run/Makefile b/testsuite/tests/stranal/should_run/Makefile index 9101fbd40a..dae01b4bb5 100644 --- a/testsuite/tests/stranal/should_run/Makefile +++ b/testsuite/tests/stranal/should_run/Makefile @@ -1,3 +1,11 @@ TOP=../../.. include $(TOP)/mk/boilerplate.mk include $(TOP)/mk/test.mk + +.PHONY: T16197 +T16197: + '$(TEST_HC)' -O0 -v0 T16197.hs + ./T16197 + rm T16197.o T16197.hi T16197 + '$(TEST_HC)' -O1 -v0 T16197.hs + ./T16197 diff --git a/testsuite/tests/stranal/should_run/T16197.hs b/testsuite/tests/stranal/should_run/T16197.hs new file mode 100644 index 0000000000..a1ab333d10 --- /dev/null +++ b/testsuite/tests/stranal/should_run/T16197.hs @@ -0,0 +1,25 @@ +import System.IO.Unsafe (unsafePerformIO) + +data T = T !Bool +data Box a = Box a + +f :: Int -> T -> Box Bool +f n t + | n <= 0 = case t of + T b -> Box b + | otherwise = f (n-2) t + +f1 :: Int -> Bool -> Box Bool +f1 n t + | n <= 0 = f (-n) $! T t + | otherwise = f1 (n-2) t + +g :: Int -> Bool +g k = if k <= 0 + then unsafePerformIO (putStrLn "Evaluated True" >> return True) + else unsafePerformIO (putStrLn "Evaluated False" >> return False) +{-# NOINLINE g #-} + +main :: IO () +main = case f1 4 (g 0) of + Box _ -> return () diff --git a/testsuite/tests/stranal/should_run/T16197.stdout b/testsuite/tests/stranal/should_run/T16197.stdout new file mode 100644 index 0000000000..0eb67824f7 --- /dev/null +++ b/testsuite/tests/stranal/should_run/T16197.stdout @@ -0,0 +1,2 @@ +Evaluated True +Evaluated True diff --git a/testsuite/tests/stranal/should_run/all.T b/testsuite/tests/stranal/should_run/all.T index a9cc3d7071..51b1e41143 100644 --- a/testsuite/tests/stranal/should_run/all.T +++ b/testsuite/tests/stranal/should_run/all.T @@ -1,4 +1,7 @@ -# Optimised only, we're testing the strictness analyser here +# Run this always +test('T16197', normal, run_command, ['$MAKE -s --no-print-directory T16197']) + +# Run the rest only in optasm way, we're testing the strictness analyser here setTestOpts( only_ways(['optasm']) ) test('strun001', normal, compile_and_run, ['']) |