on iko/ghcjs-patch-master help sign in
tests: Add stack-simple
commitcf8d73321c879c5a83cc8a5729430c8f717fa879 authorRodney Lorrimar <rodney.lorrimar@iohk.io> dateFri 8 Feb 2019, 10:15 (8 years ago) parentbd603e0
12 files changed+265
test/default.nix+1 test/stack-simple/.gitignore+3 test/stack-simple/.stack.nix/stack-simple.nix+32 test/stack-simple/Setup.hs+2 test/stack-simple/app/Main.hs+6 test/stack-simple/default.nix+35 test/stack-simple/package.yaml+48 test/stack-simple/src/Lib.hs+6 test/stack-simple/stack-pkgs.nix+5 test/stack-simple/stack-simple.cabal+61 test/stack-simple/stack.yaml+64 test/stack-simple/test/Spec.hs+2
test/default.nix+1
@@ -14,6 +14,7 @@ in {
1414 cabal-22 = callPackage ./cabal-22 { inherit (haskell) mkPkgSet; };
1515 with-packages = callPackage ./with-packages { inherit (haskell) mkPkgSet; inherit util; };
1616 builder-haddock = callPackage ./builder-haddock { inherit (haskell) mkPkgSet; };
17+ stack-simple = callPackage ./stack-simple { inherit (haskell) mkStackPkgSet; };
1718
1819 # Run unit tests with: nix-instantiate --eval --strict -A unit
1920 # An empty list means success.
test/stack-simple/.gitignorenew file+3
@@ -0,0 +1,3 @@
1+.stack-work/
2+stack-simple.cabal
3+*~
test/stack-simple/.stack.nix/stack-simple.nixnew file+32
@@ -0,0 +1,32 @@
1+{ system, compiler, flags, pkgs, hsPkgs, pkgconfPkgs, ... }:
2+ ({
3+ flags = {};
4+ package = {
5+ specVersion = "0";
6+ identifier = { name = "stack-simple"; version = "0.1.0.0"; };
7+ license = "BSD-3-Clause";
8+ copyright = "2019 Author name here";
9+ maintainer = "example@example.com";
10+ author = "Author name here";
11+ homepage = "https://github.com/githubuser/stack-simple#readme";
12+ url = "";
13+ synopsis = "";
14+ description = "Please see the README on GitHub at <https://github.com/githubuser/stack-simple#readme>";
15+ buildType = "Simple";
16+ };
17+ components = {
18+ "library" = { depends = [ (hsPkgs.base) ]; };
19+ exes = {
20+ "stack-simple-exe" = {
21+ depends = [ (hsPkgs.base) (hsPkgs.stack-simple) ];
22+ };
23+ };
24+ tests = {
25+ "stack-simple-test" = {
26+ depends = [ (hsPkgs.base) (hsPkgs.stack-simple) ];
27+ };
28+ };
29+ };
30+ } // rec { src = (pkgs.lib).mkDefault ../.; }) // {
31+ cabal-generator = "hpack";
32+ }
test/stack-simple/Setup.hsnew file+2
@@ -0,0 +1,2 @@
1+import Distribution.Simple
2+main = defaultMain
test/stack-simple/app/Main.hsnew file+6
@@ -0,0 +1,6 @@
1+module Main where
2+
3+import Lib
4+
5+main :: IO ()
6+main = someFunc
test/stack-simple/default.nixnew file+35
@@ -0,0 +1,35 @@
1+{ stdenv, mkStackPkgSet }:
2+
3+with stdenv.lib;
4+
5+let
6+ # ./stack-pkgs.nix and ./.stack.nix/stack-simple are
7+ # generated by running hpack then stack-to-nix.
8+ pkgSet = mkStackPkgSet {
9+ stack-pkgs = import ./stack-pkgs.nix;
10+ pkg-def-overlays = [];
11+ modules = [];
12+ };
13+
14+ packages = pkgSet.config.hsPkgs;
15+
16+in
17+ stdenv.mkDerivation {
18+ name = "stack-simple-test";
19+
20+ buildCommand = ''
21+ exe="${packages.stack-simple.components.exes.stack-simple-exe}/bin/stack-simple-exe"
22+
23+ printf "checking whether executable runs... " >& 2
24+ $exe
25+
26+ touch $out
27+ '';
28+
29+ meta.platforms = platforms.all;
30+
31+ passthru = {
32+ # Attributes used for debugging with nix repl
33+ inherit pkgSet packages;
34+ };
35+ }
test/stack-simple/package.yamlnew file+48
@@ -0,0 +1,48 @@
1+name: stack-simple
2+version: 0.1.0.0
3+github: "githubuser/stack-simple"
4+license: BSD3
5+author: "Author name here"
6+maintainer: "example@example.com"
7+copyright: "2019 Author name here"
8+
9+extra-source-files:
10+- README.md
11+- ChangeLog.md
12+
13+# Metadata used when publishing your package
14+# synopsis: Short description of your package
15+# category: Web
16+
17+# To avoid duplicated efforts in documentation and dealing with the
18+# complications of embedding Haddock markup inside cabal files, it is
19+# common to point users to the README.md file.
20+description: Please see the README on GitHub at <https://github.com/githubuser/stack-simple#readme>
21+
22+dependencies:
23+- base >= 4.7 && < 5
24+
25+library:
26+ source-dirs: src
27+
28+executables:
29+ stack-simple-exe:
30+ main: Main.hs
31+ source-dirs: app
32+ ghc-options:
33+ - -threaded
34+ - -rtsopts
35+ - -with-rtsopts=-N
36+ dependencies:
37+ - stack-simple
38+
39+tests:
40+ stack-simple-test:
41+ main: Spec.hs
42+ source-dirs: test
43+ ghc-options:
44+ - -threaded
45+ - -rtsopts
46+ - -with-rtsopts=-N
47+ dependencies:
48+ - stack-simple
test/stack-simple/src/Lib.hsnew file+6
@@ -0,0 +1,6 @@
1+module Lib
2+ ( someFunc
3+ ) where
4+
5+someFunc :: IO ()
6+someFunc = putStrLn "someFunc"
test/stack-simple/stack-pkgs.nixnew file+5
@@ -0,0 +1,5 @@
1+{
2+ overlay = hackage:
3+ { packages = {} // { stack-simple = ./.stack.nix/stack-simple.nix; }; };
4+ resolver = "lts-13.6";
5+ }
test/stack-simple/stack-simple.cabalnew file+61
@@ -0,0 +1,61 @@
1+cabal-version: 1.12
2+
3+-- This file has been generated from package.yaml by hpack version 0.31.1.
4+--
5+-- see: https://github.com/sol/hpack
6+--
7+-- hash: 0df70dbda375296766e47fd09b809934bff5ee3edb5a16e93681d4cb37cef875
8+
9+name: stack-simple
10+version: 0.1.0.0
11+description: Please see the README on GitHub at <https://github.com/githubuser/stack-simple#readme>
12+homepage: https://github.com/githubuser/stack-simple#readme
13+bug-reports: https://github.com/githubuser/stack-simple/issues
14+author: Author name here
15+maintainer: example@example.com
16+copyright: 2019 Author name here
17+license: BSD3
18+build-type: Simple
19+extra-source-files:
20+ README.md
21+ ChangeLog.md
22+
23+source-repository head
24+ type: git
25+ location: https://github.com/githubuser/stack-simple
26+
27+library
28+ exposed-modules:
29+ Lib
30+ other-modules:
31+ Paths_stack_simple
32+ hs-source-dirs:
33+ src
34+ build-depends:
35+ base >=4.7 && <5
36+ default-language: Haskell2010
37+
38+executable stack-simple-exe
39+ main-is: Main.hs
40+ other-modules:
41+ Paths_stack_simple
42+ hs-source-dirs:
43+ app
44+ ghc-options: -threaded -rtsopts -with-rtsopts=-N
45+ build-depends:
46+ base >=4.7 && <5
47+ , stack-simple
48+ default-language: Haskell2010
49+
50+test-suite stack-simple-test
51+ type: exitcode-stdio-1.0
52+ main-is: Spec.hs
53+ other-modules:
54+ Paths_stack_simple
55+ hs-source-dirs:
56+ test
57+ ghc-options: -threaded -rtsopts -with-rtsopts=-N
58+ build-depends:
59+ base >=4.7 && <5
60+ , stack-simple
61+ default-language: Haskell2010
test/stack-simple/stack.yamlnew file+64
@@ -0,0 +1,64 @@
1+# This file was automatically generated by 'stack init'
2+#
3+# Some commonly used options have been documented as comments in this file.
4+# For advanced use and comprehensive documentation of the format, please see:
5+# https://docs.haskellstack.org/en/stable/yaml_configuration/
6+
7+# Resolver to choose a 'specific' stackage snapshot or a compiler version.
8+# A snapshot resolver dictates the compiler version and the set of packages
9+# to be used for project dependencies. For example:
10+#
11+# resolver: lts-3.5
12+# resolver: nightly-2015-09-21
13+# resolver: ghc-7.10.2
14+#
15+# The location of a snapshot can be provided as a file or url. Stack assumes
16+# a snapshot provided as a file might change, whereas a url resource does not.
17+#
18+# resolver: ./custom-snapshot.yaml
19+# resolver: https://example.com/snapshots/2018-01-01.yaml
20+resolver: lts-13.6
21+
22+# User packages to be built.
23+# Various formats can be used as shown in the example below.
24+#
25+# packages:
26+# - some-directory
27+# - https://example.com/foo/bar/baz-0.0.2.tar.gz
28+# - location:
29+# git: https://github.com/commercialhaskell/stack.git
30+# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a
31+# - location: https://github.com/commercialhaskell/stack/commit/e7b331f14bcffb8367cd58fbfc8b40ec7642100a
32+# subdirs:
33+# - auto-update
34+# - wai
35+packages:
36+- .
37+# Dependency packages to be pulled from upstream that are not in the resolver
38+# using the same syntax as the packages field.
39+# (e.g., acme-missiles-0.3)
40+# extra-deps: []
41+
42+# Override default flag values for local packages and extra-deps
43+# flags: {}
44+
45+# Extra package databases containing global packages
46+# extra-package-dbs: []
47+
48+# Control whether we use the GHC we find on the path
49+# system-ghc: true
50+#
51+# Require a specific version of stack, using version ranges
52+# require-stack-version: -any # Default
53+# require-stack-version: ">=1.9"
54+#
55+# Override the architecture used by stack, especially useful on Windows
56+# arch: i386
57+# arch: x86_64
58+#
59+# Extra directories used by stack for building
60+# extra-include-dirs: [/path/to/dir]
61+# extra-lib-dirs: [/path/to/dir]
62+#
63+# Allow a newer minor version of GHC than the snapshot specifies
64+# compiler-check: newer-minor
test/stack-simple/test/Spec.hsnew file+2
@@ -0,0 +1,2 @@
1+main :: IO ()
2+main = putStrLn "Test suite not yet implemented"