Skip to content

Commit 1a9f2c7

Browse files
committed
use Path.display
1 parent 34fdba7 commit 1a9f2c7

3 files changed

Lines changed: 12 additions & 15 deletions

File tree

ci/expect_scripts/env.exp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@ spawn $env(TESTS_DIR)env
1212
expect "Testing Env module functions..." {
1313
expect -re "Testing Env.cwd!:" {
1414
# Match cwd path that has ArbitraryBytes with non-empty list of integers
15-
# Use curly braces for the regex pattern to avoid Tcl interpretation of [ and ]
16-
expect -re {cwd: \(@InternalPath \(ArbitraryBytes \[\d+(, \d+)*\]\)\)} {
15+
expect -re {cwd: /[^\r\n]*\r\n} {
1716

1817
expect -re "Testing Env.exe_path!:" {
1918
# Match exe_path with any valid format
20-
expect -re {exe_path: \(@InternalPath \(.*\[\d+(, \d+)*\].*\)\)} {
19+
expect -re {exe_path: /[^\r\n]*\r\n} {
2120

2221
expect -re "Testing Env.platform!:" {
2322
# Match platform info with any arch and OS
@@ -28,19 +27,18 @@ expect "Testing Env module functions..." {
2827
# Match environment variables count as non-zero number
2928
expect -re {Environment variables count: (\d+)} {
3029
set env_count $expect_out(1,string)
31-
if {$env_count == 0} {
32-
puts stderr "\nExpect script failed: environment variable count is zero."
30+
if {$env_count < 1} {
31+
puts stderr "\nExpect script failed: environment variable count is $env_count."
3332
exit 1
3433
}
35-
3634
# Match sample environment variables with non-empty strings
3735
# Literal brackets [], parentheses (), and quotes "" need escaping or careful handling
3836
expect -re {Sample environment variables:\[\("\w+", ".*"\)(, \("\w+", ".*"\))*\]} {
3937

4038
expect -re "Testing Env.set_cwd!:" {
4139
# Match changed directory path with non-empty list of integers
42-
expect -re {Changed current directory to: \(@InternalPath \(ArbitraryBytes \[\d+(, \d+)*\]\)\)} {
43-
40+
expect -re {Changed current directory to: /[^\r\n]*\r\n} {
41+
4442
expect "All tests executed!" {
4543
expect eof {
4644
check_exit_and_segfault

flake.lock

Lines changed: 3 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/env.roc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ main! = |_args|
1111
1212
Stdout.line!("\nTesting Env.cwd!:")?
1313
cwd = Env.cwd!({})?
14-
Stdout.line!("cwd: ${Inspect.to_str(cwd)}")?
14+
Stdout.line!("cwd: ${Path.display(cwd)}")?
1515

1616
Stdout.line!("\nTesting Env.exe_path!:")?
1717
exe_path = Env.exe_path!({})?
18-
Stdout.line!("exe_path: ${Inspect.to_str(exe_path)}")?
18+
Stdout.line!("exe_path: ${Path.display(exe_path)}")?
1919

2020
# Test Env.platform!
2121
Stdout.line!("\nTesting Env.platform!:")?
@@ -47,7 +47,7 @@ main! = |_args|
4747

4848
Env.set_cwd!(first_dir)?
4949
new_cwd = Env.cwd!({})?
50-
Stdout.line!("Changed current directory to: ${Inspect.to_str(new_cwd)}")?
50+
Stdout.line!("Changed current directory to: ${Path.display(new_cwd)}")?
5151

5252
Stdout.line!("\nAll tests executed!")?
5353

0 commit comments

Comments
 (0)