mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-10-04 00:48:36 +03:00
idris_support: fix environ for macOS (#3324)
* idris_support: fix environ for macOS * Add test that touches the new implementation of environ --------- Co-authored-by: Sergey Fedorov <barracuda@macos-powerpc.org> Co-authored-by: Mathew Polzin <matt.polzin@gmail.com>
This commit is contained in:
parent
efce152178
commit
1931509c92
@ -23,6 +23,9 @@ char **_argv;
|
||||
extern char **_environ;
|
||||
#include "windows/win_utils.h"
|
||||
#define environ _environ
|
||||
#elif defined(__APPLE__)
|
||||
#include <crt_externs.h>
|
||||
#define environ (*_NSGetEnviron())
|
||||
#else
|
||||
extern char **environ;
|
||||
#endif
|
||||
|
8
tests/base/system_get_environment/Test.idr
Normal file
8
tests/base/system_get_environment/Test.idr
Normal file
@ -0,0 +1,8 @@
|
||||
import System
|
||||
|
||||
main : IO ()
|
||||
main = do
|
||||
env <- getEnvironment
|
||||
-- it better be non-empty because we set a variable before starting this test
|
||||
printLn $ null env
|
||||
|
1
tests/base/system_get_environment/expected
Normal file
1
tests/base/system_get_environment/expected
Normal file
@ -0,0 +1 @@
|
||||
False
|
4
tests/base/system_get_environment/run
Executable file
4
tests/base/system_get_environment/run
Executable file
@ -0,0 +1,4 @@
|
||||
. ../../testutils.sh
|
||||
|
||||
idris2 --cg chez -o test Test.idr
|
||||
HELLO=hi ./build/exec/test
|
Loading…
Reference in New Issue
Block a user