summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-06-23 11:18:01 +0100
committerMatthew Pickering <matthewtpickering@gmail.com>2021-06-23 11:21:07 +0100
commitf87bd555f629b5625481b95111336717e9478f5a (patch)
treed7dcba47e49a839fe0cedc719fdb46956e98ee42
parent633bbc1fd4762a2bb73ba1c5b9e0c279f1dd3c40 (diff)
downloadhaskell-wip/t17481.tar.gz
driver: Add test for #17481wip/t17481
Fixed in 25977ab542a30df4ae71d9699d015bcdd1ab7cfb Fixes #17481
-rw-r--r--testsuite/tests/driver/Makefile21
-rw-r--r--testsuite/tests/driver/T17481.stdout15
-rw-r--r--testsuite/tests/driver/all.T1
3 files changed, 37 insertions, 0 deletions
diff --git a/testsuite/tests/driver/Makefile b/testsuite/tests/driver/Makefile
index 0242b1aed4..6016ab92f3 100644
--- a/testsuite/tests/driver/Makefile
+++ b/testsuite/tests/driver/Makefile
@@ -685,3 +685,24 @@ OneShotTH:
"$(TEST_HC)" $(TEST_HC_OPTS) -c OneShotTH.hs
# The module should *not* be recompiled
"$(TEST_HC)" $(TEST_HC_OPTS) -c OneShotTH.hs
+
+T17481:
+ echo 'main = putStrLn "Hello from A"' > A.hs
+ echo 'main = putStrLn "Hello from B"' > B.hs
+
+ ln -f A.hs Main.hs
+ echo "Main.hs is now:"
+ cat Main.hs
+ echo "Compiling and running Main.hs:"
+ $(TEST_HC) $(TEST_HC_OPTS) Main.hs && ./Main
+
+ ln -f B.hs Main.hs
+ echo "Main.hs is now:"
+ cat Main.hs
+ echo "Compiling and running Main.hs:"
+ $(TEST_HC) $(TEST_HC_OPTS) Main.hs && ./Main
+
+ echo "Touching Main.hs"
+ touch Main.hs
+ echo "Compiling and running Main.hs:"
+ $(TEST_HC) $(TEST_HC_OPTS) Main.hs && ./Main
diff --git a/testsuite/tests/driver/T17481.stdout b/testsuite/tests/driver/T17481.stdout
new file mode 100644
index 0000000000..885dac3986
--- /dev/null
+++ b/testsuite/tests/driver/T17481.stdout
@@ -0,0 +1,15 @@
+Main.hs is now:
+main = putStrLn "Hello from A"
+Compiling and running Main.hs:
+[1 of 1] Compiling Main ( Main.hs, Main.o )
+Linking Main ...
+Hello from A
+Main.hs is now:
+main = putStrLn "Hello from B"
+Compiling and running Main.hs:
+[1 of 1] Compiling Main ( Main.hs, Main.o ) [Source file changed]
+Linking Main ...
+Hello from B
+Touching Main.hs
+Compiling and running Main.hs:
+Hello from B
diff --git a/testsuite/tests/driver/all.T b/testsuite/tests/driver/all.T
index 1c64f9905a..6fa78378ce 100644
--- a/testsuite/tests/driver/all.T
+++ b/testsuite/tests/driver/all.T
@@ -290,3 +290,4 @@ test('T17786', unless(opsys('mingw32'), skip), makefile_test, [])
test('T18369', normal, compile, ['-O'])
test('FullGHCVersion', normal, compile_and_run, ['-package ghc-boot'])
test('OneShotTH', normal, makefile_test, [])
+test('T17481', normal, makefile_test, [])