FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
basic-cli/tests/env.roc at main · codegod100/basic-cli · GitHub
codegod100
/
basic-cli
Public
forked from
roc-lang/basic-cli
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
basic-cli
/
tests
/
env.roc
Copy path
More file actions
More file actions
Latest commit
History
History
History
75 lines (61 loc) · 1.56 KB
Breadcrumbs
basic-cli
/
tests
/
env.roc
Copy path
File metadata and controls
75 lines (61 loc) · 1.56 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
app
[main!] { pf: platform
"
../platform/main.roc
"
}
import
pf.
Stdout
import
pf.
Env
import
pf.
Path
import
pf.
Arg
exposing
[
Arg
]
main
! :
List
Arg
=
>
Result
{}
_
main
! = |
_args
|
Stdout
.
line
!(
"
"
"
Testing Env module functions...
Testing Env.cwd!:
"
"
"
)?
cwd =
Env
.
cwd
!({})?
Stdout
.
line
!(
"
"
"
cwd: ${Path.display(cwd)}
Testing Env.exe_path!:
"
"
"
)?
exe_path =
Env
.
exe_path
!({})?
Stdout
.
line
!(
"
"
"
exe_path: ${Path.display(exe_path)}
Testing Env.platform!:
"
"
"
)?
platform =
Env
.
platform
!({})
Stdout
.
line
!(
"
"
"
Current platform:${Inspect.to_str(platform)}
Testing Env.dict!:
"
"
"
)?
env_vars =
Env
.
dict
!({})
var_count =
Dict
.
len
(
env_vars
)
Stdout
.
line
!("
Environment
variables count: ${
Num
.
to_str
(
var_count
)}")?
some_env_vars =
Dict
.
to_list
(
env_vars
)
|>
List
.
take_first
(3)
Stdout
.
line
!(
"
"
"
Sample environment variables:${Inspect.to_str(some_env_vars)}
Testing Env.set_cwd!:
"
"
"
)?
# First get the current directory to restore it later
original_dir =
Env
.
cwd
!({})?
ls_list =
Path
.
list_dir
!(
original_dir
)?
dir_list =
ls_list
|>
List
.
keep_if_try
!(|
path
|
Path
.
is_dir
!(
path
))?
first_dir =
List
.
first
(
dir_list
)?
Env
.
set_cwd
!(
first_dir
)?
new_cwd =
Env
.
cwd
!({})?
Stdout
.
line
!(
"
"
"
Changed current directory to: ${Path.display(new_cwd)}
All tests executed.
"
"
"
)?
Ok
({})
Back
|
FazBrowse Home
|
New Git URL