Skip to content

Commit 5f3434e

Browse files
committed
test: Add test witnessing #283
1 parent de2a50b commit 5f3434e

5 files changed

Lines changed: 40 additions & 0 deletions

File tree

test/golden/T283/T283.cabal

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
cabal-version: 3.16
2+
name: T283
3+
version: 0.1.0.0
4+
license: NONE
5+
author: Rodrigo Mesquita
6+
maintainer: rodrigo.m.mesquita@gmail.com
7+
build-type: Simple
8+
extra-doc-files: CHANGELOG.md
9+
10+
common warnings
11+
ghc-options: -Wall
12+
13+
executable T283
14+
import: warnings
15+
main-is: Main.hs
16+
build-depends: base
17+
hs-source-dirs: app
18+
default-language: Haskell2010
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[1 of 3] Compiling GHC.Debugger.View.Class ( in-memory:GHC.Debugger.View.Class, interpreted )[haskell-debugger-view-in-memory]
2+
[2 of 3] Compiling Main ( <TEMPORARY-DIRECTORY>/app/Main.hs, interpreted )[T283-0.1.0.0-inplace-T283]
3+
(hdb)
4+
(hdb) THIS IS A PACKAGE
5+
()
6+
(hdb) Aborted: <interactive>:1:1: error: [GHC-35235]
7+
Could not find module `Main'.
8+
It is not a module in the current program, or in any known package.
9+
(hdb) "If an older version of T283 was installed, we'd now shadow the home-unit Main with the outdated installed Main!"
10+
(hdb) Exiting...

test/golden/T283/T283.hdb-stdin

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
p import Main
2+
p main
3+
p import "T283" Main
4+
p "If an older version of T283 was installed, we'd now shadow the home-unit Main with the outdated installed Main!"

test/golden/T283/T283.hdb-test

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
3+
# Witnesses that package-qualified imports bypass home units (#283)
4+
$HDB -v0 app/Main.hs 2>&1 < T283.hdb-stdin

test/golden/T283/app/Main.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module Main (main) where
2+
3+
main :: IO ()
4+
main = putStrLn "THIS IS A PACKAGE"

0 commit comments

Comments
 (0)