summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-06-23 11:53:57 +0100
committerMatthew Pickering <matthewtpickering@gmail.com>2021-06-23 11:56:42 +0100
commit7eeed192736ced0245388823a3968cac9a12ebdb (patch)
treefdd06182dfbacf90bb8851ca95d948a9b1c6560f
parent633bbc1fd4762a2bb73ba1c5b9e0c279f1dd3c40 (diff)
downloadhaskell-wip/t14923.tar.gz
driver: Add test for T14923wip/t14923
Fixes #14923
-rw-r--r--testsuite/tests/driver/Makefile22
-rw-r--r--testsuite/tests/driver/T14923.stdout6
-rw-r--r--testsuite/tests/driver/all.T1
3 files changed, 29 insertions, 0 deletions
diff --git a/testsuite/tests/driver/Makefile b/testsuite/tests/driver/Makefile
index 0242b1aed4..a497f7bc7e 100644
--- a/testsuite/tests/driver/Makefile
+++ b/testsuite/tests/driver/Makefile
@@ -659,6 +659,27 @@ T13604a:
# SHOULD output "compilation is NOT required"
"$(TEST_HC)" $(TEST_HC_OPTS) -v1 -O0 -c -fignore-hpc-changes T13604a.hs
+.PHONY: T14923
+T14923:
+ echo "{-# LANGUAGE UndecidableInstances #-}" > Foo.hs
+ echo "module Foo where" >> Foo.hs
+
+ cat Foo.hs
+
+ $(TEST_HC) $(TEST_HC_OPTS) -c Foo.hs;
+
+ sed -i 's/^{-\#/--&/' Foo.hs # comment out the pragma
+
+ # Check sed actually worked
+ cat Foo.hs
+
+ # This should recompile
+ $(TEST_HC) $(TEST_HC_OPTS) -c Foo.hs;
+ # This should not
+ $(TEST_HC) $(TEST_HC_OPTS) -c Foo.hs;
+ # And this should not
+ $(TEST_HC) $(TEST_HC_OPTS) -c Foo.hs;
+
.PHONY: T12955
T12955:
! "$(TEST_HC)" $(TEST_HC_OPTS) --make T12955
@@ -685,3 +706,4 @@ OneShotTH:
"$(TEST_HC)" $(TEST_HC_OPTS) -c OneShotTH.hs
# The module should *not* be recompiled
"$(TEST_HC)" $(TEST_HC_OPTS) -c OneShotTH.hs
+
diff --git a/testsuite/tests/driver/T14923.stdout b/testsuite/tests/driver/T14923.stdout
new file mode 100644
index 0000000000..0303eb08ee
--- /dev/null
+++ b/testsuite/tests/driver/T14923.stdout
@@ -0,0 +1,6 @@
+{-# LANGUAGE UndecidableInstances #-}
+module Foo where
+--{-# LANGUAGE UndecidableInstances #-}
+module Foo where
+compilation IS NOT required
+compilation IS NOT required
diff --git a/testsuite/tests/driver/all.T b/testsuite/tests/driver/all.T
index 1c64f9905a..29f7368918 100644
--- a/testsuite/tests/driver/all.T
+++ b/testsuite/tests/driver/all.T
@@ -278,6 +278,7 @@ test('inline-check', omit_ways(['hpc', 'profasm'])
, ['-dinline-check foo -O -ddebug-output'])
test('T14452', [], makefile_test, [])
+test('T14923', normal, makefile_test, [])
test('T15396', normal, compile_and_run, ['-package ghc'])
test('T16737',
[extra_files(['T16737include/']),