Commit 36eb65e3 authored by Edward Z. Yang's avatar Edward Z. Yang
Browse files

Tests for internal libraries (#269) and separate cabal_macros.h (#1893)


Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
parent 516abff9
......@@ -119,14 +119,30 @@ extra-source-files:
tests/PackageTests/HaddockNewline/A.hs
tests/PackageTests/HaddockNewline/HaddockNewline.cabal
tests/PackageTests/HaddockNewline/Setup.hs
tests/PackageTests/MultipleLibraries/p.cabal
tests/PackageTests/MultipleLibraries/p/P.hs
tests/PackageTests/MultipleLibraries/p/Foo.hs
tests/PackageTests/MultipleLibraries/p/p.cabal
tests/PackageTests/MultipleLibraries/p/p/P.hs
tests/PackageTests/MultipleLibraries/p/q/Q.hs
tests/PackageTests/MultipleLibraries/q/Q.hs
tests/PackageTests/MultipleLibraries/q/q.cabal
tests/PackageTests/InternalLibraries/Executable/dist-test.Dynamic/test.sh
tests/PackageTests/InternalLibraries/Executable/dist-test.Static/test.sh
tests/PackageTests/InternalLibraries/Executable/exe/Main.hs
tests/PackageTests/InternalLibraries/Executable/foo.cabal
tests/PackageTests/InternalLibraries/Executable/src/Foo.hs
tests/PackageTests/InternalLibraries/Library/dist-test/test.sh
tests/PackageTests/InternalLibraries/Library/fooexe/Main.hs
tests/PackageTests/InternalLibraries/Library/fooexe/fooexe.cabal
tests/PackageTests/InternalLibraries/Library/foolib/Foo.hs
tests/PackageTests/InternalLibraries/Library/foolib/foolib.cabal
tests/PackageTests/InternalLibraries/Library/foolib/private/Internal.hs
tests/PackageTests/InternalLibraries/dist-test/test.sh
tests/PackageTests/InternalLibraries/p/Foo.hs
tests/PackageTests/InternalLibraries/p/p.cabal
tests/PackageTests/InternalLibraries/p/p/P.hs
tests/PackageTests/InternalLibraries/p/q/Q.hs
tests/PackageTests/InternalLibraries/q/Q.hs
tests/PackageTests/InternalLibraries/q/q.cabal
tests/PackageTests/Macros/A.hs
tests/PackageTests/Macros/B.hs
tests/PackageTests/Macros/Main.hs
tests/PackageTests/Macros/dist-test/test.sh
tests/PackageTests/Macros/macros.cabal
tests/PackageTests/Macros/src/C.hs
tests/PackageTests/Options.hs
tests/PackageTests/OrderFlags/Foo.hs
tests/PackageTests/OrderFlags/my.cabal
......
name: foo
version: 0.1.0.0
license: BSD3
author: Edward Z. Yang
maintainer: ezyang@cs.stanford.edu
build-type: Simple
cabal-version: >=1.23
library foo-internal
exposed-modules: Foo
build-depends: base
hs-source-dirs: src
default-language: Haskell2010
executable foo
main-is: Main.hs
build-depends: base, foo-internal
hs-source-dirs: exe
module Foo where
{-# NOINLINE foo #-}
foo :: Int -> Int
foo x = x + 23
module Main where
import Foo
main :: IO ()
main = print foo
name: fooexe
version: 0.1.0.0
license: BSD3
author: Edward Z. Yang
maintainer: ezyang@cs.stanford.edu
build-type: Simple
cabal-version: >=1.10
executable fooexe
main-is: Main.hs
build-depends: base, foolib
default-language: Haskell2010
module Foo where
import Internal
foo = internal + 2
name: foolib
version: 0.1.0.0
license: BSD3
author: Edward Z. Yang
maintainer: ezyang@cs.stanford.edu
build-type: Simple
cabal-version: >=1.23
library foolib-internal
exposed-modules: Internal
hs-source-dirs: private
build-depends: base
library
exposed-modules: Foo
build-depends: base, foolib-internal
default-language: Haskell2010
module Internal where
{-# NOINLINE internal #-}
internal :: Int
internal = 23
{-# LANGUAGE CPP #-}
import C
#ifdef VERSION_filepath
#error "Should not see macro from library"
#endif
#ifdef VERSION_containers
#error "Should not see macro from executable macros-b"
#endif
main = do
putStrLn CURRENT_COMPONENT_ID
{-# LANGUAGE CPP #-}
import C
#ifdef VERSION_filepath
#error "Should not see macro from library"
#endif
#ifdef VERSION_deepseq
#error "Should not see macro from executable macros-a"
#endif
main = do
putStrLn CURRENT_COMPONENT_ID
module Main where
main :: IO ()
main = putStrLn "Hello, Haskell!"
name: macros
version: 0.1.0.0
license: BSD3
license-file: LICENSE
author: Edward Z. Yang
maintainer: ezyang@cs.stanford.edu
build-type: Simple
cabal-version: >=1.10
library macros
exposed-modules: C
hs-source-dirs: src
build-depends: base, filepath
executable macros-a
main-is: A.hs
build-depends: base, deepseq, macros
default-language: Haskell2010
executable macros-b
main-is: B.hs
build-depends: base, containers, macros
default-language: Haskell2010
{-# LANGUAGE CPP #-}
module C where
#ifdef VERSION_deepseq
#error "Should not see macro from executable macros-a"
#endif
#ifdef VERSION_containers
#error "Should not see macro from executable macros-b"
#endif
c :: String
c = CURRENT_COMPONENT_ID
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment