From 666b27c79a3d36d0d16899de3bdc2e1e74d0fde6 Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Wed, 23 Jun 2021 10:39:07 +0100 Subject: ghci: Add test for #18330 This test was fixed by 25977ab542a30df4ae71d9699d015bcdd1ab7cfb Fixes #18330 --- testsuite/tests/ghci/scripts/T18330.extra | 1 + testsuite/tests/ghci/scripts/T18330.hs | 5 +++++ testsuite/tests/ghci/scripts/T18330.script | 5 +++++ testsuite/tests/ghci/scripts/T18330.stdout | 8 ++++++++ testsuite/tests/ghci/scripts/all.T | 3 +++ 5 files changed, 22 insertions(+) create mode 100644 testsuite/tests/ghci/scripts/T18330.extra create mode 100644 testsuite/tests/ghci/scripts/T18330.hs create mode 100644 testsuite/tests/ghci/scripts/T18330.script create mode 100644 testsuite/tests/ghci/scripts/T18330.stdout diff --git a/testsuite/tests/ghci/scripts/T18330.extra b/testsuite/tests/ghci/scripts/T18330.extra new file mode 100644 index 0000000000..257cc5642c --- /dev/null +++ b/testsuite/tests/ghci/scripts/T18330.extra @@ -0,0 +1 @@ +foo diff --git a/testsuite/tests/ghci/scripts/T18330.hs b/testsuite/tests/ghci/scripts/T18330.hs new file mode 100644 index 0000000000..a1cf17e9ed --- /dev/null +++ b/testsuite/tests/ghci/scripts/T18330.hs @@ -0,0 +1,5 @@ +{-# LANGUAGE TemplateHaskell #-} +module T18330 where +import Language.Haskell.TH.Syntax + +$(addDependentFile "T18330.extra" >> return []) diff --git a/testsuite/tests/ghci/scripts/T18330.script b/testsuite/tests/ghci/scripts/T18330.script new file mode 100644 index 0000000000..fbb0ca082b --- /dev/null +++ b/testsuite/tests/ghci/scripts/T18330.script @@ -0,0 +1,5 @@ +:l shell.hs +:def shell (\s -> do shell s; return "") +:l T18330.hs +:shell echo "new line" > T18330.extra +:r diff --git a/testsuite/tests/ghci/scripts/T18330.stdout b/testsuite/tests/ghci/scripts/T18330.stdout new file mode 100644 index 0000000000..c020ae7dbb --- /dev/null +++ b/testsuite/tests/ghci/scripts/T18330.stdout @@ -0,0 +1,8 @@ +GHCi, version 9.3.20210616: https://www.haskell.org/ghc/ :? for help +ghci> [1 of 1] Compiling Main ( shell.hs, interpreted ) +Ok, one module loaded. +ghci> ghci> [1 of 1] Compiling T18330 ( T18330.hs, interpreted ) +Ok, one module loaded. +ghci> ghci> [1 of 1] Compiling T18330 ( T18330.hs, interpreted ) [T18330.extra changed] +Ok, one module loaded. +ghci> Leaving GHCi. diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index a265881501..605bd0d507 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -320,6 +320,9 @@ test('T17500', [extra_run_opts('-ddump-to-file -ddump-bcos')], ghci_script, ['T1 test('T17549', normal, ghci_script, ['T17549.script']) test('T17669', [extra_run_opts('-fexternal-interpreter -fobject-code'), unless(opsys('mingw32'), expect_broken(17669))], ghci_script, ['T17669.script']) +test('T18330', [copy_files, extra_files(['../shell.hs', 'T18330.extra', 'T18330.hs']) + , extra_hc_opts('-v1')] + , ghci_script, ['T18330.script']) test('T18501', normal, ghci_script, ['T18501.script']) test('T18644', normal, ghci_script, ['T18644.script']) test('T18755', normal, ghci_script, ['T18755.script']) -- cgit v1.2.1