File tree 2 files changed +40
-0
lines changed 2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ {-# LANGUAGE OverloadedStrings #-}
2
+ {-# OPTIONS_GHC -O0 -Wno-name-shadowing #-}
3
+
4
+ module Main (main ) where
5
+
6
+ import Data.String ( fromString )
7
+ import System.Mem
8
+ import System.Posix.Env.ByteString
9
+ import Test.Tasty
10
+ import Test.Tasty.HUnit
11
+
12
+ -- test regression of incorrect 'free': https://github.com/haskell/unix/issues/68#issue-170072591
13
+ main :: IO ()
14
+ main = do
15
+ putEnv " foo=bar"
16
+ defaultMain $ testGroup " All" [ test ]
17
+
18
+ test :: TestTree
19
+ test = testCase " putEnv" $ do
20
+ performMinorGC
21
+ env <- System.Posix.Env.ByteString. getEnv (fromString " foo" )
22
+ performMinorGC
23
+ print env
24
+ env <- System.Posix.Env.ByteString. getEnv (fromString " foo" )
25
+ performMinorGC
26
+ print env
27
+ env <- System.Posix.Env.ByteString. getEnv (fromString " foo" )
28
+ performMinorGC
29
+ print env
30
+ env <- System.Posix.Env.ByteString. getEnv (fromString " foo" )
31
+ print env
32
+ env @?= Just (fromString " bar" )
Original file line number Diff line number Diff line change @@ -242,3 +242,11 @@ test-suite Terminal
242
242
default-language : Haskell2010
243
243
build-depends : base, unix, tasty-hunit
244
244
ghc-options : -Wall
245
+
246
+ test-suite PutEnv001
247
+ hs-source-dirs : tests
248
+ main-is : PutEnv001.hs
249
+ type : exitcode-stdio-1.0
250
+ default-language : Haskell2010
251
+ build-depends : base, unix, tasty, tasty-hunit
252
+ ghc-options : -Wall -with-rtsopts=-V0 -O0
You can’t perform that action at this time.
0 commit comments