summaryrefslogtreecommitdiff
path: root/libraries
diff options
context:
space:
mode:
authorPhilip Hazelden <philip.hazelden@gmail.com>2022-03-08 21:09:23 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-04-09 13:02:59 -0400
commit8fafacf7bae432fe20a46265af497b8fb42cbd1c (patch)
tree483cebf1f809ffb9adaf0732f70636e2d5bd152b /libraries
parent6c6c537964c6dc9ed3e8c4a4be68b587a27a3f50 (diff)
downloadhaskell-8fafacf7bae432fe20a46265af497b8fb42cbd1c.tar.gz
Add tests for several trace functions.
Diffstat (limited to 'libraries')
-rw-r--r--libraries/base/tests/all.T1
-rw-r--r--libraries/base/tests/trace.hs12
-rw-r--r--libraries/base/tests/trace.stderr8
-rw-r--r--libraries/base/tests/trace.stdout6
4 files changed, 27 insertions, 0 deletions
diff --git a/libraries/base/tests/all.T b/libraries/base/tests/all.T
index 901b5c91f1..d39b41b92a 100644
--- a/libraries/base/tests/all.T
+++ b/libraries/base/tests/all.T
@@ -262,3 +262,4 @@ test('T18642', extra_run_opts('+RTS -T -RTS'), compile_and_run, ['-O2'])
test('T19288', exit_code(1), compile_and_run, [''])
test('T19719', normal, compile_and_run, [''])
test('T20107', extra_run_opts('+RTS -M50M'), compile_and_run, ['-package bytestring'])
+test('trace', normal, compile_and_run, [''])
diff --git a/libraries/base/tests/trace.hs b/libraries/base/tests/trace.hs
new file mode 100644
index 0000000000..46fdad6dab
--- /dev/null
+++ b/libraries/base/tests/trace.hs
@@ -0,0 +1,12 @@
+import Debug.Trace
+
+main :: IO ()
+main = do
+ putStrLn $ trace "one" "two"
+ putStrLn $ traceShow (3 :: Int) "four"
+ putStrLn $ traceId "five"
+ print $ traceShowId (6 :: Int)
+ putStrLn $ traceWith (take 3) "seven"
+ putStrLn $ traceShowWith length "eight"
+ traceIO "nine"
+ traceM "ten"
diff --git a/libraries/base/tests/trace.stderr b/libraries/base/tests/trace.stderr
new file mode 100644
index 0000000000..5c4a13fbc7
--- /dev/null
+++ b/libraries/base/tests/trace.stderr
@@ -0,0 +1,8 @@
+one
+3
+five
+6
+sev
+5
+nine
+ten
diff --git a/libraries/base/tests/trace.stdout b/libraries/base/tests/trace.stdout
new file mode 100644
index 0000000000..3b5df74e68
--- /dev/null
+++ b/libraries/base/tests/trace.stdout
@@ -0,0 +1,6 @@
+two
+four
+five
+6
+seven
+eight